Skip to content

Commit 8f38db2

Browse files
authored
Merge pull request #1373 from DeflateAwning/pir-home-assistant
Add instructions about using PIR sensor with Home Assistant
2 parents 791dece + 2e7531a commit 8f38db2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/PIR-Motion-Sensors.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,46 @@ With this it will stay ON for 30 seconds then send OFF message and the timer res
8080
Set the data pin to `Switch n` for it to work.
8181

8282
[Datasheet](https://eu.mouser.com/datasheet/2/315/PANA_S_A0004395539_1-2560640.pdf)
83+
84+
## Configuring Tasmota to for Home Assistant
85+
86+
To make Home Assistant recognize your PIR sensor automatically, skip all previous steps, and execute
87+
the following steps to make Tasmota announce your PIR as a motion sensor.
88+
89+
1. In **_Configuration -> Configure Module_** menu change your GPIO pin to `Switch2` (or any other switch number).
90+
2. Assuming you picked `Switch2` in the previous step, run this command:
91+
92+
```console
93+
Backlog rule1 on switch2#state do publish stat/%topic%/MOTION %value% endon; rule1 1; switchmode2 1, so19 1
94+
```
95+
96+
3. Run this very-long command all at once:
97+
98+
```console
99+
rule2 on system#boot do publish2 homeassistant/%topic%/config {
100+
"name": "Motion Sensor",
101+
"state_topic": "stat/%topic%/MOTION",
102+
"payload_on": 1,
103+
"availability_topic": "tele/%topic%/LWT",
104+
"payload_available": "Online",
105+
"payload_not_available": "Offline",
106+
"device_class": "motion",
107+
"force_update": true,
108+
"off_delay": 30,
109+
"unique_id": "%deviceid%_motion",
110+
"device": {
111+
"identifiers": [
112+
"%deviceid%"
113+
]
114+
}
115+
} endon
116+
```
117+
118+
4. Run the following two commands to enable the rule, and then restart the device:
119+
120+
```console
121+
Rule2 1
122+
Restart 1
123+
```
124+
125+
Note that this configuration, much like the rest of the examples on this page, don't show the PIR sensor's state on the home screen of Tasmota.

0 commit comments

Comments
 (0)