Enphase Envoy on 2024.4

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.

image

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.

image

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

image

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
image

Devices and services
image

Helpers
image

+Create Helper
image

{} Template
image

Template a sensor
image

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
image

Devices and services
image

Helpers
image

+Create Helper
image

{} Template
image

Template a sensor
image

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
image

Devices and services
image

Helpers
image

+Create Helper
image

Integration - Riemann sum integral sensor
image

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
image

Devices and services
image

Helpers
image

+Create Helper
image

Integration - Riemann sum integral sensor
image

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 image icon and the image icons for the Energy sensors.

For now, I can go to
Energy
image

and then setup Grid Consumption
image

Choose the Energy Import sensor you just created.
image

I then added my Solar production energy using the sensor:
Envoy SERIALNUMBER Energy production today
image

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.

1 Like

Thanks for the work, very clear to follow. I just have a quick question. I see a lot of people using Riemann Sum for utility meters but tbh I haven’t done enough researches to understand why, cause I’m using the directly added values, i.e: sensor.envoy_SN_energy_production_today, or sensor.envoy_SN_current_power_production. What is the advantages of setting up utility meters using Riemann Sum? Thanks again

Hi @xzelz,
The Utility Meter - Home Assistant is used for having multiple tariffs where your provider will charge you different rates at different times of the day.

Here is an example of what is possible with utility meter with 3 import tariffs and 1 export tariff.

image

I have written other guides in the past on how to use utility meter and will eventually get to writing a guide to do it via the GUI in this topic in the near future.

For now, here is a quote from one of my most recent previous guides

1 Like

Thanks @del13r . I’ve seen another post of yours where you used Rest sensors. Have you now abandoned that in favour of the integration?

Hi @Sddawson,

This guide above is for the most basic, bare minimum steps to get a brand new user working with energy dashboard.

I still use the rest sensors in my own setup, however these are a bit more complex for new users so I have chosen not to mention them here.

I wrote this guide as I could tell something had changed with the native enphase integration when I started seeing people trying to multiply kW by 1000 to get W and then asking for help. This indicated to me that my 3 year old guide was out of date and hence why I wrote an updated new user guide above.

OK, makes sense, thanks. When I had an Envoy, I used all your knowledge to integrate that into HA very successfully. I’m about to get a solar quote for a different house, and will probably go Envoy again (in Oz), just because there are guides like yours to follow. I’ll probably go the Rest route. Thanks for everything you do.

1 Like

Thank you for the detailed comment. I do have my setup somewhat similar to yours but I mostly created my sensors with Utility Meter UI and calculations in configuration.yaml and I was not sure if it’s the same as using Riemann sum, I think I get it now. If I was able to read your post earlier I would not do all the energy calculations by myself haha, took me quite some time to finish. I also did calculation for daily power usage, daily solar power usage etc. My electrical plan do onpeak/offpeak/midpeak. The offpeak includes weekend, and holidays as well.

Here is a quick look of my setup:

Using Riemann sum integral alone will not calculate costs.

An example of what Riemann sum integral is used for is for recording the instantanous power figures in W and converting them to energy figures in kW.

If I turn on an electrical device that steadily consumes 1030 W and leave that device on for an hour, then that device has consumed 1.03 kWh over the course of an hour.

Power in W - real world example

Riemann sum integral then incrementally records how much power the device consumed each time the power sensor updates and graphs those samples over time.

Energy in kWh - real world example generated by Riemann sum integral using only the power sensor above as the data input source.

Energy Dashboard basically samples the Lifetime Energy Value at both the start and end of each hour and records only the difference.

Energy Dashboard Samples Value Metric
Lifetime energy value at 3:00 PM 2182.52 kWh
Lifetime energy value at 2:00 PM 2181.49 kWh
Difference between start and end 1.03 kWh

How Energy Dashboard presents this same data.

I use both the built in energy dashboard and additional template sensors because energy dashboard does not support my daily service charge.

Here is a sample of how I am using utility meter readings and adding the daily service charge.
Note: this sensor is not used by Energy Dashboard and is only for my own benefit unrelated to energy dashboard.

  - sensor:
      - name: Today Energy Total Cost
        device_class: monetary
        state_class: total
        unit_of_measurement: AUD
        state: >
          {{ (states('sensor.daily_energy_Peak') | float(0) * (states('input_number.peak') | float(0) * states('input_number.discount') | float(0) ) +
              states('sensor.daily_energy_Shoulder') | float(0) * (states('input_number.shoulder') | float(0) * states('input_number.discount') | float(0) ) +
              states('sensor.daily_energy_OffPeak') | float(0) * (states('input_number.offpeak') | float(0) * states('input_number.discount') | float(0) ) -
              states('sensor.daily_energy_export_buyback') | float(0) * states('input_number.feed_in') | float(0) +
              states('input_number.dailysupply') | float(0) * states('input_number.discount') | float(0) ) | round(2) }}

Here is an example graph of 24 hours where I start the day with my $0.98 service charge, then the cost rises as I consume electricity before the sun rises, then the cost drops as I sell electricity back to the grid, then rises again once the sun sets finishing the day with a total of $2.20 charge.


r