Hi,
I was able to get active daily time “on” from tasmota using history stats.
code:
- platform: history_stats
name: Oil burner active time
entity_id: switch.senzor1_temp_vlaz
state: ‘on’
type: time
start: ‘{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}’
end: ‘{{ now() }}’
I have converted time to liters using this code:
- platform: template
sensors:
oil_consumed:
value_template: ‘{{ ((states.sensor.oil_burner_active_time.state | float * 2.6)) | round(2) }}’
friendly_name: ‘Porabljeno’
unit_of_measurement: ‘L’
When I use utility meter, everything works well:
code:
monthly_oil:
source: sensor.oil_consumed
cycle: monthly
…unitl I restart the hassio.
Then the value of sensor.oil_consumed gets added to sensor.monthly_oil
Example:
values before hassio restart:
sensor.oil_consumed = 0.5 L
sensor.monthly_oil = 1.0 L
values immediately after hassio restart:
sensor.oil_consumed = 0.5 L
sensor.monthly_oil = 1.5 L (it falsely adds 0,5 L, which it should not do)
And for each restart “sensor.oil_consumed” is falsely added to “sensor.monthly_oil”.
What am I doing wrong?