goerken
(Goerken)
August 23, 2024, 7:08am
1
My sensor for resets daily a few seconds after midnight, so in the energy dashboard there is a peak at the first hour.
I created a utility meter, but there is production displayed where no production was
.
The sensor for the daily yield:
- sensor:
- name: "energy_pv_daily"
unique_id: "PV Energy daily"
state: >
{{ (states('sensor.inverters_total_daily_yield') | float) - (states('sensor.battery_1_tagesentladung') | float) + (states('sensor.battery_1_tagesladung') | float) }}
device_class: energy
state_class: total_increasing
unit_of_measurement: 'kWh'
Edwin_D
(Edwin D.)
August 23, 2024, 3:24pm
2
If you create a template sensor like that, you should also create an availability template for it. Also, if these sensors reset dayly, but at slightly different times, you will get weird results.
But most importantly, why do you calculate with them, instead of listing them individually in the dashboard in the places they need to be? The dashboard wants these separately.
goerken
(Goerken)
August 26, 2024, 9:15am
3
According to the integration (Daily Solar Yield · wlcrs/huawei_solar Wiki · GitHub ) I use the daily energy should be calculated like that.
I added the availability to the sensor
- sensor:
- name: "energy_pv_daily"
unique_id: "PV Energy daily"
state: >
{{ (states('sensor.inverters_total_daily_yield') | float) - (states('sensor.battery_1_tagesentladung') | float) + (states('sensor.battery_1_tagesladung') | float) }}
device_class: energy
state_class: total_increasing
unit_of_measurement: 'kWh'
availability: >-
{{
(states('sensor.inverters_total_daily_yield')|is_number)
and (states('sensor.battery_1_tagesentladung') |is_number)
and (states('sensor.battery_1_tagesladung')|is_number)
}}
goerken
(Goerken)
August 27, 2024, 5:56am
4
I found a workaround by not measuring for the first hour of the day
- sensor:
- name: "PV Energy daily Helfer"
unique_id: "filtered_sensor_id"
state: >
{% if now().hour >= 1 or now().hour < 0 %}
{{ (states('sensor.inverters_total_daily_yield') | float) - (states('sensor.battery_1_tagesentladung') | float) + (states('sensor.battery_1_tagesladung') | float) }}
{% else %}
0
{% endif %}
device_class: energy
state_class: total_increasing
unit_of_measurement: 'kWh'
availability: >-
{{
(states('sensor.inverters_total_daily_yield')|is_number)
and (states('sensor.battery_1_tagesentladung') |is_number)
and (states('sensor.battery_1_tagesladung')|is_number)
}}