Back to Integrations
integrationGmail node
integrationHome Assistant node

Gmail and Home Assistant integration

Save yourself the work of writing custom integrations for Gmail and Home Assistant and use n8n instead. Build adaptable and scalable Communication, HITL, and Miscellaneous workflows that work with your technology stack. All within a building experience you will love.

How to connect Gmail and Home Assistant

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Gmail and Home Assistant integration: Create a new workflow and add the first step

Step 2: Add and configure Gmail and Home Assistant nodes

You can find Gmail and Home Assistant in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Gmail and Home Assistant nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Gmail and Home Assistant integration: Add and configure Gmail and Home Assistant nodes

Step 3: Connect Gmail and Home Assistant

A connection establishes a link between Gmail and Home Assistant (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

Gmail and Home Assistant integration: Connect Gmail and Home Assistant

Step 4: Customize and extend your Gmail and Home Assistant integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Gmail and Home Assistant with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Gmail and Home Assistant integration: Customize and extend your Gmail and Home Assistant integration

Step 5: Test and activate your Gmail and Home Assistant workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Gmail to Home Assistant or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

Gmail and Home Assistant integration: Test and activate your Gmail and Home Assistant workflow

Import E.ON W1000 energy meter data to Home Assistant with Spook integration

UPDATES:
2025-12-03 fix JS code in calculate hourly sum node

E.ON W1000 → n8n → Home Assistant (Spook) “Integration”

This workflow processes emails from the E.ON portal containing 15-minute +A -A (import/export) data and daily 1.8.0 2.8.0 meter readings.
It extracts the required columns from the attached XLSX file, groups the 15-minute values by hour, then:

updates the Spook/Recorder statistics under the IDs sensor.grid_energy_import and sensor.grid_energy_export, and
sets the current meter readings for the entities input_number.grid_import_meter and input_number.grid_export_meter.

> You may need to modify the workflow if there are changes in how E.ON sends scheduled exports. If the exported data format changes, please report it on Github!

Requirements

n8n (cloud or self-hosted)
HACS addon available here: Rbillon59/home-assistant-addons
Official n8n Docker Compose template
Simplified n8n Docker Compose template available on Github
(For Gmail) Gmail API authentication (OAuth2) read-only email access to the account receiving the messages
Setup guide available here
(For IMAP) IMAP provider credentials
Home Assistant access via Long-Lived Access Token or API key
Setup guide available here
Spook integration
Documentation and installation guide available here

E.ON Portal Setup

Create a scheduled export on the E.ON portal with the following parameters:
Under the Remote Meter Reading menu, click on the + new scheduled export setting button.
Specify POD identifier(s): choose one of the PODs you want to query.
Specify meter variables: select the following:
+A Active Power Consumption
-A Active Power Feed-In
DP_1-1:1.8.00 Active Power Consumption Daily Reading
DP_1-1:2.8.0
0 Active Power Feed-In Daily Reading
Export sending frequency: daily
Days of historical data to include: recommended 7 days to backfill missed data.
Email subject: by default, use [EON-W1000]. If processing multiple PODs with the workflow, give each a unique identifier.

Home Assistant Preparation

Create the following input_number entities in configuration.yaml or via Helpers:

input_number:
grid_import_meter:
name: grid_import_meter
mode: box
initial: 0
min: 0
max: 9999999999
step: 0.001
unit_of_measurement: kWh
grid_export_meter:
name: grid_export_meter
mode: box
initial: 0
min: 0
max: 9999999999
step: 0.001
unit_of_measurement: kWh
> If you name the entities differently, make sure to reflect these changes in the workflow.

Create the following template_sensor entities in configuration.yaml or via Helpers:

input_number:
grid_import_meter:
name: grid_import_meter
mode: box
initial: 0
min: 0
max: 9999999999
step: 0.001
unit_of_measurement: kWh
grid_export_meter:
name: grid_export_meter
mode: box
initial: 0
min: 0
max: 9999999999
step: 0.001
unit_of_measurement: kWh
>If you name the entities differently, make sure to reflect these changes in the workflow.

create the following template_sensor entities in config.yaml or via Helpers:

template:
sensor:
name: "grid_energy_import"
state: "{{ states('input_number.grid_import_meter') | float(0) }}"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
name: "grid_energy_export"
state: "{{ states('input_number.grid_export_meter') | float(0) }}"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
> If you name the entities differently, make sure to reflect these changes in the workflow.

n8n import and authentication

importing the workflow

In n8n → Workflows → Import from File/Clipboard → paste the JSON.
Select the downloaded JSON and paste it into a new workflow using Ctrl+V.
Set up n8n Credentials
The credentials must be configured in the Home Assistant and Gmail nodes. The setup process is described in the Requirements section.

Nodes used in this workflow

Popular Gmail and Home Assistant workflows

Import E.ON W1000 Energy Meter Data to Home Assistant with Spook Integration

UPDATES: 2025-12-03 fix JS code in calculate hourly sum node E.ON W1000 → n8n → Home Assistant (Spook) “Integration” This workflow processes emails from the E.ON portal containing 15-minute +A -A (import/export) data and daily 1.8.0 2.8.0 meter readings. It extracts the required columns from the attached XLSX file, groups the 15-minute values by hour, then: updates the Spook/Recorder statistics under the IDs sensor.grid_energy_import and sensor.grid_energy_export, and sets the current meter readings for the entities input_number.grid_import_meter and input_number.grid_export_meter. > You may need to modify the workflow if there are changes in how E.ON sends scheduled exports. If the exported data format changes, please report it on Github! Requirements n8n (cloud or self-hosted) HACS addon available here: Rbillon59/home-assistant-addons Official n8n Docker Compose template Simplified n8n Docker Compose template available on Github (For Gmail) Gmail API authentication (OAuth2) read-only email access to the account receiving the messages Setup guide available here (For IMAP) IMAP provider credentials Home Assistant access via Long-Lived Access Token or API key Setup guide available here Spook integration Documentation and installation guide available here E.ON Portal Setup Create a scheduled export on the E.ON portal with the following parameters: Under the Remote Meter Reading menu, click on the + new scheduled export setting button. Specify POD identifier(s): choose one of the PODs you want to query. Specify meter variables: select the following: +A Active Power Consumption -A Active Power Feed-In DP_1-1:1.8.0*0 Active Power Consumption Daily Reading DP_1-1:2.8.0*0 Active Power Feed-In Daily Reading Export sending frequency: daily Days of historical data to include: recommended 7 days to backfill missed data. Email subject: by default, use [EON-W1000]. If processing multiple PODs with the workflow, give each a unique identifier. Home Assistant Preparation Create the following input_number entities in configuration.yaml or via Helpers: input_number: grid_import_meter: name: grid_import_meter mode: box initial: 0 min: 0 max: 9999999999 step: 0.001 unit_of_measurement: kWh grid_export_meter: name: grid_export_meter mode: box initial: 0 min: 0 max: 9999999999 step: 0.001 unit_of_measurement: kWh > If you name the entities differently, make sure to reflect these changes in the workflow. Create the following template_sensor entities in configuration.yaml or via Helpers: input_number: grid_import_meter: name: grid_import_meter mode: box initial: 0 min: 0 max: 9999999999 step: 0.001 unit_of_measurement: kWh grid_export_meter: name: grid_export_meter mode: box initial: 0 min: 0 max: 9999999999 step: 0.001 unit_of_measurement: kWh >If you name the entities differently, make sure to reflect these changes in the workflow. create the following template_sensor entities in config.yaml or via Helpers: template: sensor: name: "grid_energy_import" state: "{{ states('input_number.grid_import_meter') | float(0) }}" unit_of_measurement: "kWh" device_class: energy state_class: total_increasing name: "grid_energy_export" state: "{{ states('input_number.grid_export_meter') | float(0) }}" unit_of_measurement: "kWh" device_class: energy state_class: total_increasing > If you name the entities differently, make sure to reflect these changes in the workflow. n8n import and authentication importing the workflow In n8n → Workflows → Import from File/Clipboard → paste the JSON. Select the downloaded JSON and paste it into a new workflow using Ctrl+V. Set up n8n Credentials The credentials must be configured in the Home Assistant and Gmail nodes. The setup process is described in the Requirements section.

Build your own Gmail and Home Assistant integration

Create custom Gmail and Home Assistant workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Gmail supported actions

Add Label
Delete
Get
Get Many
Mark as Read
Mark as Unread
Remove Label
Reply
Send
Send and Wait for Response
Create
Delete
Get
Get Many
Create
Delete
Get
Get Many
Add Label
Delete
Get
Get Many
Remove Label
Reply
Trash
Untrash

Home Assistant supported actions

Get Screenshot
Get the camera screenshot
Get
Get the configuration
Check Configuration
Check the configuration
Create
Create an event
Get Many
Get many events
Get Error Logs
Get a log for a specific entity
Get Logbook Entries
Get all logs
Call
Call a service within a specific domain
Get Many
Get many services
Create or Update
Create a new record, or update the current one if it already exists (upsert)
Get
Get a state for a specific entity
Get Many
Get many states
Create
Create a template

FAQs

  • Can Gmail connect with Home Assistant?

  • Can I use Gmail’s API with n8n?

  • Can I use Home Assistant’s API with n8n?

  • Is n8n secure for integrating Gmail and Home Assistant?

  • How to get started with Gmail and Home Assistant integration in n8n.io?

Need help setting up your Gmail and Home Assistant integration?

Discover our latest community's recommendations and join the discussions about Gmail and Home Assistant integration.
jake chard
Jan Koch
Paul Kennard

Looking to integrate Gmail and Home Assistant in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Gmail with Home Assistant

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon