Enphase Envoy with Energy Dashboard

It could provide Power production in total or power production for each phase if you have a 3 phase system.
Hopefully it will not perform an automatic upgrade of the firmware as I don’t know how to block it. If it will then I need to find out how to translate the power production sensor data in another sensor with the same data so I can use that one for feeding the Solar part in the Energy Dashboard

Could you share you setup please. I just orderd the p1 meter. I ahve the unmetered version also and no clue where too start. Google didnt help alot either :smiley:

What do you mean ? Which part of the setup. Hardware software? P1 or enphase?

In home assistent, you go to the integrations section. Find envoy, install.

In home assistent, you go to the integrations section. Find dmsr slimme meter, install.

Done

Alrightly, I followed the instructions to get a 6 month token

login to
https://enlighten.enphaseenergy.com/

… then visit this url after pasting your serial number at the end.
https://enlighten.enphaseenergy.com/entrez-auth-token?serial_num=myserialnumber

Then you get a token that decodes to this

{ 
 "aud": "myserialnumber", 
 "iss": "Entrez", 
 "enphaseUser": "owner", 
 "exp": 1660522109, 
 "iat": 1644970109, 
 "jti": "hiding-this-just-incase",
 "username": "[email protected]"
}

iat = GMT : Wednesday, 16 February 2022 12:08:29 AM
Relative : 3 minutes ago

exp = GMT : Monday, 15 August 2022 12:08:29 AM
Relative : In 6 months

Hi there,
This is my first time editing a yaml file. I followed all your steps in the first post but keep getting a “Incorrect type. Expected “array” issue”

I’ve copied and pasted the Envoy serial number in as well.

Thanks in advance

Any ideas what I’ve done wrong?

What are you editing the file in?
Are you editing this in vscode?

If so, I saw this

I personally used the built in file editor which looks like this.

Alternatively, you could try putting extra brackets like this

{{ [0, 
(states('sensor.envoy_SERIALNUMBER_current_power_consumption') | int)
-
(states('sensor.envoy_SERIALNUMBER_current_power_production') | int)
 ] | max }}

Is there an easy way to force more regular updates to get closer to real time data? For those of us who aren’t forced onto the new software…

I’m connected via lan, and would love 5s or less updates. Currently seems like it’s 1 minute.

Yes, you can get 1 second updates if you have firmware 5.x.x and use my code

1 Like

I made a guide over 2 posts to make it more newby friendly

1 Like

im going to have to re-publish my previous comment, apparently i am a moron. i cant seem to get the python script or the paho running on my HA. any chance you could give me moron level instructions?

i have mosquito set up (and working well with the actron aircon too), also set up a user/pass for mosquito mqtt.

i think its exeuting the py in honeassistant thats the problem

The py script probably won’t work in HomeAssistant - I’ve never tried. Try running it from a linux/windows/mac system. I have a linux system that runs homeassistant via Virtualbox, so running the script from the linux machine natively is how it’s designed to be implemented. The instructions in the github repo are pretty basic to follow, as long as you’re trying to get it to work outside of HA.

1 Like

poooo… thankyou anyway!

Hey mate, you wont believe it, but i got it working within the native HASS OS. Quite a bit of faffing, but success! As of 2am, i now have live MQTT data accessible! You are AWESOME!

