If I enter the following in developers tools template i get the minutes that have passed since the door was closed. When I use it as a template sensor i get 0.
This works:
{{ ((as_timestamp(now())-as_timestamp(states.binary_sensor.sensor.last_changed))/60) | round | int }}
This doesnt:
- platform: template
sensors:
door_closed_since:
entity_id: binary_sensor.sensor
value_template: "{{ ((as_timestamp(now())-as_timestamp(states.binary_sensor.sensor.last_changed))/60) | round | int }}"
friendly_name: "Time since Door was closed"
Any help?