Enphase Envoy with Energy Dashboard

Hi @Steve61

Sorry, I have tried to write this response 3 times now. Each time I realised that my examples I was showing were from before I had finished setting up cost caculations properly which meant the calculations did not add up.

Ok, lets establish that

  • my provider charges a daily service charge (feature does not currently exist in energy dashboard)
  • my provider applies a 25% discount on usage and supply charges (I have made it so that the usage charges in energy dashboard already include the 25% discount on usage only.)

Here is my energy dashboard for Monday August 16

Here is what my energy provider saw that day
Screen Shot 2021-08-19 at 11.55.37 pm

The export credit matches, but the import charge doesnt.
I do not trust this cost that my provider shows.
Especially when they say things like this.
Screen Shot 2021-08-19 at 11.59.14 pm

Instead I use my own sensor to calculate my costs more accurately.
Every day starts at $0.78 which is what my daily service charge is after 25% discount.

at the end of the day after calulating power exported and imported, the figure was $1.87

We can also arrive at that figure doing the following calculations on the provider estimate.
$3.70 (according to provider) * 0.75 (25% discount) = $2.78
Energy Dashboard says $2.46 which is a difference of $0.32. This is because of the slight difference in kWh recorded which was 11.03kWh for energy dashboard and 12.12 kWh for provider.

This discrepancy could be due to me not using method: left for the integration sensors at the time as well as the many reboots of home assistant I have been doing recently which would cause home assistant to miss some consumption data. I am hoping that method: left fixes this discrepancy and ill stop rebooting home assistant so often now that im happy with how it is.

When you look at the energy dashboard and see $1.06 grid total. If I add my daily service charge including of 25% discount which is $0.78, I get $1.84.
The total cost for the day which my sensor calculated should be was $1.87.

2 Likes

Nice analysis! Has anyone seen whether the developers plan on adding a daily service charge cost element to HA? This would go pretty close to perfecting the Energy dashboard for me!

I would assume its deliberately not there as it might confuse people.
Don’t get me wrong, i would also love this feature, but just trying to justify why it is not there.

Given most people are charged different tariff for peak/off-peak, you would need to use utility meter anyway to calculate tariffs.

That being said, Energy dashboard is able to be used without utility meter to just show kWh figures.

This might explain why it is absent, because costs are optional.

In post number 4. I have updated it recently to show how I was able to do this outside of energy dashboard. See Enphase Envoy with Energy Dashboard - #4 by del13r

Here is my dashboard at the moment

Many Thanks for sharing this information as it helped me a lot. There is a lot of confusion about this subject and documentation is scarce.

I have an Envoy but it’s the older style that does not have metering. It was installed in 2015 with the system.
To get Consumption I use Efergy sensors that report to energyhive.com in the UK. I have been using this since about 2015 as well.

My Envoy integration in HA does give me

  • sensor.envoy_current_energy_production
# Envoy Current Power Production to Energy kWh
  - platform: integration
    source: sensor.envoy_current_energy_production
    name: Grid_Export_Energy
    unit_prefix: k
    unit: kWh
    round: 2
  • sensor.envoy_lifetime_energy_production
    I seem to be able to use this entity directly without the Rienmann integration

which I have been able to use in the Energy Configuration.

My Consumption I get from Efergy integration and use the Reinmann Integration to convert the watts to kWh

# Efergy 3240 Power Meter to kWh (this is the Switchboard CT and measures NET grid usage)
  - platform: integration
    source: sensor.efergy_3420
    name: SWB_Used_Energy
    unit_prefix: k
    unit: kWh
    round: 2
# 
# Efergy 598 Power Meter to kWh (This is a CT on a power point for IT equipment)
  - platform: integration
    source: sensor.efergy_598
    name: ITEquipment_Used_Energy
    unit_prefix: k
    unit: kWh
    round: 2

