Smart Home 433Mhz RF <-> MQTT Gateway with Some Extras
The MQTT-433mhz-gateway-homie project is a simple bidirectional gateway to transmit and receive 433Mhz RF signals connected to MQTT. The gateway is built with a cost-effective ESP8266 WiFi chip (I used a Wemos D1 mini, NodeMCU will do as well), simple 433Mhz RF modules and an additional BMP085 sensor.
It enables you to:
- receive MQTT data from a topic and send the 433Mhz signal.
- receive 433Mhz signal from a traditional remote, optional map it to a channel and publish the data to a MQTT topic.
- additionally, a simple temperature sensor can record the room temperature of the room where the gateway is installed.
The final assembly looks like this:
- ESP8266 (Wemos D1 mini, Nodemcu)
- RF Receiver 433Mhz
- RF Transmitter 433MHz
- BMP085 or BMP180 sensor breakout
The circuit inside the enclosure box:
Building the circuit
The wireing of the gateway project is very easy. The sensor, the transmitter and the receiver must be connected to VIN & GND and the GPIO pins of the ESP8266 board as shown in the table below.
|Wemos D1 mini||BMP085||RF Receiver||RF Transmitter|
The following software libraries are used. When using PlatformIO all dependencies are resolved automatically.
- Homie V2 (dev) including dependencies
- Adafruit BMP085 Unified
- Adafruit Unified Sensor
- Optionally PlatformIO environment for building the code
For detailed documentation of the MQTT topics and commands used see Homie documentation.
Sample gateway messages:
# sensor temperature reading homie/mqtt-gateway-livingroom/temperature/degrees 23.70
Temperature value send from device.
# send RF command via MQTT & response homie/mqtt-gateway-livingroom/MQTTto433/on/set 1394001 homie/mqtt-gateway-livingroom/MQTTto433/on 1394001
First line: MQTT command send from MQTT client or smart home solution. Translates into the code send by the RF transmitter. Second line: Response from a device after the RF signal was transmitted.
The following config parameters are available via MQTT message (see Homie documentation how to use):
|temperatureInterval||long||temperature reading interval in seconds|
|temperatureOffset||double||temperature offset (-/+) to correct the sensor reading, for example if used in enclosure box|
|channels||const char*||mapping of 433MHz signals to mqtt channels, useful if used with OpenHab|
All configs can be set during the init procedure of the module or via MQTT messages (see Homie specification).
This project is was inspired by 1 Technophile's 433toMQTTto433 solution.