home automation training -18-ZigBee motion sensor control light in home assistant
- SONOFF SNZB-03 configure for home assistant by Zigbee2mqtt
sensor:
– platform: mqtt
name: pir-state
state_topic: “zigbee2mqtt/0x00124b00251e530f”
value_template: “{{ value_json.occupancy }}”Note: ID need replace with your device. such as ‘0x00124b00251e530f’
2. create a new automation:
create automation-1 (turn on light)
——————————————-
Trigger type: State
Entity: pir-state
To: TrueActions:
Action type: Call service
Service: Switch:Switch: Turn on
+ Choose entitycreate automation-2 (turn off light)
——————————————
Trigger type: State
Entity: pir-state
To: FalseActions:
Action type: Call service
Service: Switch:Switch: Turn off
+ Choose entity