I only fount this post this morning and was ignorant of how to use returned to grid in config. This post gave me the clue.
I hope I have now got it configured correctly. I will compare the results with actual Ergon Meter readings. I have a Raspberry Pi in my Switchboard that takes photos of the meter at 00:00, 08:00, 13:00 & 17:00.
That’s how I can see if numbers are realistic. I can tolerate some discrepancy but want it to be close as possible.
This is what it looks like at the moment

Thanks for that - and yes it does look close enough. I don’t have a smart meter so I can’t check daily charges.

You are right about power suppliers making it hard. I put my bill on a spread-sheet and with discounts here and GST on this but not that, rounding etc…. it ran 10-15 lines. I don’t have off-peak, so mine is very simple, and I could not get to their exact figure. If I was a cynical person I would say they are trying to confuse people.

1 Like

You need to add

method: left

to your integration sensors to get more accurate calculations. The default method isn’t accurate when it comes to the type of usage we’re tracking here.

1 Like

Cheers, I have updated my post to include it.

1 Like

Thank you for the tip. I have updated my config to include
method: left
Cheers

That’s intense. I like it

The above is the output from my Energy Panel (HA) (1), PVOutput (2) and Manual meter reading from my Energy Supply meter ERGON for 21 August 2021.
I am considering the manual meter reading as my reference point as this is what I am charged for by ERGON.
I derive this data from a Raspberry Pi that takes photos of the meter under a cron.

The object of this is to validate the accuracy of the new energy panel in HA.

From this I can see that

  • The solar Generation (from ENVOY integration) is consistent with the Manual Meter readings

  • The Consumption (from Efergy Integration) is consistent with the Manual Meter readings

The component I have named Grid_Export_Energy is a Riemann sum of the power generated by my solar system taken from my ENVOY.
This was the only component that I seemed to be supplying to PVOutput that I was not previously supplying to HA so I used it and was able to then generate the HA energy panel with what seemed to be all of the blue, orange components in the bar graphs.

However when I look at the SOURCES
The sources are a little difficult to rationalise.

From meter readings I can see that Tariff 03 (consumption) I used 10kWh between midnight on 21 → 22/8/2021 and Tariff 07 (Export) I exported 4kWh
This approximately equates to the Grid total in the HA panel
I am assuming from this that it net figure of my total energy but as there is no explanation of how this system actually works I am unsure what I am looking at.

The PVOutput (2) uses the same data and is much clearer in what is happening with my energy in consumption, generation imports and exports.
These entities are important because I am charged $0.27 for imports and paid $0.065 for exports.
The incentive there is to not over produce solar and export to the grid (or put in batteries to store it, expensive at the moment in Oz).

Question I as are:

  1. Is there a better way I can configure my HA energy panel
  2. if not, how is it that PVOutput.org can use exactly the same data and provide export and import results that are verified by meter readings
  3. Why are there some orange , blue and purple in some bars of the energy usage and not others?? To my thinking there should be others given the solar bars below. I don’t understand this.

I think that this new HA energy is awesome and having energy integrated into HA where I want to go as it’s one system but it must be concise and easy to understand.

Your energy dashboard doesn’t look right. Here is mine

Yes your is very different but why?
Just a note it’s been cloudy and rainy here so solar production is much lower than yours at the moment anyway.

This my configuration


Consumption is SWB_Used_Energy
Power from Envoy as kWh is Grid_Export_Energy

# Efergy 3240 Power Meter to kWh
  - platform: integration
    source: sensor.efergy_3420
    name: SWB_Used_Energy
    unit_prefix: k
    unit: kWh
    round: 2
    method: left
# Envoy Current Power Production to Energy kWh
  - platform: integration
    source: sensor.envoy_current_energy_production
    name: Grid_Export_Energy
    unit_prefix: k
    unit: kWh
    round: 2
    method: left

Solar is from Envoy

What’s your look like?

This could be your issue.

This source does not represent grid export energy.

sensor.envoy_current_energy_production only shows what your solar panels are generating, which your house will consume first before exporting. For example, if my house is consuming 300w and my solar panels are producing 500w, then the actual export is only 200w. That is why this sensor source is unsuitable. You need to tell home assistant to calculate the difference in order to get the true grid export number.

