Mrsash
(Sash B)
April 22, 2024, 1:34pm
778
Oh you set that up today, wow.
So is this in addition to the minute by minute graph I have setup can all be replicated there etc?
I might need to remind myself how to reverse everything and move it. Or is there an easier route?
I am excited. Thanks for the awesome work again.
del13r
April 23, 2024, 12:53am
779
Hi @Mrsash
The default Enphase production and consumption sensors are minute by minute, so I’m not sure specifically which sensors/graphs you are referring to.
The guide is focussed on 2 steps.
Step 1 - Getting home assistant to calculate both:
Grid import power
Grid export power
using template sensors to perform calculations using data from the enphase sensors.
Step 2 - Setting up Riemann Sum sensors which convert:
grid import power (W) to grid import energy (kWh)
grid export power (W) to grid export energy (kWh)
Given you are asking about power import and power export sensors being absent, I have to assume you have not set these up yet.
Mrsash
(Sash B)
April 23, 2024, 2:40am
780
Sorry I meant I have this currently which is working well.
Mrsash
(Sash B)
April 23, 2024, 2:41am
781
I guess what I was trying to figure out is if the updated guide for Enphase Envoy and Energy Dashboard is a total replacement including the above minute by minute graph?
del13r
April 23, 2024, 2:53am
782
Ah ok,
This graph is in W, so you have done step 1 which gives you power export and power import (shown in grey in the graph). The names may not be identical but you can adjust them to suit your setup.
If you want to use energy dashboard, you can do step 2 and convert the power sensors you have in the graph into energy sensors.
Mrsash
(Sash B)
April 23, 2024, 2:59am
783
ok sounds promising. Pretty much have the following in my config.yaml
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
template:
- 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_XXXXXXXXXX_current_power_production') | int(0) %}
{% if value <= 5 -%}
0
{% elif is_state('sun.sun','below_horizon') %}
0
{%- else -%}
{{ value }}
{%- 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_XXXXXXXXXX_current_power_consumption') | int(0) - states('sensor.solar_power_corrected') | int(0) ] | max }}
- sensor:
- name: Grid Export Power
state_class: measurement
icon: mdi:transmission-tower
unit_of_measurement: W
device_class: power
state: >
{{ [0, states('sensor.solar_power_corrected') | int(0) - states('sensor.envoy_XXXXXXXXXX_current_power_consumption') | int(0) ] | max }}
- sensor:
- name: Net Power
state_class: measurement
unit_of_measurement: W
device_class: power
icon: mdi:transmission-tower
state: >
{% set production = states('sensor.solar_power_corrected') | int %}
{% set consumption = states('sensor.envoy_XXXXXXXXXX_current_power_consumption') | int %}
{{ (production - consumption) }}
sensor:
- platform: integration
name: Solar Energy Corrected
source: sensor.solar_power_corrected
method: left
unit_prefix: k
unit_time: h
- platform: integration
name: Grid Import Energy
source: sensor.grid_import_power
method: left
unit_prefix: k
unit_time: h
- platform: integration
name: Grid Export Energy
source: sensor.grid_export_power
method: left
unit_prefix: k
unit_time: h
utility_meter:
daily_energy:
source: sensor.grid_import_energy
name: Daily Import Meter
cycle: daily
tariffs:
- offpeak
- shoulder
- peak
daily_energy_export:
source: sensor.grid_export_energy
name: Daily Export Meter
cycle: daily
tariffs:
- buyback
del13r
April 23, 2024, 3:13am
784
Your sensor names are:
These sensors are the ones you use in your automations.
My sensor names are:
sensor.power_import
sensor.power_export
Just update the sensor names from mine to yours.
For your Energy Dashboard, you can use these
Import = Grid Consumption
Export = Return to Grid
Mrsash
(Sash B)
April 23, 2024, 3:26am
785
del13r:
Your sensor names are:
These sensors are the ones you use in your automations.
My sensor names are:
sensor.power_import
sensor.power_export
Just update the sensor names from mine to yours.
Oh right so just the names are different
Grid Import Power to your sensor.power_import
Grid Export Power to sensor.power_export
So I just need to substitute with my sensor names, got it
The energy Dash you are referring to is the HA one right? Already have the Dash configured
thanks for the help
Once the new heat pump is in I will have it setup with automatons. Cant wait…
1 Like
Hey guys! I found an issue with my data reporting here
When the day ticks over, the production doesn’t start at zero, instead it starts at 3.54kWh. Is there anything I can do to fix this? Here’s my energy dashboard
Any help would be appreciated to balance this out. Dunno why it’s doing this, it happened after my Envoy firmware got updated to the latest version.
AndrewP
(Andrew)
April 24, 2024, 5:37am
787
Just checked mine, and the “Energy production today” value is reset to 0 at midnight.
del13r
April 24, 2024, 11:32am
789
not resetting to 0 can be worked around by setting up an integration sensor to record power over time into an energy figure.
hmmm, how would i do that? could you give any pointers? Thank you!
del13r
April 25, 2024, 12:03am
791
Sure, I just wrote about how this works in another topic.
An example of what Riemann sum integral is used for is for recording the instantanous power figures in W and converting them to energy figures in kW .
If I turn on an electrical device that steadily consumes 1030 W and leave that device on for an hour, then that device has consumed 1.03 kWh over the course of an hour.
Power in W - real world example
Riemann sum integral then incrementally records how much power the device consumed each time the power sensor updates and graphs those samples over time.
Energy in kWh - real world example generated by Riemann sum integral using only the power sensor above as the data input source.
Energy Dashboard basically samples the Lifetime Energy Value at both the start and end of each hour and records only the difference.
Energy Dashboard Samples
Value
Metric
Lifetime energy value at 3:00 PM
2182.52
kWh
Lifetime energy value at 2:00 PM
2181.49
kWh
Difference between start and end
1.03
kWh
How Energy Dashboard presents this same data.
username11384:
how would i do that
As for how you would do it, you would find the name of your solar power production sensor and use that in the “Input Sensor:” field.
My only warning would be to make sure your power sensor is in W (Watts) as Riemann sum integral seems to only work when I use a sensor expressed in W (Watts) in my experience.
Go to settings
Devices and services
Helpers
+Create Helper
Integration - Riemann sum integral sensor
Add Riemann sum integral sensor
Name: Energy Production
Input Sensor: Power Production
Integration Method: Right Riemann Sum
Precision: 3 is default
Metric Prefix: k (kilo)
Time Unit: Hours
Edit, I just tried it without specifying the metric prefix, and it will work with whatever source metric you are using.
The issue is, once you click on a metric prefix, you cannot seem to unclick it in the GUI.
If you mess this up, you can correct it in Developer tools
I was wondering if someone could help me. I believe I have everything right, but my import energy doesn’t seem to be working.
Here is code from my configuration.yaml
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_121804003802_current_power_consumption') | int(0) - states('sensor.envoy_121804003802_current_power_production') | int(0) ] | 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_121804003802_current_power_production') | int(0) - states('sensor.envoy_121804003802_current_power_consumption') | int(0) ] | max }}
sensor:
- platform: integration
name: Grid Import Energy
source: sensor.grid_import_power
unit_prefix: k
unit_time: h
method: left
- platform: integration
name: Grid Export Energy
source: sensor.grid_export_power
unit_prefix: k
unit_time: h
method: left
This is the entities added to the energy dashboard
Perhaps it’s just taking time? as I haven’t imported any energy yet
Don’t worry, human error, all working
Mrsash
(Sash B)
April 29, 2024, 2:07am
794
so… I was playing with the way it shows me all this info. I wanted to incorporate the energy distribution for the day on the top right. At the moment its just a duplicated live usage powerflow card entity. Any thoughts?
del13r
April 30, 2024, 6:33am
795
Like this?
Here is my code
cards:
- type: custom:power-flow-card-plus
entities:
grid:
entity: sensor.power_net
solar:
entity: sensor.power_production
home:
entity: sensor.power_consumption
fossil_fuel_percentage:
entity: sensor.grid_fossil_fuel_percentage
- type: energy-distribution
Mrsash
(Sash B)
April 30, 2024, 3:54pm
796
Thanks much appreciated.
Hmm I added that to a card and I was getting errors.
I didnt have the sensor.power_consumption instead used sensor.envoy_XXXXXXXXXX_current_power_consumption
Also I had to move this to the left and remove the "- "
- type: energy-distribution
Need to wait until it loads info, but will post it after it does.
del13r
April 30, 2024, 7:54pm
797
Hi,
Either create a new view or edit an existing view and press the pencil icon.
Then press the 3 dots in top right and press edit in yaml
Then paste in the code
The - type:
is used for each card in the page
The other method is to press add card, choose manual, paste in type: energy-distribution
Mrsash
(Sash B)
May 1, 2024, 12:44am
798
Cool
Got it working. Top right
Any reason the Grid Export and solar info does not match? Seems off significantly