Last active
May 3, 2021 23:49
Smart home solver template_conditions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Front doorbell motion template condition | |
# Template condition which only passes if it has been more than 1 minute (60 seconds) that the automation.front_doorbell_motion ran. | |
- condition: template | |
value_template: > | |
{% if state_attr('automation.front_doorbell_motion', 'last_triggered') %} | |
{{ as_timestamp(now()) | int - | |
as_timestamp(state_attr('automation.front_doorbell_motion', 'last_triggered')) | int > 60 }} | |
{% else %} | |
false | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Smart Shades template condition | |
# Template condition which only passes if the automation has been triggerd last more than 12 hours ago (43200 seconds). | |
- condition: template | |
value_template: > | |
{% if state_attr('automation.office_shades_up', 'last_triggered') %} | |
{{ as_timestamp(now()) | int - | |
as_timestamp(state_attr('automation.office_shades_up', 'last_triggered')) | int > 43200 }} | |
{% else %} | |
false | |
{% endif %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more information on templating: https://www.home-assistant.io/docs/configuration/templating
More information on the state string specifically. https://www.home-assistant.io/docs/configuration/templating/#states