Enphase Envoy with Energy Dashboard

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.

All good, thanks for your help!

Maybe I’ll try to collect some more data and try again, or make another HA VM and redo it

Yeah, My HA did some weird stuff with calculating price since upgrade.

I can try to rollback to the previous version that I had

This looks good.

This also looks good.

I have no idea.

Probably the reason why you can’t read power/energy consumption from your system, it’s because net metering is not enabled when your system was installed. I’m on the same boat too, when mine was installed they didn’t enable that feature for me. A couple weeks ago i called them up and asked about that feature; the asked me $500.00 to make it happen. Now if you know or have the installer username/password, you can enable it by yourself. Me, i don’t know or have the installer username/password for mine.