Enphase Envoy with Energy Dashboard

With your Solar inverter, it is possible to be doing 3 things all at the same time:
Solar panels producing power. (measured as production)
House consuming generated solar power from the solar panels. (measured as consumption)
House either consuming grid power or exporting grid power (never both at the same time) (measured as consumption)

Visual aid courtesy of Tesla style add on

Grid Export Example
2.1 kW house consumption -
2.8 kW solar production =
-0.7 kW exporting to the grid due to production number being larger than the consumption number

Grid Import Example
1.9 kW house consumption -
0.5 kW solar production =
1.4 kW importing from the grid due to consumption number being larger than production number

The inverter adds both solar consumption and grid consumption together into 1 number.

The grid is only involved in 1 of these 3 above activities.

The reason why we have to use power sensors is because when it comes to the grid, you will never be importing from grid and exporting to the grid at the same time.

This fundamental difference is what lets us calculate grid import and grid export based on inverter power figures.

When you take inverter production in Watts and subtract the inverter consumption in Watts, this will give you either a negative, 0 or positive value. I can manipulate that figure so that home assistant only records positive figures, sort of like a counter. This is how I calculate grid export.

When you take an inverter power consumption in W and subtract inverter power production in W, this will give you either a negative, 0 or positive value. I can manipulate that figure so that home assistant only records positive figures, sort of like a counter. This is how I calculate grid import.

When you do the same with accumulated energy in Wh it does not work the same way due to the negative, 0, positive logic no longer having a meaningful effect.

The statistical sensors require that data be stored to enable the integration to work.

So if people have limited their recorder to only certain entities or domains then the historical sensors and energy integration won’t work.

It’s not necessarily something wrong with the instructions, but it’s a larger issue that would apply to anyone who restricts recording of sensors to individual entities or only certain domains.

1 Like

aha, that makes more sense now.

Ive never messed with the recorder before so i was a bit confused why it was being brought up.

Ok, thank you for your insights. I have to look into this a bit more. I was thinking maybe this would be a simple addition to the envoy_reader API or even just a simple addition only on the Home Assistant envoy sensor code.

The Envoy backend does expose a net-consumption value. I’ll see if I can use that instead.

net-consumption is the same as getting production and subtracting consumption.
It wont work because the number goes up and down rather than just up.

Here is a way to test the logic in home assistant using Developer Tools / Template

{% set production = states('sensor.envoy_SERIALNUMBER_current_power_production') | int %}
{% set consumption = states('sensor.envoy_SERIALNUMBER_current_power_consumption') | int %}

Production = {{ production }}
Consumption = {{ consumption }}
Net = {{ production - consumption }}

Results in Watts (W)

Production = 5781
Consumption = 1986
Net = 3795

Now I do the same with lifetime figures

{% set production = states('sensor.envoy_SERIALNUMBER_lifetime_energy_production') | int %}
{% set consumption = states('sensor.envoy_SERIALNUMBER_lifetime_energy_consumption') | int %}

Production = {{ production }}
Consumption = {{ consumption }}
Net = {{ production - consumption }}

Results in Watt hours (Wh)

Production = 3218663
Consumption = 3116485
Net = 102178

If you press spacebar every minute or so, the figures will update.

So, when you go to Developer Tools / States and type in _current into Entity, what do you get?

image

On my home system I only have Current Production, because my Envoy is old and only supports Production data.

I can load another Envoy that is exposed on the Internet into my development system, and that Envoy has Production and Consumption data.
Screen Shot 2021-08-11 at 8.21.13 PM

Great, now, when you choose etiher, do you get a number show up for each under state like this?

Consumption
image

Production
image

Yeah each one has a value

Thats great news then. Your envoy is recording consumption and production.
At what point did you decide this wasnt going to work?

Wait, you have more than 1 envoy? Im confused now.
Most houses only have 1 envoy.
Which envoy are you showing me in your screenshots that have values for both production and consumption?

I’ll have to play around with it a bit more. Maybe I can get something to work.

I maintain the Enphase Envoy sensor code in Home Assistant (or atleast try to been bust the last few months) just getting back to it now and trying to get the Return to Grid values to correctly appear in Home Assistant.

I have access to multiple Envoys, but only have one at home. The others are for testing :slight_smile:

1 Like

That net-consumption in the backend will most likely be the same as Net Power at envoy.local

image

That’s what I’m hoping for. So I don’t need to worry about any calculations, just pass the value from the Envoy to the API to Home Assistant

Sorry, I am still trying to work out what you are doing and why.
Is this to try and make it work better with the energy dashboard?

1 Like

From my understanding just adding an Envoy to Home Assistant is not enough to have the Energy Dashboard show, Solar Production, Consumption, and Return to Grid values. Currently the only sensors that can be added from the Envoy to Home Assistant that will appear in the Energy Dashboard are for the Solar Production and Total Consumption. Right?

So to display Return to Grid values people have to make their own sensor/template. They really should not have to do that.

Unless I’m missing something

I agree with you on the shouldnt have to setup extra sensors part, however what I have learned is that the envoy is not collecting grid in and grid out figures separately.

From the envoy point of view, it has 1 CT clamp is on the mains measuring energy going EITHER to OR from the grid (never both) and by how much. Thats the issue here. The grid in/out figure is combined and stored in a single value as consumption. (because you will never have grid in/out occuring at the same time). The current version of the energy dashboard needs these figures separated.

The only other figure envoy is interested in is solar panel production which is stored under production.

Currently the only way to separate these grid in/out figures stored in current_consumption is to calculate them against current_production and get the difference.

In order to do that you need both:
You need to subtract current_production from current_consumption to calculate and separate grid import.
You need to subtract current_consumption from current_production to calculate and separate grid export.

I suspect providing an extra net-consumption figure will not change this but I welcome you to try.

The only solution I can see is perhaps the Home Assistant Devs improving future versions of the energy dashboard so that it can ingest solar inverter lifetime energy production and lifetime energy consumption figures and do the difference calculation for us. That will remove the need for us to create sensors manually. At the moment that is not an option.

1 Like

When you click on any of those sensors, you are supposed to see a graph.

If you dont see a graph like this, then your Home Assistant may not be configured to record properly.

I would say any figure other than 0 once the sun has gone down is not mean to happen.
If you have a constant minus figure overnight, wouldnt that cause your production totals to go down/backwards?

1 Like

For some reason, I am getting zeroes for all the grid values. And, now I am wondering whether it’s worth the effort to set this up.

I had set up a simple dashboard with Grafana with InfluxDB as the database and it was fun to play around with. This [screenshot] is the first version of the Grafana dashboard I’m working on right now…

[The 7-day numbers are off as the production started only yesterday evening.]

2 Likes