I can’t seem to get the combined consumption data reading though- i can get individual phases, but can’t seem to combine all three and its got me stumped- i’m sure its something really simple! Also my production registers as grid export, regardless of consumption, and my import power reads 0 all the time too, so clearly i’ve f’d something up (though i suspect this is due to something in the consumption sensor code.

Would you mind having a look and letting me know where im going wrong? I’m really new to all of this, so i apologise.

Here is my yaml for the relevant sensors… I’ve gone through this thread and tried many combinations of code with no success.

template:
  - sensor:
        name: MQTT_Import_Power			#This sensor always displays zero because something is up with combining the 3 individual phase data.
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
          {% set production = states('sensor.mqtt_production_all') | int %}
          {% set consumption = states('sensor.mqtt_consumption_all') | int %}
          {{ [0, (consumption - production) ] | max }}
  - sensor:
        name: MQTT_Export_Power			#This sensor always displays gross production, ?obviously because the consumption sensor reads 0
        state_class: measurement
        icon: mdi:transmission-tower
        unit_of_measurement: W
        device_class: power
        state: >
          {% set production = states('sensor.mqtt_production_all') | int %}
          {% set consumption = states('sensor.mqtt_consumption_all') | int %}
          {{ [0, (production - consumption) ] | max }}


sensor:
  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_production_ph_a"
    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_ph_a"
    qos: 0
    unit_of_measurement: "W"
    state_class: measurement
    device_class: power
#phases b and c are the same, just with a _b and _c suffix, and work fine

  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_production_all"
    unit_of_measurement: W
    value_template: >
            {% set value = value_json["production"]["ph-a"]["p"] | int + value_json["production"]["ph-b"]["p"] | int  + value_json["production"]["ph-c"]["p"] | int %}
            {% if value  <= 5 -%}
              0
            {% elif is_state('sun.sun','below_horizon') %}
              0
            {%- else -%}
              {{ value }}
            {%- endif %}
    state_class: measurement
    device_class: power
    
  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_consumption_all"
    unit_of_measurement: W
    value_template: >
            {% set value = value_json["total-consumption"]["ph-a"]["p"] | int + value_json["total-consumption"]["ph-b"]["p"] | int  + value_json["total-consumption"]["ph-c"]["p"] | int %}
    state_class: measurement
    device_class: power

  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_net_consumption_all"
    unit_of_measurement: W
    value_template: >
            {% set value = value_json["net-consumption"]["ph-a"]["p"] | int + value_json["net-consumption"]["ph-b"]["p"] | int  + value_json["net-consumption"]["ph-c"]["p"] | int %}
    state_class: measurement
    device_class: power    
    
  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_consumption_alt" #trying something else, still not working.
    unit_of_measurement: W
    value_template: >
        {% set value = value_json["consumption"]["ph-a"]["p"] | int + value_json["consumption"]["ph-b"]["p"] | int  + value_json["consumption"]["ph-c"]["p"] | int %}
    state_class: measurement
    device_class: power

The error log from HA:

  • Template warning: ‘int’ got invalid input ‘unknown’ when rendering template ‘{% set production = states(‘sensor.mqtt_production_all’) | int %} {% set consumption = states(‘sensor.mqtt_consumption_all’) | int %} {{ [0, (production - consumption) ] | max }}’ but no default was specified. Currently ‘int’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1

#same error for each of the combined 3 phase consumption sensors…

for what its worth (im sure you know it well already) here is a sample of my mqtt data.

{
    "production": {
        "ph-a": {
            "p": -3.899,
            "q": 284.467,
            "s": 290.606,
            "v": 249.911,
            "i": 1.163,
            "pf": -0.02,
            "f": 50
        },
        "ph-b": {
            "p": -2.13,
            "q": 296.879,
            "s": 302.33,
            "v": 249.015,
            "i": 1.216,
            "pf": 0,
            "f": 50
        },
        "ph-c": {
            "p": -3.047,
            "q": 288.3,
            "s": 288.3,
            "v": 247.712,
            "i": 1.164,
            "pf": -0.03,
            "f": 50
        }
    },
    "net-consumption": {
        "ph-a": {
            "p": 131.367,
            "q": -372.818,
            "s": 399.616,
            "v": 250.096,
            "i": 1.599,
            "pf": 0.33,
            "f": 50
        },
        "ph-b": {
            "p": 1195.474,
            "q": -938.708,
            "s": 1986.937,
            "v": 248.908,
            "i": 7.985,
            "pf": 0.6,
            "f": 50
        },
        "ph-c": {
            "p": 71.743,
            "q": -457.516,
            "s": 476.342,
            "v": 247.669,
            "i": 1.924,
            "pf": 0.15,
            "f": 50
        }
    },
    "total-consumption": {
        "ph-a": {
            "p": 127.468,
            "q": -657.285,
            "s": 690.56,
            "v": 250.003,
            "i": 2.762,
            "pf": 0.18,
            "f": 50
        },
        "ph-b": {
            "p": 1193.343,
            "q": -1235.587,
            "s": 2290.499,
            "v": 248.961,
            "i": 9.2,
            "pf": 0.52,
            "f": 50
        },
        "ph-c": {
            "p": 68.697,
            "q": -745.816,
            "s": 764.808,
            "v": 247.691,
            "i": 3.088,
            "pf": 0.09,
            "f": 50
        }
    }
}
QoS: 0 - Retain: false```

I would do this to add all 3 phases together on each mqtt sensor

sensor:
  - platform: mqtt
    state_topic: "/envoy/json"
    name: "mqtt_production"
    unit_of_measurement: W
    value_template: >
            {% set value = value_json["production"]["ph-a"]["p"] | int +
                           value_json["production"]["ph-b"]["p"] | int +
                           value_json["production"]["ph-c"]["p"] | int %}
            {% if value  <= 5 -%}
              0
            {% elif is_state('sun.sun','below_horizon') %}
              0
            {%- else -%}
              {{ value }}
            {%- endif %}
    state_class: measurement
    device_class: power

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

@JanekSMC -

This should help you - try replacing this section from within your name: “mqtt_production_all”:

   value_template: >
            {% set value = value_json["production"]["ph-a"]["p"] | int + value_json["production"]["ph-b"]["p"] | int  + value_json["production"]["ph-c"]["p"] | int %}

with this

{{  (states('sensor.fluksoconsumption_ph_a') | float(0) + states('sensor.fluksocomsumption_ph_b') | float(0) + states('sensor.fluksoconsumption_ph_c') | float(0))  }}

Also note that adding (0) will fix the error log that’s complaining that no default was specified. You add (0) to int, float and other operators to specify the default.

Hi @del13r -

Isn’t this exactly what the OP did, except yours is split over multiple lines? IDK if your suggestion would fix it? The solution I posted above uses the sensors already setup for each phase that are apparently working from the Op’s comment? Cheers

quite right, i didnt read far enough down.

@JanekSMC I’m not sure why your code isn’t working, but mine looks like that suggested by @del13r :

- platform: mqtt
  state_topic: "/envoy/json"
  name: "mqtt_production"
  value_template: >
    {% set value = value_json["production"]["ph-a"]["p"] | int + value_json["production"]["ph-b"]["p"] | int + value_json["production"]["ph-c"]["p"] | int %}
    {% if value  <= 5 -%}
      0
    {% elif is_state('sun.sun','below_horizon') %}
      0
    {%- else -%}
      {{ value }}
    {%- endif %}
  unit_of_measurement: W
  state_class: measurement
  device_class: power

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

and it works fine. So should we have int(0) everywhere now, as suggested by @vk2him?

Which Envoy device are you using specifically ? There are several . Envoy LCD, also known as Envoy R; Envoy-S, and Envoy IQ.

I have the older Envoy LCD for my solar PV system.

I set it up with a brand new install of HomeAssistant (I am completely new to HomeAssistant). The only sensors it shows are as follows :

[sensor.envoy_121023267212_last_seven_days_energy_production](http://homeassistant.local:8123/developer-tools/state#)

Envoy 121023267212 Last Seven Days Energy Production 245000 state_class: measurement unit_of_measurement: Wh device_class: energy icon: mdi:flash friendly_name: Envoy 121023267212 Last Seven Days Energy Production
[sensor.envoy_121023267212_lifetime_energy_production](http://homeassistant.local:8123/developer-tools/state#)

Envoy 121023267212 Lifetime Energy Production 152000000 state_class: total_increasing unit_of_measurement: Wh device_class: energy icon: mdi:flash friendly_name: Envoy 121023267212 Lifetime Energy Production
[sensor.envoy_121023267212_today_s_energy_production](http://homeassistant.local:8123/developer-tools/state#)

Envoy 121023267212 Today's Energy Production 27600 state_class: total_increasing unit_of_measurement: Wh device_class: energy icon: mdi:flash friendly_name: Envoy 121023267212 Today's Energy Production

My system has been running for 12 years. The only stats I can see from logging in locally to its HTTP interface are :

As you can see, the “since installation” value is in MWh, not in kWh. It can take a long time to increase to the next MWh. In the winter, it can be as long as 2 months. In the summer, about 2.5 weeks.

Either way, this single integer number in MWh is completely useless for tracking production data in HomeAssistant on a daily basis, much less hourly.

I don’t know if the Envoy has any other way of accessing the data locally. But Enphase does offer a cloud API for accessing the data. I don’t see any type of integration with Enlighten and HomeAssistant. Is there one ? I could easily have missed it.

I know depending on cloud services goes against the HomeAssistant philosophy, and I would rather not depend on it either. But it seems the data visible from the local Envoy LCD HTP UI is very limited. How much better is it on the newer Envoy devices ?

Am I pretty much SOL with this older Envoy as far HomeAssistant is concerned ?

(Note that the install date listed in the screenshot - Oct 2012 is wrong - that’s when the PV system was expanded, but the first array was installed in 2010)