Smart Home Automation Forum
Lesson18 - add ZigBee PIR motion sensor to auto control light in home assistant - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1)
+--- Forum: Home automation training courses (https://www.kincony.com/forum/forumdisplay.php?fid=18)
+--- Thread: Lesson18 - add ZigBee PIR motion sensor to auto control light in home assistant (/showthread.php?tid=1857)



Lesson18 - add ZigBee PIR motion sensor to auto control light in home assistant - admin - 04-25-2022


1. 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: True


Actions:
Action type: Call service
Service: Switch:Switch: Turn on
+ Choose entity

create automation-2 (turn off light)
------------------------------------------
Trigger type: State
Entity: pir-state
To: False


Actions:
Action type: Call service
Service: Switch:Switch: Turn off
+ Choose entity