My primary use would be for device tracking with multiple zones. If I have the zones “home”, “not_home” (whatever that is in this case) and “work”, I don’t want to check for
from: home
to: not_home
.
I really want to check for
condition: not
condition:
state: home
.
Because in some cases, depending on the speed of the state tracker, it might skip not_home and go directly to work, not triggering my automation.
- alias: 'Turn off all lights if nobody is home'
trigger:
platform: state
entity_id: sensor.someone_home
from: 'true'
to: 'false'
condition:
condition: state
entity_id: input_boolean.lights_away_auto_off
state: 'on'
action:
service: script.kill_all_lights
I would also like to see this feature implemented soon. Using template syntax for lots of devices gets super messy. It would be nice to be able to just list them out like any other condition. Any ETA on this?
I have the following case for which i think i need a NOT option in conditions. I switch on a ‘decorative’ light on weekdays in the morning, for an hour. But i don’t want to do this when we’re on holiday. I have motion sensors, so i would like to state as a condition “only when no motion has been detected for 24 hours”.
I assume that would make this automation only trigger when there has been motion for 24 hours (or would it trigger if in the last 24 hours the state has at any time and for any period been ON?). I could state OFF instead of ON as condition state, but this would turn the lamp on only when there has been not motion in 24 hours and we’re on holiday or something ;-), which is the opposite of what i want .
So a NOT would be helpful, so a “state: !/not off” would mean ‘if the motion sensor has not been off for 24 hours’.
You need a template condition with a value template that the last time the sensor was on was within 24 hours. You can use the last_updated attribute for this.
I’m way too dopey to work out the exact contents of the template at the moment, but that’s a pointer to what you need.
I’m reviving an old thread, but I’m having this issue too and need some clarification.
I added my gas fireplace to HA. For safety reasons, I want an automation that will turn the fireplace off if it is accidentally turned on when neither my wife or myself are home. I have the automation created but needed a “not” condition to tell the system only to fire when we are not home. I like the idea of using the template posted by lorentz, but I’m not sure how to have the template sensor sense two device presences and return “false” is both are gone. How would I modify the code below to work with multiple devices and return a “false” if no device state is home?
I believe you can put your devices into a group. After that you can test whether the group is present or not. If one device is present, the group is present, but all devices must be away for the group to be away.
This would be nice. Ideally, I would like to use this with a weather sensor so that if its NOT sunny or clear outside, turn on the lights 45 minutes before sunset.
Currently I can’t do this because there a too many conditions that are NOT ‘clear’, like rain, snow, cloudy, partly cloudly, mostly cloudy…etc…it’d be too tedious to create this automation…so a ‘NOT’ condition would be really cool