433 MHz radio controlled power switch

Remote controlled power plugs which come with their own 433.92 MHz remote can be integrated in smart home solutions with a cheap radio module.

The original signal from the remote is recorded with a 433 MHz receiver and later the same signal can be sent using a 433 MHz transmitter. After I describe how to do that, I will show you how to hook up the transmitter to an ESP8266 and integrate it in the HomeAssistant smart home solution. Thanks to HomeAssistant you will be able to control the power plugs with your phone, voice assistant, or define custom triggers such as a timer.

Recording

I used an Arduino Uno to record the original signals with the following libraries:

RCSwitch

The first remote I recorded is labeled “Bestest Art. 0429”. This remote works with the RCSwitch library. The library’s wiki lists compatible devices. My power plugs use the 24 bit Protocol 1. Each button on the remote sends a different 24 bit code, write them down and use the library to send the signal yourself.

NewRemoteSwitch

The second remote I recorded is branded as “Bauhaus Voltomat 22541673”. This one does not work out of the box with RCSwitch. Using the recording example code, you will see that each button actually sends four signals after each other.

The NewRemoteSwitch library supports this type of protocol. Using the NewRemoteReceiver example I recorded a period of 260ms, wrote down the address of my remote and tried out the individual buttons. The switches 1, 2 and 3 were recorded as unit 15, 14 and 13. The group button sets the group bit to 1. The switch type is 1 for on, and 0 for off. Since the switch learns its address from the remote after plugging it in, I guess you could use any other code to pair the switch, but then the original remote would not work anymore.

Transmitting

Here are two basic examples for transmitting on and off signals with a short delay. Each library provides more detailed examples.

Bestest Intertek

Using the RCSwitch library, send the decimal code for on, wait and send the code for off.

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  // using pin 11 to transmit
  mySwitch.enableTransmit(11);
}

void loop() {
  mySwitch.send(1234001, 24);
  delay(5000);
  mySwitch.send(1234004, 24);
  delay(5000);
}

Bauhaus Voltomat

Here is a simple example to switch the first plug (unit 15) every 5 seconds:

#include <NewRemoteTransmitter.h>

// Create a transmitter on address 123,
// using digital pin 11 to transmit,
// with a period of 260ms (default),
// repeating the transmitted code 2^2=4 times.
NewRemoteTransmitter transmitter(123, 11, 260, 2);

bool newState = true;

void setup() {
}

void loop() {
  transmitter.sendUnit(15, newState);
  delay(5000);
  newState = !newState;
}

Arduino pin 11 is connected to the data pin of the 433 MHz module.

Better Antenna

While the module I used works without additional antenna if the power plug is in its line of sight, it is not reliable anymore when blocked by furniture. Solding a 433 MHz antenna to the module increases its range.

Integration with HomeAssistant

HomeAssistant supports switches with a REST interface without any additional configuration. Connect the transmitter to an ESP8266, connect it to your Wifi and hook up the recorded signals to a REST interface.

Avatar
Mitja Kleider
Software Developer