Please look at the formula I used for my sensor I had to create in order to be able to calculate and see grid export. The formula basically tells home assistant to pick the bigger number between 0 and the result of the difference calculation. If the difference is below 0, then nothing gets recorded. You can’t get energy dashboard to work by skipping this step.

Ron - Your dashboard is wrong because you have setup your return to grid sensor incorrectly to show energy exported - yours currently shows energy consumed only. The export sensor needs to needs to be a calculation that subtracts energy produced from energy consumed.

So say your production sensor is called sensor.production, consumption is sensor.consumption then you need the following in your configuration.yaml (Note you should replace your correct sensors in my example as my sensors get their data from a different source from yours, however the overall logic remains the same.)


  
  - platform: template
    sensors:
      exporting:
        friendly_name: "Current Energy Exporting"
        value_template: "{{ [0, (states('sensor.production') | int - states('sensor.consumption') | int)] | max }}"
        unit_of_measurement: 'W'

      importing:
        friendly_name: "Current Energy Importing"
        value_template: "{{ [0, (states('sensor.consumption') | int - states('sensor.production') | int)] | max }}"
        unit_of_measurement: 'W'
 
      solarpower:
        friendly_name: "Solar Power"
        value_template: "{{ states('sensor.production')}}"
        unit_of_measurement: 'W'
   

sensor 10:
  - platform: integration
    source: sensor.solarpower
    name: energy_solar
    method: left
    unit: kWh
    unit_prefix: k
    unit_time: h
    round: 2

sensor 11:
  - platform: integration
    source: sensor.exporting
    name: energy_exporting
    method: left
    unit: kWh
    unit_prefix: k
    unit_time: h
    round: 2

sensor 12:
  - platform: integration
    source: sensor.importing
    name: energy_importing
    method: left
    unit: kWh
    unit_prefix: k
    unit_time: h
    round: 2

You then setup your Power Configuration like this:

Which gives a correct Dashboard like this - note the Purple below the line shows power you’re selling back to the grid and the orange above the line shows the solar power your house has self-consumed so is free power. The blue above the line shows power you’ve imported and that you’re paying for. Your gauge also shows you’re not self consuming any of your power, so again this will be fixed when you fix your export sensor.

Hope that helps - yell out for more help if needed.

4 Likes

Hi @vk2him
My Thanks for taking the time to do a great explanation.
That makes a lot of sense to me and I think I understand it.
I have made the changes and added them to my configuration.yaml, restarted HA and edited the energy dashboard config.
I was a bit tricked as the new sensors did not come up in the energy dashboard config but then when I looked in the developer tools they did not have a device class so I customised the sensors to include the device class of “energy”.
After I did that I was able to add them to my dashboard.

I now just have to wait a couple of hours for the data to populate.

I will let you know how it went.

1 Like

Hi @vk2him
First data through. Today is a very poor solar day cloud, rain drizzle… so not much to show but I think I have it right

I configured these gauges to show what was happening in POWER and ENERGY terms

image

This is the energy dashboard now

What do you think?

Again many thanks!

Hi Ron,
Yes to me this looks correct - like you say you have a cloudy day and you have used 100% of the solar generated for your house and have imported some too. You should see a purple block when you generate more than you use, and when this happens the gauge that currently says 100% Self Consumption will reduce. Well done!

Del13, you have been a huge help in getting this to work for me. I have almost committed this thread to memory, I’ve read it that many times. On the main energy page, I have all the information populated, but somehow have gotten lost with the today and yesterday total cost sensors. I quoted the above image, because this is where I have the greatest discrepancy. My tariff sensors do not populate any values of kWh usage. When I check the attributes on one of them, all I see is “collecting” for the active one, and “paused” for the other tariffs that are not current.

When I view the current buyback tariff under the developer tools, here is what I get:

