Control remote controlled wall sockets from code

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
User avatar
pythoncoder
Posts: 4246
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Control remote controlled wall sockets from code

Post by pythoncoder » Fri Apr 03, 2020 8:05 am

Radio controlled wall sockets like these

Image

are handy but you can't do a lot with them. You can get very cheap radios like these:

Image

The receivers can sniff the signal from the remote enabling the transmitter to send those codes and control the socket.

The repo is here. Support is for Pyboards and ESP32.

This is less "plug and play" than most of my efforts: there is a wide range of wall sockets out there with different protocols. There is also quite a range of receiver and transmitter modules. If receiver A won't sniff remote B I probably won't be able to fix it: it's one for experimenters.
Peter Hinch

kevinkk525
Posts: 733
Joined: Sat Feb 03, 2018 7:02 pm

Re: Control remote controlled wall sockets from code

Post by kevinkk525 » Fri Apr 03, 2020 3:46 pm

I'm using this library and it works great with my power sockets!
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

GryKyo
Posts: 15
Joined: Sat Dec 15, 2018 12:43 am

Re: Control remote controlled wall sockets from code

Post by GryKyo » Mon Apr 13, 2020 2:03 am

I have started to use some wireless switches (magnetic reeds) on outside doors, sheds, access to my back garden etc which are 433Mhz. I use a Sonoff 433Mhz-RF bridge flashed with the popular "Tasmota" firmware to listen for anything on this frequency which it then relays via MQTT where/when I can easily deal with it. This is straight forward, one parses the "signature" of the sensor from a json string which allows your code to identify the switch and it's condition; open/closed etc
By default this device running Tasmota has 16 unique "codes" that it can transmit, each can be called with a MQTT topic/message. If you already use MQTT then this has the advantage of being able to control "most" devices on 433Mhz and listen for cheap and available wireless sensors also.

There is a web UI served by the device, this is pasted from the console when I press some of the buttons:

Code: Select all

03:01:29 MQT: stat/rfSensors/RESULT = {"RfKey1":"Default sent"}
03:01:31 MQT: stat/rfSensors/RESULT = {"RfKey2":"Default sent"}
03:01:33 MQT: stat/rfSensors/RESULT = {"RfKey3":"Default sent"}
03:01:36 MQT: stat/rfSensors/RESULT = {"RfKey4":"Default sent"}
03:01:39 MQT: stat/rfSensors/RESULT = {"RfKey16":"Default sent"}
HTH?

Garry

User avatar
pythoncoder
Posts: 4246
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Sniffing sensor data

Post by pythoncoder » Mon Apr 13, 2020 9:06 am

I did wonder whether it might be possible to capture 433MHz signals from sensors rather than from remote controls. RC's are easy because, if you hold the button down, they transmit continuously (well, with short repeatable gaps). I could therefore capture multiple transmissions and do averaging to reduce timing uncertainties. These uncertainties arise in the radio receiver.

Sensors aren't so obliging: they transmit short bursts. Further, one type of radio receiver I tested emits a continuous stream of digital noise in the absence of a signal. This makes detecting an unknown signal rather difficult.

I therefore concluded that capturing sensor data was outside of the scope of this project. If the Tasmota guys have found a way to do this, all power to them. Unless I have a brainwave, or someone tells me how you fix this problem, I have no plans to sniff sensor data.
Peter Hinch

Post Reply