Enphase Envoy with Energy Dashboard

Hi everyone,

I’ve been monitoring the home assistant and enphase forums, and it would seem a lot of people got their firmware automatically upgraded recently, myself included.

I looked at the code on a few integrations and noticed they all pulled data from https://envoy.local/production.json

From my testing of this URL, it can take anywhere from 400ms to 2000ms for the envoy to generate this json file. I suspect this may be due to the envoy having to perform some calculations every time this url is requested.

This caused me to look for alternatives which led me to https://envoy.local/ivp/meters/readings which from my testing takes on average 50ms to 70ms to respond and offers roughly similar data.

This is where I noticed another thread and decided to do some of my own tweaks.

Here is what I did to get my power sensors back on track.

I removed any existing enphase related integrations (native and/or HACS)

Added my 12 month token to /config/secrets.yaml

enphase_api: "Bearer 408CHARACTERJWT"

Then, back in /config/configuration.yaml, I added these 2 x CT clamp sensors

rest:
  - headers:
      Authorization: !secret enphase_api
    verify_ssl: False
    scan_interval: 15
    resource: https://envoy.local/ivp/meters/readings    
    sensor:
      - name: "Power Production"
        value_template: >
            {% set value = value_json[0].activePower | int(0) %}
            {% if value  <= 5 -%}
                0
            {% elif is_state('sun.sun','below_horizon') %}
                0
            {%- else -%}
                {{ value }}
            {%- endif %}
        device_class: power
        unit_of_measurement: W
        state_class: measurement
        icon: mdi:solar-panel
      - name: "Power Net"
        value_template: "{{ value_json[1].activePower | int(0) }}"
        state_class: measurement
        device_class: power
        unit_of_measurement: W
        icon: mdi:transmission-tower

Then once I was happy with those 2 x CT clamp sensors updating every 15 seconds, I was able to use template sensors to do some calculations with them to get the other sensors I needed.

template:
  - sensor:
        name: Power Consumption
        state_class: measurement
        icon: mdi:home-lightning-bolt
        unit_of_measurement: W
        device_class: power
        state : >
          {{ states('sensor.power_production') | int(0) + states('sensor.power_net') | int(0) }}
          
  - sensor:
        name: Power Export
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state : >
          {{ [0, states('sensor.power_production') | int(0) - states('sensor.power_consumption') | int(0) ] | max }}
          
  - sensor:
        name: Power Import
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state : >
          {{ [0, states('sensor.power_consumption') | int(0) - states('sensor.power_production') | int(0) ] | max }}

Now I have 5 sensors.
The only information currently being extracted from the envoy is the 2 ct clamp sensors power_production and power_net.
The other 3 sensors are template sensors where home assistant performs calculations when the 2 x CT clamp sensors get updated every X seconds.

Now I am able to have a dashboard like this that updates every 15 seconds.
Feel free to try smaller number refresh intervals for yourself if you want.

image

Or graphs like this

3 Likes