3 ms·
This is dead easy to do in Home Assistant if you use a jinja-based template as the automation trigger. Any template that will evaluate to true will trigger the
by jayelbe 5y ago
This is dead easy to do in Home Assistant if you use a jinja-based template as the automation trigger.
Any template that will evaluate to true will trigger the automation. Templates are re-evaluated every time the state of the object changes or (if you use a time function, or don't reference any objects) every minute.
Here's a simple example that would send a notification if I left my kitchen LEDs on 200 brightness or more for longer than two hours.
alias: Kitchen
description: ''
trigger:
- platform: template
value_template: ' {{ state_attr('light.kitchen_led', 'brightness')|int >= 200 and as_timestamp(states.light.kitchen_led.last_updated) + 3600 < as_timestamp(now()) }} '
condition: []
action:
- service: notify.my_phone
data:
title: Kitchen lights still on
message: The kitchen LEDs have been on very bright for more than 2 hours.
mode: single
- maweki 5y agoThat's absolutely not what I meant. The trigger condition is not the problem. The action is. It is not goal-based. I can't give a target value (as template) and the system tries to bring the entity to that state. I have to have another check (or two automations) to trigger the off/on-action. Home assistant basically has no idea how to bring entities to a desired state.