I know this should be easy, I have a presence sensor Tuya ZG-204ZM on the awning outside and want the light there to switch on and stay on when presence detected then go off when clear
Do I need to create 2 automation, one for presence detected and another for when clear
I tried some of the blueprints but none seem to give simple on / off on presence
Hi Thanks for the reply
Yes I have seen many of these.
I am looking for presence not just motion.
I tried several of the blueprints but all are too complex.
Currently I am using 2 automation One for turn on light when presence and other for clear. both only have sense detect and light on or off depending on the state.
I am using similar sensor and automations for bathroom and they work OK
I was looking to combine these into one.
The basic logic in the post to which RedKing linked would still apply.
There might be an even simpler way but using the visual editor, you would have two separate triggers: one for occupancy detected and one when clear.
In the “Then do” section, add an action and select a “Choose” block. For option 1, set the condition as occupancy detected and for the action, turn on the light. Create a second option and do the opposite. Using this method, everything can be combined into one automation.
You would use 2 triggers instead of one trigger per automation. Each trigger (say, Detected/On and Clear/Off triggers) would each need to be given a Trigger-ID.
Then you’d use a Choose Action. Option 1 of the Choose would execute its action if one of the Trigger-IDs were detected, and Option 2 would get performed if the other Trigger-ID occurred.
description: motion triggered hall lighting with n/s lights
mode: single
triggers:
- trigger: state
entity_id:
- binary_sensor.hall_motion_occupancy
from: "off"
to: "on"
id: hall-on
- trigger: state
entity_id:
- binary_sensor.hall_motion_occupancy
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: 20
id: hall-off
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- hall-on
sequence:
- metadata: {}
target:
entity_id:
- scene.hallway_day
action: scene.turn_on
data:
transition: 2
enabled: true
- conditions:
- condition: trigger
id:
- hall-off
sequence:
- action: light.turn_off
metadata: {}
data:
transition: 2
target:
entity_id:
- light.hall_lights_group
alias: Hall Motion Example
Hi all Thanks for the information.
RedKing sorry I did not see that there was a link in your first line (stupid me)
Thanks Helitropic & Bob.t
Will give these suggestions a go