Enphase Envoy with Energy Dashboard

The energy integration calculations run once an hour, in arrears. It’s designed to show you how you use (and produce) energy over a long period, and not an instantaneous reading.

The envoy system is more frequent (once every 5 minutes I believe).

Who knows whether they’ll speed it up. I’d prefer 15 minute calculations, but I don’t know what they plan.

“On this build since release” doesn’t mean enabling the energy integration and setting up the required sensors.

since 2018.8.8, and it was working within 20 minutes of upgrading :slight_smile:

once an hour on the calculation makes more sense - thanks mate

@del13r

I’ve made some modifications to my python script today to display data in real-time at least once per second without the overhead of running json-server nor any requirement to write to disk like my previous program.

The Python script now runs as a daemon and takes the output from http://envoy.local/stream/meter and extracts Power, Voltage, Frequency and Power Factor - it then publishes it as a single Topic directly to a mqtt broker on my HA and loops around indefinitely.

It’s then super simple to create sensors from the mqtt topic created.

In the coming days I plan to publish it on github so others can benefit. It can be used for the Energy Dashboard or to drive Real-time displays that update once per second such as these two cards:

3 Likes

Thats great @vk2him.
very interested

1 Like

I’d definitely be interested in this as well. The current process is pretty accurate for me (usually within .1kWh of what my power supplier reports on their billing portal) but always better to have real real time use.

It’s now up on github - let me know if you have issues?

3 Likes

Amazing!
I now have live stats updating every second.
I cannot believe what I used to rely on for ‘realtime’ solar stats before I discovered home assistant.
It was nowhere near what I have now!

Thank you very much @vk2him. I am enjoying the benefit of your hard work and cannot thank you enough.
:clap:

I did make sure to exempt the new sensors from recorder.
I might turn that on later, but just interested in live figures for now.

1 Like

No problems at all - how do you exclude the sensor from recorder?

FYI - I stumbled upon a concerning post that mentions Enphase have released a new Envoy firmware that removes the installer username/password - I wonder if it’s a response to the original people who decoded the password?

Seems Enphase or the Installation company updated the Envoy without letting the owners know and they are furious as their integrations no longer work. I just checked my Envoy and it says there is an update available - I’m not going to update but I wonder in Enphase might be able to 'force" it?

Heres the thread anyway:

https://community.enphase.com/s/question/0D53m00006ySLuR/unimpressed-with-loss-of-local-api-connectivity-to-envoys

Also - have you tried the Power Wheel card which displays power/production in real time using those mqtt sensors? Heres my card setup and what it looks like:

If you setup the mqqt sensors using the instructions in the github repo - use these sensors in the Power card (you need to load Power Wheel Card from HACS first)

Power Wheel card:

active_arrow_color: '#FF0000'
color_icons: true
consuming_color: '#FF0000'
grid_power_consumption_entity: sensor.importing
grid_power_production_entity: sensor.exporting
home_icon: mdi:home-outline
icon_height: mdi:18px
producing_colour: '#00FF00'
solar_icon: mdi:solar-power
solar_power_entity: sensor.solarpower
title_power: ' '
type: custom:power-wheel-card

configuration.yaml:

sensor:
  
  #
  # These ones are for Envoy via mqtt
  #
  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_production"
    qos: 0
    unit_of_measurement: "W"
    value_template: '{% if is_state("sun.sun", "below_horizon")%}0{%else%}{{ value_json["production"]["ph-a"]["p"]  | int }}{%endif%}'
    state_class: measurement
    device_class: power

  - platform: mqtt
    state_topic: "/envoy/json"
    value_template: '{{ value_json["total-consumption"]["ph-a"]["p"] }}'
    name: "mqtt_consumption"
    qos: 0
    unit_of_measurement: "W"
    state_class: measurement
    device_class: power

  - platform: template
    sensors:
      exporting:
        friendly_name: "Current MQTT Energy Exporting"
        value_template: "{{ [0, (states('sensor.mqtt_production') | int - states('sensor.mqtt_consumption') | int)] | max }}"
        unit_of_measurement: "W"
        icon_template: mdi:flash
      importing:
        friendly_name: "Current MQTT Energy Importing"
        value_template: "{{ [0, (states('sensor.mqtt_consumption') | int - states('sensor.mqtt_production') | int)] | max }}"
        unit_of_measurement: "W"
        icon_template: mdi:flash
      solarpower:
        friendly_name: "Solar MQTT Power"
        value_template: "{{ states('sensor.mqtt_production')}}"
        unit_of_measurement: "W"
        icon_template: mdi:flash

