Hello,
I’m having a problem with the readout of an solar Inverter, as the network is not very stable and sometimes the value can not be read, so I configured it to return 0. However this is messing up some other parts of the energy dashboard, so I would like to keep the last value if the value comes back as undefined.
At midnight I want it to reset to hero, as it is a daily value.
I think this should do it, but somehow it does not work:
template:
- sensor:
- name: "pv_energy_today_filtered"
unit_of_measurement: 'kWh'
device_class: "energy"
state_class: "total_increasing"
state: >-
{% if is_state('sensor.pv_energy_today', '0') %}
{{ states('sensor.pv_energy_today_filtered') }}
{% elif now().hour == 0 %}
{{ 0 | float(0) }}
{% else %}
{{ states('sensor.pv_energy_today') }}
{% endif %}
command_line:
- sensor:
name: "pv_gartenhuette_energy_today"
#command: "cat test | grep \"var webdata_today_e\" | cut -d'\"' -f 2"
command: "curl -s -u admin:PW http://192.168.0.71/status.html | grep \"var webdata_today_e\" | cut -d'\"' -f 2"
unit_of_measurement: 'kWh'
device_class: "energy"
state_class: "total_increasing"
scan_interval: 60
value_template: '{{ value | float(0) }}'
Somehow it does not work, does anybody has an idea what I have done wrongly