I use this template condition in an automation which sends out notifications when unifi protect detects motions. The idea is that I do not get notifications for motion detection when somebody is at home. To put it the other way round, if both people are away the condition is true and the automation sends out notifications.
{{ (states('sensor.person1_status') == 'away' or states('sensor.person1_status') == 'extended away') and (states('sensor.person2_status') == 'away' or states('sensor.person2_status') == 'extended away') }}
For testing purposes I’d like to have a boolean I can switch on which sort of “disables” this template from being used in my automation. This way I can test motion detection notifications even when somebody is at home.
I tried to create sensors based on this boolean and this template but seems to be a dead end.
Any idea what’s a good practice to solve such a case?
well, the challenge here using a boolean is that a boolean is either true or false which means the automation triggers or not.
But I need something like a conditional boolean which activates the template condition within the automation.
automation options:
boolean is off: automations triggers only if people are not home (based on the template condition in my automation)
boolean on: automation triggers even if people are home (that’s my challenge)
FWIW you can condense that template a little by using the “in” test:
{{ states('input_boolean.test') == 'on'
or ( states('sensor.person1_status') in ['away', 'extended away']
and states('sensor.person2_status') in ['away', 'extended away']) }}