I’d like to create an automation which turns any lights left on for longer than 10 minutes (due to missed Z-Wave commands etc).
After messing with the dev tools, I came up with the following one-liner which lists all devices in this desired state:
Originally I thought I could just create a Device Trigger which relies on the ‘For’ option to determine how long the device was in that state, but it will only run once (unless I missed something), while I want my rule to check every 5 minutes or so if anything was left on.
I originally was just going to use the recurring time trigger,and a template condition. While it’s easy to generate a list of devices which are in a bad state, I’m not sure how to act on it:
{{states.light|selectattr("state", "equalto", "on")|selectattr('last_changed', 'lt', now() - timedelta(minutes=10))|list }}
Can I have the rule perform an action on each matched devices in that template value condition? Is there such thing as a condition version of the {{trigger.to_state.name}}
1 post - 1 participant