Enphase Envoy with Energy Dashboard

Makes sense. here is what I see

I would like to mimic what you have as its served me well. Therefore would be greatfull if you can post your config and settings again if ok. Even have the apexchart thing which is awesome.

Yep, these instructions are still what I am using.

These same rest sensor instructions also work with my apexchart instructions

example right now in home assistant

matching data in envoy (slight variation due to the lag it takes for envoy update the page at https://envoy.local/home)
image

In the meantime, I have been working on extracting/calculating the lifetime energy odometers from https://envoy.local/ivp/meters/readings using the same rest sensor as well.

Here is a preview of what I have been working on.
Obviously the envoy rounds up to the nearest .X decimal when viewing via https://envoy.local/home

I will do a complete solution write up for both power sensors (kW) and energy sensors (kWh) soon once I have time. I might even make a whole new topic just to save confusion as reading through 2 years worth of 674 posts is a big ask for anyone.

Here is my excel sheet I used to figure out what I can get from envoy using a rest call to https://envoy.local/ivp/meters/readings and what I have to calculate using template sensors to replicate the figures seen in https://envoy.local/home

Live Power figures:

Source: /ivp/meters/readings Power - Planned sensor naming in Home Assistant W kW
value_json[0].activePower Power Production 5317.82 5.32
value_json[1].activePower Power Net -3281.97 -3.28
template sensor calculation Power Consumption (Calculated) (production+net) 2035.85 2.04
template sensor calculation Power Export (Calculated) (production-consumption) 3281.97 3.28
template sensor calculation Power Import (Calculated) (consumption-production) 0.00 0.00

Lifetime Energy figures:

Source: /ivp/meters/readings Energy - Planned sensor naming in Home Assistant Wh MWh
value_json[0].actEnergyDlvd Energy Production 25144588.32 25.14
value_json[1].actEnergyDlvd Energy Import 11702118.55 11.70
value_json[1].actEnergyRcvd Energy Export 10227297.59 10.23
template sensor calculation Energy Net (Calculated) (import-export) 1474820.95 1.47
template sensor calculation Energy Consumption (Calculated) (production+net) 26619409.28 26.62

I am able to get all this information from 1 single rest call/query every X seconds.
You can choose your own update interval in X seconds to suit your database sizing as updating these sensors more often will increase the database storage space needed to hold the history for graphing if you dont exclude these from the recorder.

My hope in using the lifetime energy odometers is that the energy figures will be more accurate if home assistant goes down for a restart or any similar event that would cause the integration sensors that I previously had in my solution to miss any gaps in recording.
Using the lifetime CT Clamp energy odometers instead will remove the need for the integration sensor and increase accuracy specifically in the energy dashboard.

2 Likes

Thanks @del13r . Your solution with REST works a lot better for me that the built-in integration or HACS integration. Better in that it seems to be more reliable — no more drop-outs at unknown times. Also, as you say, it is more responsive to immediate power changes. I used HA’s Riemann Sum Integral to get the energy, and that is also a lot more reliable compared to the HACS integration. HACS integration was giving me occasionally huge spikes, 10,000’s of kWH for day energy use, and unreliable numbers in the case of power outages.

1 Like

Thanks @khaimong

I’ve got a new and improved solution that doesn’t use Riemann Sum Integral sensors for energy anymore.
Just currently testing that it works perfectly and documenting how I did it in a new topic.
Watch this space.

Alrighty guys,

Here is the fully manual solution I came up with using just the rest sensor for Enphase Envoy on D7 firmware.
It’s a lengthy guide with lots of explanation.
Hopefully it helps someone else out.

2 Likes

@Marty

I saw your post, and read you had managed to get some data from Wattson with an Optismart Gateway into HA ?

How did you manage this ?

If you have an installer account and use the HACS integration for installers you can create a nice live visual for each panel.


type: vertical-stack
cards:
  - type: custom:bar-card
    entities:
      - entity: sensor.envoy_122121028005_current_power_production
    title: Zonnepanelen
    max: '4200'
    decimal: '0'
    unit_of_measurement: W
    positions:
      name: 'off'
      indicator: inside
      icon: 'off'
    animation:
      speed: '5'
    style: |
      bar-card-currentbar, bar-card-backgroundbar { border-radius:10px; }
  - type: custom:bar-card
    entities:
      - entity: sensor.inverter_122125036304_production
      - entity: sensor.inverter_122125055320_production
      - entity: sensor.inverter_122125056463_production
      - entity: sensor.inverter_122125050047_production
      - entity: sensor.inverter_122125050256_production
      - entity: sensor.inverter_122125055948_production
      - entity: sensor.inverter_122125055365_production
      - entity: sensor.inverter_122125055364_production
      - entity: sensor.inverter_122125055383_production
      - entity: sensor.inverter_122125052776_production
      - entity: sensor.inverter_122125049990_production
      - entity: sensor.inverter_122125053078_production
      - entity: sensor.inverter_122125049589_production
      - entity: sensor.inverter_122125055469_production
    positions:
      name: 'off'
      indicator: inside
    columns: 5
    direction: up
    max: '300'
    min: '0'
    animation:
      speed: '5'
    decimal: '0'
    icon: 'off'
    height: 100
    width: 45px
    style: |
      bar-card-currentbar, bar-card-backgroundbar { border-radius:10px; }

4 Likes

Fantastic, thank you for sharing!

Nice, but why does it require an installer account ? The regular Envoy integration (Briancmpbell version at least) exposes sensor.envoy_xxx_inverter_yyy already, and there is a sensor for power production sensor too. So, no installer account needed.

Ah I did not know that. Thanks for the addition.

Thanks to @Maart84 for this code - awesome stuff and appreciate you sharing.

With the newest firmware and official integration for Enphase Envoy, this code will work for the dashboard without an installer account. I’ve also split mine into East and West Panel sections - you can obtain this info from Enlighten/System/Devices if your installer labelled them in different arrays.

  • Make sure you insert your specific sensors.
  • Adjust your system max production (mine below is max: ‘10.4’) and I have my UoM as kW
  • Adjust your individual panel max output (mine below is max: ‘400’)
  • I’ve set columns to 7 & removed the fixed width to allow it to resize correctly on mobile
type: vertical-stack
cards:
  - type: custom:bar-card
    entities:
      - entity: sensor.envoy_12212204xxxx_current_power_production
    title: Enphase Panels
    max: '10.4'
    decimal: '2'
    unit_of_measurement: kW
    positions:
      name: 'off'
      indicator: inside
      icon: 'off'
    animation:
      speed: '5'
    style: |
      bar-card-currentbar, bar-card-backgroundbar { border-radius:5px; }
  - type: custom:bar-card
    title: East Panels
    entities:
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
      - entity: sensor.inverter_12213302xxxx
    positions:
      name: 'off'
      indicator: inside
    columns: 5
    direction: up
    max: '400'
    min: '0'
    animation:
      speed: '5'
    decimal: '0'
    icon: 'off'
    height: 100
#    width: 45px
    style: |
      bar-card-currentbar, bar-card-backgroundbar { border-radius:5px; }
  - type: custom:bar-card
    title: West Panels
    entities:
      - entity: sensor.inverter_12212304xxxx
      - entity: sensor.inverter_12212305xxxx
      - entity: sensor.inverter_12212305xxxx
      - entity: sensor.inverter_12212305xxxx
      - entity: sensor.inverter_12212306xxxx
      - entity: sensor.inverter_12212306xxxx
      - entity: sensor.inverter_12212306xxxx
      - entity: sensor.inverter_12212306xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
      - entity: sensor.inverter_12213301xxxx
    positions:
      name: 'off'
      indicator: inside
    columns: 5
    direction: up
    max: '400'
    min: '0'
    animation:
      speed: '5'
    decimal: '0'
    icon: 'off'
    height: 100
#    width: 45px
    style: |
      bar-card-currentbar, bar-card-backgroundbar { border-radius:5px; }
3 Likes

I’m having issues with this integration lately. The energy dashboard isn’t showing values correctly.

A second issue is that I tried to add the “corrected solar production” sensor, but I cannot add it to the “solar production” sensor in the dashboard. The “corrected solar production” sensor is appearing in the entities list, but is not seen by the dashboard.

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

- sensor:
  - name: Solar Power Corrected
    state_class: measurement
    icon: mdi:solar-panel
    unit_of_measurement: W
    device_class: power
    state: >
      {% set value = states('sensor.envoy_REDACTED1234_current_power_production') | int %}
      {% if value  <= 4 -%} 
        0
      {%- else -%}
        {{ value }}
      {%- endif %}

sensor:
  - platform: integration
    name: Grid Import Energy
    source: sensor.grid_import_power
    unique_id: grid_import_power
    unit_prefix: k
    unit_time: h
    method: left

  - platform: integration
    name: Grid Export Energy
    source: sensor.grid_export_power
    unique_id: grid_export_power
    unit_prefix: k
    unit_time: h
    method: left

  - platform: integration
    name: Solar Energy Corrected
    source: sensor.solar_power_corrected
    unique_id: solar_power_corrected
    unit_prefix: k
    unit_time: h
    method: left

As soon as my panels start producing, the consumption seems to track the production. Prior to the panels producing power, the consumption is accurate. So it seems there may be an issue with the calculations?

I also do not understand why the corrected solar production value isn’t able to be seen as an entity to enter into the energy dashboard.

Any help would be appreciated with understanding these two issues.

Just in case - when I moved from this integration GitHub - posixx/home_assistant_custom_envoy to HA’s official one, I had to modify the units for a couple of the Envoy entities to fix inaccurate calculations. I think it was megawatts instead of kilowatts or smth like that, which was causing weirdness in the Energy dashboard. A simple switch of the units in the UI helped.

1 Like

Do you happen to remember which entities? I’ve been struggling with this since I updated to the official HA integration for envoy. My solar production seems accurate, but my import and export energy is very wrong.

Could be the same issue, yep.
Check the measurements (in the UI) for sensors that are used by “Grid Import/Export Power” templates, for me those are:
sensor.envoy_xxxxx_current_power_consumption
sensor.envoy_xxxxx_current_power_production

both should be in watts, e.g.:

Also, sensor.envoy_xxxxx_lifetime_energy_production should be in MWh

Hello everyone
I have recently integrated my installation and I would like to know the value that I reinject into the network
but there is no attribute or sensor for that in enphase integration
I saw grid exports on this topic but I can’t find how to create this sensor without using configuration.yaml
I tell myself that I must be able to calculate it but I can’t do it
I went through all the forums and got help from chat-gpt but it was impossible
a kind soul to help me do this through a model?

I don’t know what this means.
Template sensors only exist within Home Assistant.

It sort of feels like the whole post has been written by chat-gpt to be honest. Your questions and phrasing do not make sense.

I don’t understand this statement either. Are you asking for help to do this via a large language model?

You could try adding a template helper via the GUI at http://homeassistant.local:8123/config/helpers

I just tried and got a result in the preview so it is possible to do via GUI.