Rui, After a couple of months medical recovery, I finally to continue work on my remote project for the sonoff switches.
I updated the remote to no only send (publish) but also to receive (subscribe) a reply from the switch that it actually operated. The images of that unit are here and I apologize for the poor photos of the leds while they are turned on.
The code for the modified switch
I hope the images and code worked as I don’t use this system very often.
I have another question regarding the sonoff switch. As they come out of the box and connected to the company cloud, the push button can be used to make the switch turn on and off manually.
I would like to add that feature to my existing code so that I can mount the switch inside a utility box and put a pushbutton on a wall plate to control the switch as well as with the wifi connection.
I have built a motion sensor based on your motion/LDR/temp unit but I am only using a radar detector instead of the PIR device. The radar device seems to have far fewer false triggers.
But my question is this? How can I add the pushbutton into the code of the sonoff to make it work like original pushbutton. Any and all ideas deeply appreciate.