I excluded any sensors with mqtt_ at the start of the name from recording.

recorder:
  exclude:
    entity_globs:
      - sensor.mqtt_*

my envoy is on latest. update button is greyed out.

No adverse effects for me

1 Like

I have not tried the power wheel yet.
Hope to get around to it soon.
I quickly knocked up a card for an old smartphone on a stand to show all the time.

1 Like

Thanks - based on this I’ve now updated to 5.0.55 as well with no issues.

In recorder I purge it every 5 days so the database stays a reasonable size

recorder:
  purge_keep_days: 5
1 Like

So I followed the tutorial, thanks! Whenever I try to put in the grid consumption, it only shows the one from the Envoy, not the sensor that was put into the configuration.yaml.

This is what the sensors show up as right now image

I have been trying to get this to work for a few days. I have an Enphase Envoy X-IQ-AM1-240-3-ES with 25 Microinverters IQ7+ and all show in Home Assistant. I installed the Envoy integration. Everything is working but energy consumption. I can’t see that sensor in the energy configuration. I can see Exported Energy but I cannot see Imported Energy. Any advice would be awesome I don’ know what else to try.

Here is my configuration.yaml

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

template:
  - sensor:
      name: solar_export_value
      state_class: measurement
      icon: mdi:solar-panel
      unit_of_measurement: "W"
      device_class: power
      state: >
        {% set value = (('%0.1f' | format(states('sensor.envoy_current_power_production') | float - states('sensor.envoy_current_power_consumption') | float)) | float) %}
        {% if value  <= 0 -%} 
          0
        {%- else -%}
        {{ value | round(2) }}
        {%- endif %}

  - sensor:
      name: house_consumption_value
      state_class: measurement
      icon: mdi:transmission-tower
      unit_of_measurement: "W"
      device_class: power
      state: >
        {% set value = (('%0.1f' | format(states('sensor.envoy_current_power_consumption') | float - states('sensor.envoy_current_power_production') | float)) | float) %}
        {% if value  <= 0 -%} 
          0
        {%- else -%}
        {{ value | round(2) }}
        {%- endif %}
        
  - sensor:
        name: Grid Import Power
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
            {{ [0, states('sensor.envoy_current_power_consumption') | int - states('sensor.envoy_current_power_production') | int ] | max }}
        

sensor:
  - platform: integration
    source: sensor.house_consumption_value
    name: Imported Energy
    unit_prefix: k
    round: 2
    method: left

  - platform: integration
    source: sensor.solar_export_value
    name: Exported Energy
    unit_prefix: k
    round: 2
    method: left
    
  - platform: integration
    name: Grid Import Energy
    source: sensor.grid_import_power
    unit_prefix: k
    unit_time: h


homeassistant:
  customize: !include customize.yaml

I removed pretty much everything just to try and make sure nothing was causing an issue.

Exported Energy has the following attributes:
state_class: total_increasing
source: sensor.solar_export_value
unit_of_measurement: kWh
friendly_name: Exported Energy
icon: mdi:chart-histogram
device_class: energy

Imported Energy has the same attributes:
state_class: total_increasing
source: sensor.house_consumption_value
unit_of_measurement: kWh
friendly_name: Imported Energy
icon: mdi:chart-histogram
device_class: energy

They both have values in the State column. When I go to energy configuration all I see are the following options.

Envoy Lifetime Energy Consumption
Envoy Lifetime Energy Production
Exported Energy

Just upgraded 2021.9.4 and that also didn’t help with the issue.

Grid export energy is there, so you half got it right.
Why isnt Grid Import Energy listed?

Need to see your config to be able to help you.

Here is my config

ok, what about Dev tools.

image

image

Here’s my export
image
and import
image

Looks perfect to me.

Tried restarting HA?
Thats all I can really suggest sorry.