Is there a way to add an “else” part to this script that would set the boolean input to ‘no’? Or if the condition is not fulfilled it gets set to ‘no’? Or do I have to create a separate automation for that?
Ok, that’s really cool I think I need to overthink some things compared to my previous home automation system.
While this solves it, coming back to my initial question, just to learn something, don’t get me wrong here. Just wanted to know if an if.then.else construct is possible with HA or does it stop at the then?
Hello everyone. i am trying to figure out how to do an automation with the trigger accuweather real feel sensor . if the outside temperature drops bellow 3 deg celsius, then sonoff relay on, else sonoff relay off.
Can You please help me with this? thgank You in advance.
to go further with my automations:
if a phone enters a zone(detected by phone location) turn on a device, if the device leaves the zone, turn off the device. thank You in advance.
trigger:
- platform: zone
entity_id: YOUR DEVICE ENTITY_ID
zone: YOUR ZONE ENTITY_ID
event: enter
- platform: zone
entity_id: YOUR DEVICE ENTITY_ID
zone: YOUR ZONE ENTITY_ID
event: leave
action:
service: "switch.turn_{{ 'on' if trigger.event == 'enter' else 'off' }}"
entity_id: YOUR SWITCH ENTITY_ID
That looks fine, except for the messed up quotes in the template, but if it’s just one device measuring whether one person is home or not then it’s even simpler…
MF_social,
thank You for the reply.
i agree, it would be more logical to detect if a person is home and this is what i would actually want. but as my original request was n a device, then i kept this logic.
so, if we were to retake, how would it look like if there was a person detected by the device that he is home or not?
thats perfect. thank You. do you know if the refresh rate on an automation can be set? or if there is a setting on the devices position refresh rate? the automation works but it is laggy. the detection of the gps positon is made by the phone, and the switch is a tplink plug.
Hello. I added to my automation a secondary action that informs me about the outcome of te action taken. Ow on each execution of the automation i receive the notification. Is there a way to receive the notification only when the outcome changes( when passing from if to else)?