Hi,
I’m trying to fire some automation when a sensor has not changed for x time. I’ve read quite some topics and I have various attempts for usable templates working in my dev-tools environment. However using these in sensors, binary sensors or automation triggers they just don’t seem to work.
Example of binary sensor that needs to be switched on after 5 sec of no change:
test:
friendly_name: test
value_template: "{{(as_timestamp(now()) - as_timestamp(states.binary_sensor.bathroom_humidity_dropping.last_changed)) | int > 5}}"
If I run the template I see it switching from true to false (and vice versa) but the sensor remains unchanged
Example of regular sensor that should display the # seconds since last change:
- platform: template
sensors:
humidity_drop_last_update:
value_template: '{{(as_timestamp(now()) - as_timestamp(states.binary_sensor.bathroom_humidity_dropping.last_changed)) | int}}'
Again, when running the template I see a nice output in seconds. The sensor however does not update…
And for the automation:
trigger:
- platform: template
value_template: '{{(as_timestamp(now()) - as_timestamp(states.binary_sensor.bathroom_humidity_dropping.last_changed) | int > 60)}}'
again with no result…
What am I doing wrong here?