It’s been a few years since I wrote my original guide on how to get Enphase Envoy working with Home Assistant Energy Dashbard.
I figured I would try start from scratch to document what the process and experience would be like for a brand new user with Home Assistant version 2024.4.
Let’s start with my solar setup.
I live in Australia and since 3 years ago in April 2021, I have owned an Enphase Envoy that looks like this on the left and has 2 CT clamps as shown on the right for consumption/production monitoring.
Details obtained from the device remotely by visiting https://envoy.local/home and logging in to it using my enphase enlighten/enphase cloud credentials.
Part Number
800-00654-r06
Software Version
D7.6.175 (f79c8d)
Software Build Date
22 Jun, 2023 8:43 PM
In all of the following screenshots, I will be removing my serial number and IP address information for privacy.
New Home Assistant installation
I setup a brand new copy of Home Assistant and once it was finished installing, I found that Home Assistant had automatically discovered my Envoy on the wifi network.
I pressed configure and was asked for my Enphase cloud credentials.
To be clear, these are the same credentials you use to login to https://enlighten.enphaseenergy.com/
Once those credentials are accepted, it then shows a Success! message
Observations:
-
All power sensors are in kW. (1,000 W = 1 kW)
-
All energy sensors are in kWh. (1 kW of power continuous load over 60mins = 1 kWh of energy consumed)
-
All lifetime energy sensors are in MWh. (1,000,000 Wh = 1,000 kWh = 1 MWh)
-
Each sensor is updated every 60 seconds.
Energy Dashboard
It is pointless trying to get these Enphase provided energy sensors to be used by the Energy Dashboard in their default state as the energy data is different to what is expected by Energy Dashboard, but that doesnt mean we can’t improvise.
The Envoy integration provides sensors for:
-
house consumption instead of grid consumption
Note: If the house consumes more than the solar system is producing, the house will import the excess power difference it needs from the grid. -
solar production instead of return to grid
Note: solar production will first be consumed by the house and if production power is higher than what the house consumes, the excess power difference will be returned to the grid.
As it is physically impossible for your house to be importing and exporting power at the exact same time, we can exploit the mathematical difference between solar production and house consumption to calculate if your house is importing power from the grid or exporting power to the grid.
To get Home Assistant to calculate this for us, we have to setup a template sensor in Home Assistant to calculate what Energy Dashboard is expecting.
The guide is focussed on 2 steps.
Step 1 - Setting up template sensors to perform calculations using data from the enphase sensors.
The template sensors we need to create are:
power import in W (grid in)
power export in W (grid out)
Step 2 - Setting up Riemann Sum sensors which convert:
power import in W to energy import in kWh
power export in W to energy export in kWh
Note: Some people may ask “can’t I have everything in kW?”.
The answer is that the Riemann Sum sensors expect the data source to be in W.
Watts are the only way I could get the Riemann Sum sensors to work.
Edit, I just tried it without specifying the metric prefix, and it will work with whatever source metric you are using.
The issue is, once you click on a metric prefix, you cannot seem to unclick it in the GUI.
If you mess this up, you can correct it in Developer tools
Step 1a - Create a Power Export Template Sensor
Go to settings
Devices and services
Helpers
+Create Helper
{} Template
Template a sensor
Template sensor
Name: Power Export
State template:
{{
[ 0,
states('sensor.envoy_SERIALNUMBER_current_power_production')
| float(0) * 1000
-
states('sensor.envoy_SERIALNUMBER_current_power_consumption')
| float(0) * 1000 ]
| max | int(0)
}}
unit_of_measurement: W
device_class: Power
state_class: Measurement
Press Submit
Step 1b - Create a Power Import Template Sensor
Go to settings
Devices and services
Helpers
+Create Helper
{} Template
Template a sensor
Template sensor
Name: Power Import
State template:
{{
[ 0,
states('sensor.envoy_SERIALNUMBER_current_power_consumption')
| float(0) * 1000
-
states('sensor.envoy_SERIALNUMBER_current_power_production')
| float(0) * 1000 ]
| max | int(0)
}}
unit_of_measurement: W
device_class: Power
state_class: Measurement
Press Submit
Step 1 complete
Step 2a - Create Energy Export Sensor
Go to settings
Devices and services
Helpers
+Create Helper
Integration - Riemann sum integral sensor
Add Riemann sum integral sensor
Name: Energy Export
Input Sensor: Power Export
Integration Method: Right Riemann Sum
Precision: 3 is default
Metric Prefix: k (kilo)
Time Unit: Hours
Press submit.
Step 2b - Create Energy Import Sensor
Go to settings
Devices and services
Helpers
+Create Helper
Integration - Riemann sum integral sensor
Add Riemann sum integral sensor
Name: Energy Import
Input Sensor: Power Import
Integration Method: Right Riemann Sum
Precision: 3 is default
Metric Prefix: k (kilo)
Time Unit: Hours
Press submit.
You should now have
2 template based Power sensors
and
2 Integration based Energy Sensors
Step 2 complete.
Note: As it is night time right now for me, my Energy Export sensor will not work at all until tomorrow when the sun starts shining again.
If it is night time, the energy sensor will not be formatted correctly yet.
You can tell due to the subtle difference between the icon and the icons for the Energy sensors.
For now, I can go to
Energy
and then setup Grid Consumption
Choose the Energy Import sensor you just created.
I then added my Solar production energy using the sensor:
Envoy SERIALNUMBER Energy production today
I then left these overnight to see what happened and what I found was that I had a small amount of production energy occuring overnight which is physically impossible when the sun is below the horizon and something I want to fix in in a post after this post.