Skip to content

Value Templates | Various working examples

xbmcnut edited this page Nov 4, 2020 · 3 revisions

In a Condition:

- condition: template
          value_template: "{{ (as_timestamp(now()) - as_timestamp((states.light.stair_lights.last_updated)) <300)}}"

The value at the end of the template is in seconds and test to see if the attribute was last updated within that time https://community.home-assistant.io/t/automation-condition-that-checks-if-a-state-changed-in-the-last-x-mins/22012/3 As a Trigger:

trigger:
   - platform: template
     value_template: "{{ (state_attr('lock.frontdoor_deadbolt', 'lock_status')) == 'Unlocked with Keypad by user 2' }}"