Sonoff Slampher and PIR Coordination of 2 Seperate Units

I have recently brought you a project using a single Sonoff Slampher and PIR set. Details here:
Sonoff Slampher and Sonoff PIR Integration

I also have completed this project where I have 2 separately wired lights in a basement stairway that need coordinated control. I want top PIR sensor to turn on both the top and bottom lights, and I want the bottom PIR sensor to do the same. Since the Slamphers are keyed to one code each, this poses an interesting problem. I do need a PIR on the top and on the bottom because the stair twists around a corner and it is blind from either side. The lights were never switched together. I decided to approach this in the following way.

Tasmota Code:

Backlog SSID1 YourSSID; Password1 YourWIFIPassword; MqttHost YourMQTTHostIP; MqttUser YourMQTTUserLogin; MqttPassword YourMQTTUserPassword; SysLog 2; WebLog 2; SerialLog 0; sleep 100; FullTopic %topic%/%prefix%/
Backlog Topic bhall_socketU; FriendlyName1 bmt_hall_rf_socket; FriendlyName2 bmt_hall_socket; Hostname bmt_hall_rf_socket; MqttClient bmt_hall_rf_socket; PowerRetain 1; PulseTime1 5; PulseTime2 300
Backlog Rule1 on POWER1#state=1 do POWER2 ON endon on POWER2#state=1 do WebSend [192.168.57.103] POWER2 ON endon; Rule1 on

Template:
{"NAME":"SlampherSpltRF","GPIO":[17,255,0,255,0,0,0,0,22,56,0,0,21],"FLAG":0,"BASE":9}

Sample Control Panel Output:

00:06:50 MQT: bhall_socketU/stat/RESULT = {"POWER1":"ON"}
00:06:50 MQT: bhall_socketU/stat/POWER1 = ON (retained)
00:06:50 RUL: POWER1#STATE=1 performs "power2 on"
00:06:50 MQT: bhall_socketU/stat/RESULT = {"POWER2":"ON"}
00:06:50 MQT: bhall_socketU/stat/POWER2 = ON (retained)
00:06:50 RUL: POWER1#STATE=1 performs "WebSend [192.168.57.103] POWER2 ON"
00:06:51 MQT: bhall_socketU/stat/RESULT = {"WebSend":"Done"}
00:06:51 MQT: bhall_socketU/stat/RESULT = {"POWER1":"OFF"}
00:06:51 MQT: bhall_socketU/stat/POWER1 = OFF (retained)
00:10:10 MQT: bhall_socketU/stat/RESULT = {"POWER2":"OFF"}
00:10:10 MQT: bhall_socketU/stat/POWER2 = OFF (retained)

The rules go as follows. The PIR triggers POWER1 relay thru a 433mhz signal. When POWER1 comes on the rule turns on POWER2. Then a couple seconds later POWER1 goes off due to the PulseTime1 5 command. When POWER2 comes on, the next rule sends the WebSend command to the other light to turn on POWER2 there. After 3 minures POWER2 turns off from the PulseTime2 300 command.

Both units are set-up in a similar way, with the WebSend command IP address referring to the other device.

In case it is not clear, without rules like this the PIR will toggle the light on and off multiple times as it senses a person, making the light flip on and off as you walk by or leaving it on when you are not there and off when you walk by. The rule and the template basically allow the 433mhz signal from the PIR toggle the light when the light is off as you would expect it to operate.

Thanks for reading.
If you have any suggestions please don’t hesitate to share them with the group.

Sir Goodenough…

This post will no longer be updated here, as I now have a website and it willl be updated there. Please look to :slight_smile:
https://whatarewefixing.today/?p=134