last_reset: '2021-08-22T06:02:00.598770+00:00'
source: sensor.grid_export_energy
status: collecting
last_period: '0'
meter_period: daily
tariff: buyback Sep
friendly_name: daily_energy_export buyback Sep
icon: mdi:counter

Am I missing something?

1 Like

Hi @jpfamilylc

The best approach is to work backwards to the source.
In this case, the data originates 4 steps back.
We can trace the path backwards by looking at the source: of each sensor.

Here is the utility meter which resets at midnight every day on my local time due to the line: meter_period: daily

entity: sensor.daily_energy_export_buyback
state: 0.004

State attributes (YAML, optional)
state_class: measurement
last_reset: '2021-08-22T14:00:00.001731+00:00'
source: sensor.grid_export_energy
status: collecting
last_period: '19.650'
meter_period: daily
tariff: buyback
unit_of_measurement: kWh
friendly_name: daily_energy_export buyback
icon: mdi:counter
device_class: energy

Then I have a look at the ‘source: sensor.grid_export_energy’ of that information.
Unlike the sensor above, the sensor below never gets reset. It just keeps accumulating or counting like an odometer.
Utilty meter just counts how much energy got exported between midnight yesterday and midnight today using the sensor below as the source.

entity: sensor.grid_export_energy
state: 201.474

State attributes (YAML, optional)
state_class: measurement
last_reset: '2021-08-08T07:32:53.851525+00:00'
source: sensor.grid_export_power
unit_of_measurement: kWh
friendly_name: Grid Export Energy
icon: mdi:chart-histogram
device_class: energy

Then I check the ‘source: sensor.grid_export_power’ of that information
This sensor is how much power I am exporting live right now as I write it.
This power sensor below gets continuously measured by energy sensor above and plotted as energy over time.

entity: sensor.grid_export_power
state: 874

State attributes (YAML, optional)
state_class: measurement
unit_of_measurement: W
friendly_name: Grid Export Power
icon: mdi:transmission-tower
device_class: power

Then I check the source of that information which wont be in developer tools, but will be found in the configuration.yaml. This is how we get the grid power result in the first place as the Envoy does not natively have a sensor for that, we have to use home assistant to calculate it using the formula in the template sensor below.

template:
  - sensor:
        name: Grid Export Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_SERIALNUMBER_current_power_production') | int - states('sensor.envoy_SERIALNUMBER_current_power_consumption') | int ] | max }}

What is happening here is the data is getting processed 3-4 times before making it to the utilty meter.

You need to check each source, starting with the ‘name: Grid Export Power’ sensor in configuration.yaml and then working your way back to utility meter.

When dealing with export, if you are setting up at night, you wont see results until the next day as the sun isnt shining at night.

You can force the sensors to be a certain format using customize.yaml but this is optional and not necesesary.

Its also good to check graphs to make sure your recorder is working as that is another thing that would prevent this from working. I have found some people have made changes to Recorder - Home Assistant and then forgotten they turned it off.

image

image

image

THANK YOU! your attributes helped me locate the first issue. I had seen the discussions of RECORDER being modified, but I have a pretty recent and clean install, with minimal configs. It turns out that the sensor was missing 2 attributes that required adding them in through the customization menu. That turned into having to modify my configuration.yaml to !include customize.yaml.

I needed to add the device class: energy, and the unit of measurement: kWh. I had to do this for every sensor that was created for each tariff.

I started out at the beginning of the post and got to where you created the custom sensors to aggregate the costs… then stopped, realizing that I had pretty much followed exactly, with only slight name changes. I happened to have the developer state for the device open when I saw your config.yaml of that same sensor.

So, I thought I was done, and waited a couple of hours to see any new data. I didn’t. Then I took your advice and worked backward. The end sensor that wasn’t working had the source in the attributes. I worked back until I found my mistake. In the setup of the meter, you used 2 specific names for the 2 non-template sensors (for the platform integration). I chose to use my own specific names that were regionally appropriate. Once I corrected the source of the downstream sensor, my measurements came in.

Once again, thank you for your help!

1 Like