Making Home Assistant speak to RF devices (433MHz) via MQTT Gateway

Making Home Assistant speak to RF devices (433MHz) via MQTT Gateway

Adding an RF gateway to your Home Assistant setup makes your setup incredibly versatile because it opens up a multitude of low-cost automation opportunities. This project enables you to interface your Home Assistant setup with RF devices, allowing you to add cheap RF sensors to your home automation setup!

Wifi enabled IoT devices such as weather stations, door sensors, motion sensors, alarm systems, driveway alert systems, fans, heaters, light, temperature and humidity sensors often tend to be very expensive. RF versions have several advantages:

  • they are orders of magnitude cheaper (we are in the realm of a few AUD up to $15 each, depending on the device.)
  • since they are cheaper, you will be able to afford more
  • they are hackable
  • they are low-power, battery operated devices (Wifi is power hungry, RF is not)


The device should capture any incoming radio frequency (RF) signals at 433/315MHz and emit an MQTT message on the WIFI network with the original RF payload. This MQTT message can then be consumed by other WiFi enabled entities such as Home Assistant.

The device should have a range of at least 20meters, which should cover my house just fine. Walls and interference might reduce this range.

Known Limitations

RF is not as reliable as a WiFi connection because it does not have built in error correction. The range may also be limited.

There is no way to maintain a persistent state on the RF device for two reasons:

  1. The firmware does not support it. It simply sends an RF code when an event happens (for motion sensors that is “motion detected”).
  2. The state cannot be queried from Home Assistant. (Again, the devices do not maintain state).

There is a way to make these types of RF devices work in Home Assistant. Check out my post Setting up stateless RF Motion Sensors as binary_sensors in Home Assistant

I think the lack of statefulness is OK considering how affordable these devices are. The following helps mitigate these problems:

  • Run RF transceivers at the max rated voltage to increase range
  • Solder a custom antenna to the chip (see optional item in parts list)
  • Use the recommended RF modules
  • Create a custom HA component to manage state synthetically on the hub (give the illusion of state from an automation perspective)

Solution Components

  • OpenMQTTGateway, a free MQTT gateway supporting RF, Bluetooth, infrared and many more transport layers
  • MQTT broker
  • WiFi Enabled Arduino chip
  • RF receiver/transmitter

Solution diagram and interactions



  • ESP8266 ESP-12E CH340G WIFI Network Development Board Module For NodeMcu Lua
  • 433Mhz WL RF Transmitter + Receiver Link Kit Module for Arduino/ARM/MCU Wireless
  • (optional) 433MHZ Helical Antenna for Arduino Remote Control

Download the OpenMQTTGateway image by 1technophile and open it up in Arduino IDE. Here we need to change some settings in the User_config.h file. Edit the MQTT server, and WIFI settings.

//MQTT Parameters definition
#define mqtt_server \"\"
//#define mqtt_user \"your_username\" // not compulsory only if your broker needs authentication
#define mqtt_password \"your_password\" // not compulsory only if your broker needs authentication
#define mqtt_port 1883

// ... omitted text ...

/*-------------DEFINE YOUR NETWORK PARAMETERS BELOW----------------*/
// Update these with values suitable for your network.
#ifdef ESP8266 // for nodemcu, weemos and esp8266
  #define wifi_ssid \"wifi ssid\"
 #define wifi_password \"wifi password\"
#else // for arduino + W5100
  const byte mac[] = {  0xDE, 0xED, 0xBA, 0xFE, 0x54, 0x95 }; //W5100 ethernet shield mac adress

You can make any necessary changes in config_RF.h, though it’s probably a good idea (as with any Arduino project) to get the barebone default configuration to work before customising an installation.

Connect your NodeMCU to your computer and flash the program to your arduino using the following flash settings:


Wiring the receiver and transmitter

The config_RF.h file gives clues as to how to connect your RF transmitter and receiver. The receiver pin connects to D3 on the NodeMCU, the emitter pin connects to RC on NodeMCU.

Once you got this connected, plug your NodeMCU into power and test the setup.


For testing MQTT enabled projects, I recommend the MQTTfx utility (find more useful resources). Subscribe to the # topic which displays all MQTT traffic on your network. Plug your Arduino into a power source and use an RF emitting device such as garage door remote, fan or AC remote to test your Arduino Gateway. If everything works correctly, you should see the RF messages appear in MQTTfx along with their payload (a large integer). Notice that the payload is different for each remote button.

Future Improvements

The OpenMQTTGateway Wiki Page recommends the STX882 & SRX882 receiver and transmitter modules, which are very cheap on Ebay or AliExpress. I will replace the existing modules with these new ones to improve the RF range and signal reliability.

I recommend you check out this post where I explain how to create a dockerised RF gateway, reducing on the amount of hardware required to support your home automation setup! Check out this post to read more about the advantages of using docker and microservices in home automation.