Appending entry with rules based config

Red-black Bonsai 2019-01-06 16:13:24 +01:00
parent d43254b8db
commit 7e745fb62b
1 changed files with 21 additions and 1 deletions

@ -25,4 +25,24 @@ In the Configuration -> Configure Module page, select the following:
### Tasmota Main
After reboot of the device the displays the status of relay1 aka switch1.
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/wemos/wemos_pir_hc-sr501_main_marked.png" width=350>
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/wemos/wemos_pir_hc-sr501_main_marked.png" width=350>
### Alternative Tasmota Configuration with Rules
If you don't want to drive a relay attached to the Wemos directly and instead send MQTT messages if the PIR gets triggered, you can use a similar configuration as above plus Tasmota rules.
Configure the module as described above but omit the GPIO12 = Relay1 setting (leave at 'None').
Then go to console in the webinterface and add a rule that sends a MQTT message if the PIR is triggered:
Rule1 on switch1#state=1 do publish stat/sonoff/PIRSENSOR1 ON endon on switch1#state=0 do publish stat/sonoff/PIRSENSOR1 OFF endon
Rule1 4
Rule1 1
Note: the webinterface (obviously) won't show the relay state as "ON" or "OFF" any more - you have to watch the MQTT messages on the console to see the PIR trigger.
If you want to attach a second PIR to another GPIO (e.g. D1 / GPIO5), configure it as Switch2 and add another rule via console:
Rule2 on switch2#state=1 do publish stat/sonoff/PIRSENSOR2 ON endon on switch2#state=0 do publish stat/sonoff/PIRSENSOR2 OFF endon
Rule2 4
Rule2 1