Hi, i have asimple task - i thought in the beginning - : i have an underfloor heating system and measure the time, when it turns on and off. So i have two timestamps that i want to calculate the time difference from and then to convert to a float value.
All trials with as_timestamp did fail
this is the YAML: sensor: - name: pwm_wz_on_time state: "{{ (trigger.to_state.last_changed - trigger.from_state.last_changed) }}"
which works perfectly but gives a timestamp (or similar) as HH.MM:ss
I’m facing a similar problem, but I wasn’t able to solve it yet.
I’ve got a sensor.e2m_tracker_last_seen with a timestamp that is normally triggered every 30 seconds until the device is away from the home.zone. I want to get a sensor wich gives me the seconds since the last trigger. I’ve created a Sensor with a template
This sensor gives me the seconds, but if the Tracker is away it remains on the last value. So I can’t get the value of seconds since the last trigger. It’s always under 40 sec.
sensor.e2m_tracker_last_seen is a timestamp sensor.
How can I fit the template of @petro into my sensor?