Could be something silly like crosstalk with other AC power cables.
My Microinverters are IQ7A-72-2-INT and My Envoy is ENV-S-WM-230.
Here is what my http://envoy.local/home looks like
Please forgive my newby ignorance - I don’t have a sensor called sensor.envoy_SERIALNUMBER_current_energy_prodcution
- I have one called sensor.envoy_current_energy_prodcution
Should I use that instead or am I doing this wrong?
FYI - I also have a Pulse counting device called a Flukso and have managed to get it working using that, however I’d like to also use the Enphase Envoy directly in case the Flukso dies.
You may either have an older or newer Enphase integration than what I have.
To see what envoy sensors are in your system, go into Developer Tools.
and type in sensor.envoy and see what the list shows.
Mine will look different because I have added some lines to customize.yaml to make them easier to read.
sensor.envoy_SERIALNUMBER_current_energy_consumption:
friendly_name: Consumption Now
sensor.envoy_SERIALNUMBER_current_energy_production:
friendly_name: Production Now
After removing the integration and re-adding it, i noticed it has now correctly renamed these 2 sensors as power (instead of energy) which is what these should have been named as in the first place.
sensor.envoy_SERIALNUMBER_current_power_consumption:
sensor.envoy_SERIALNUMBER_current_power_production:
… So my now updated code should be: (pretty much did a find/replace on current_energy and replaced with current_power)
template:
- sensor:
name: Grid Import Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{{ [0, states('sensor.envoy_SERIALNUMBER_current_power_consumption') | int - states('sensor.envoy_SERIALNUMBER_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_SERIALNUMBER_current_power_production') | int - states('sensor.envoy_SERIALNUMBER_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_SERIALNUMBER_current_power_production') | int %}
{% if value <= 4 -%}
0
{%- else -%}
{{ value }}
{%- endif %}
Dont stress if you dont see a serial number. It might just be a subtle difference between our systems.
Yes my system must be different to yours - I only have a single Consumption and Production Sensor - the only thing with serial numbers are the 18 inverters. Mine also shows negative numbers being produced at night hence why I use the sun.sun if statement to zero out at night.
Do you have access to the installer menu which allows you access to many hidden menus etc?
Username is installer and you’ll need to run a Python script program once with your Envoy serial number to get the password. Heres a link to the script GitHub - sarnau/EnphaseEnergy: Various collected information about Enphase Energy solar system
Ah, I do not have the installer password.
As per this link Enphase Envoy - Home Assistant … it appears I didnt need it.
All I did to set this up was
Once that was done, I ended up with this
I have 22 microinverters and 4 values for production and 4 for consumption.
Here is what 1 lot of 4 values are.
I knew it existed but have been resisting the urge to log in and look around in there, my installer is a great guy and I have my reasons for not wanting to poke around in there if I don’t need to.
You can see per panel generation, plus real-time generation/consumption.
I haven’t (yet) worked out how to use this real-time info via the installer menus, however I use pulse counters using a device called a Flukso and display real-time usage/generation via mqtt and a few Homeassistant cards:
I am currently using real-time figures based on the sensors I mentioned
They will with either be called
(new version integration)
sensor.envoy_SERIALNUMBER_current_power_consumption:
sensor.envoy_SERIALNUMBER_current_power_production:
OR
(old version integration)
sensor.envoy_SERIALNUMBER_current_energy_consumption:
sensor.envoy_SERIALNUMBER_current_energy_production:
I noticed they updated this file in late July which is when the names changed
https://github.com/home-assistant/core/pull/53653/commits/2e7602a66eb3929ebc44aad157899ffc0d3be4b4
How frequently do the real-time values change for you? If I use sensor.envoy_current_energy_consumption: mine update about once a minute.
My pulse counters update 1,000 times a minute.
Thanks for the link - I’ll reload Ephase integration in the morning and will try again
The Enphase Envoy updates every 60 seconds.
I also have a pulse counter called PowerPal but once solar starts producing, then I dont see anything in the day so I prefer to get data every 60 seconds 24 hours a day from Enphase Envoy.
Ok great thanks - mine updates every second, so I can see real-time changes. I’ve trained my family to make decisions on when to turn on kettle/oven/dishwasher/dryer etc using the real-time graphs in Home Assistant. They are Green when I’m producing more than consuming to make it kid-proof.
Ive combined our code to get the best ot both worlds.
- 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_SERIALNUMBER_current_power_production') | int %}
{% if value <= 5 %}
0
{% elif is_state("sun.sun","below_horizon") %}
0
{%- else -%}
{{ value }}
{%- endif %}
Hoping someone can help, I have created new sensors for energy but they aren’t showing up as selectable options in the dashboard. Any ideas why this might be the case?
I would say the only difference between my energy sensors and yours is that mine have
device_class: energy
whereas yours dont seem to have that attribute yet.
Here are my sensors provided by the Enphase Integration
Here are the POWER sensors I created manually that use the information from the envoy sensors above.
Here are the ENERGY sensors I created manually using the Integration - Riemann sum integral - Home Assistant platform that use the information from the power sensors above
Thanks for the offer to help! I am wondering if it is due to the way I have set up my template entities?
Below are my entities:
And below is my code for all my templates, I have them different to yours though, and it won’t allow me to select device class etc…
- platform: template
sensors:
envoy_house_consumption:
friendly_name: "Current House Consumption"
value_template: "{{ [0, (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_exporting') | int)] | max }}"
unit_of_measurement: 'W'
icon_template: 'mdi:flash'
envoy_current_exporting:
friendly_name: "Current Energy Exporting"
value_template: "{{ [0, (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int)] | max }}"
unit_of_measurement: 'W'
icon_template: 'mdi:flash'
envoy_current_importing:
friendly_name: "Current Energy Importing"
value_template: "{{ [0, (states('sensor.envoy_current_energy_consumption') | int - states('sensor.envoy_current_energy_production') | int)] | max }}"
unit_of_measurement: 'W'
icon_template: 'mdi:flash'
envoy_today_s_energy_exporting:
friendly_name: "Today Energy Exporting"
value_template: "{{ [0, (states('sensor.envoy_today_s_energy_production') | int - states('sensor.envoy_today_s_energy_consumption') | int)] | max }}"
unit_of_measurement: 'Wh'
icon_template: 'mdi:flash'
envoy_today_s_energy_importing:
friendly_name: "Today Energy Importing"
value_template: "{{ [0, (states('sensor.envoy_today_s_energy_consumption') | int - states('sensor.envoy_today_s_energy_production') | int)] | max }}"
unit_of_measurement: 'Wh'
icon_template: 'mdi:flash'
envoy_today_s_energy_utilised:
friendly_name: "Today Energy Utilised"
value_template: "{{ [0, (states('sensor.envoy_today_s_energy_production') | int - states('sensor.envoy_today_s_energy_exporting') | int)] | max }}"
unit_of_measurement: 'Wh'
icon_template: 'mdi:flash'
envoy_today_s_consumption_negative:
value_template: '{{ ((states.sensor.envoy_today_s_energy_consumption.state | float * -1)) | round(1) }}'
friendly_name: 'Today Energy Consumption'
unit_of_measurement: 'Wh'
power_kw:
friendly_name: "Power Available"
unit_of_measurement: 'kW'
value_template: >
{% if states('sensor.envoy_current_exporting')|float > states('sensor.envoy_current_importing')|float %}
{{ (states('sensor.envoy_current_exporting') | int / 1000) | round(2)}}
{% else %}
{{ (states('sensor.envoy_current_importing') | int / -1000) | round(2)}}
{% endif %}
solar_power_corrected:
friendly_name: "Solar Power Corrected"
unit_of_measurement: W
value_template: >
{% set value = states('sensor.envoy_current_energy_production') | int %}
{% if value <= 4 and is_state("sun.sun", "below_horizon") -%}
0
{%- else -%}
{{ value }}
{%- endif %}
- platform: integration
name: Grid Import Energy
source: sensor.envoy_current_importing
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Grid Export Energy
source: sensor.envoy_current_exporting
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Solar Energy Corrected
source: sensor.solar_power_corrected
unit_prefix: k
unit_time: h
method: left
Ok, these 2 are the standard Enphase supplied sensors which have the same attributes as mine except mine include the serial number and yours are named ENERGY whereas mine are named POWER. No big deal.
Next I check your import/export POWER sensors.
- platform: template
sensors:
envoy_current_exporting:
friendly_name: "Current Energy Exporting"
value_template: "{{ [0, (states('sensor.envoy_current_energy_production') | int - states('sensor.envoy_current_energy_consumption') | int)] | max }}"
unit_of_measurement: 'W'
icon_template: 'mdi:flash'
envoy_current_importing:
friendly_name: "Current Energy Importing"
value_template: "{{ [0, (states('sensor.envoy_current_energy_consumption') | int - states('sensor.envoy_current_energy_production') | int)] | max }}"
unit_of_measurement: 'W'
icon_template: 'mdi:flash'
The differences here are that you havent included
state_class: measurement
device_class: power
for both of these POWER sensors. You will probably need to add both lines to each of the 2 POWER sensors above.
Next I check your ENERGY sensors
- platform: integration
name: Grid Import Energy
source: sensor.envoy_current_importing
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Grid Export Energy
source: sensor.envoy_current_exporting
unit_prefix: k
unit_time: h
method: left
these look fine
Thanks for this! I have recreated duplicate sensors using your template method, which seems to have fixed the issue I can now select my created sensors, so looks like they definitely needed to have a device_class and state_class set for the Energy Dashboard to find them.
Thanks again, legend!
No worries.
Its good practice to always use the correct device class when manually creating a sensor in configuration.yaml
Here is a list of device classes from Sensor Entity | Home Assistant Developer Docs
Type | Unit | Description |
---|---|---|
battery | % | % of battery that is left. |
carbon_dioxide | ppm | parts per million of carbon dioxide concentration |
carbon_monoxide | ppm | parts per million of carbon monoxide concentration |
humidity | % | % of humidity in the air. |
illuminance | lx/lm | Light level. |
signal_strength | dB/dBm | Signal strength. |
temperature | °C/°F | Temperature. |
timestamp | ISO8601 | Timestamp. |
power | W,kW | Power. |
pressure | hPa,mbar | Pressure. |
current | A | Current. |
energy | Wh,kWh | Energy. |
power_factor | % | Power Factor. |
voltage | V | Voltage. |
monetary | ISO 4217 | Monetary value with a currency |
here is more info about state_class from Sensor Entity | Home Assistant Developer Docs
measurement - The state represents a measurement in present time
Thanks @del13r for this post. I followed your recommendations and setup those sensors, etc. They appear to show reasonable values when viewed separately. However, for some reason, the energy dashboard doesn’t display any of the values. The graphs have stayed blank through the day as well.
Any ideas?
Sensor values
Energy Dashboard