HC-SR501 Infrared PIR Motion Sensor Module: Difference between revisions
From KlavoWiki
Jump to navigationJump to search
(Created page with "This is what I have done to get the HC-SR501 working with the D1 Mini and Home Assistant. = Device = == Module == 250px = Tasmota Settings = I conn...") |
(→Device) |
||
Line 4: | Line 4: | ||
== Module == | == Module == | ||
[[IMAGE: HC-SR501.jpg|250px]] | [[IMAGE: HC-SR501.jpg|250px]] | ||
[[IMAGE: D1_Mini.png|300px]] | |||
= Tasmota Settings = | = Tasmota Settings = |
Revision as of 03:14, 1 December 2019
This is what I have done to get the HC-SR501 working with the D1 Mini and Home Assistant.
Device
Module
Tasmota Settings
I connected the data line to D4 as it was besided the power pins.
Config
Tasmota
SwitchTopic Kitchen_Sensor SwitchMode2 1 SwitchRetain on
Home Assistant
/config/configurations.yaml
binary_sensor: - platform: mqtt name: "Kitchen Sensor" state_topic: "cmnd/Kitchen_Sensor/POWER" payload_on: "ON" payload_off: "OFF" device_class: motion switch: - platform: mqtt name: "Kitchen Sensor" state_topic: "stat/Kitchen_Sensor/POWER" command_topic: "cmnd/Kitchen_Sensor/POWER" payload_on: "ON" payload_off: "OFF" retain: false
/config/customize.yaml
binary_sensor.kitchen_sensor: device_class: motion
/config/automations.yaml
automation: - alias: Turn on kitchen light when there is movement trigger: platform: state entity_id: binary_sensor.kitchen_sensor to: 'on' condition: - condition: state entity_id: switch.hall_lights state: "off" - condition: sun after: sunset after_offset: "+00:30:00" - condition: sun before: sunrise action: - service: switch.turn_on entity_id: switch.kitchen_sink_light - alias: Turn off kitchen light 3 minutes after last movement trigger: platform: state entity_id: binary_sensor.kitchen_sensor to: 'off' for: minutes: 3 action: service: switch.turn_off entity_id: switch.kitchen_sink_light