All Projects → puuu → Mqtt433gateway

puuu / Mqtt433gateway

Licence: mit
MQTT 433.92 MHz radio-frequency device gateway

Projects that are alternatives of or similar to Mqtt433gateway

Mclighting
The ESP8266 based multi-client lighting gadget
Stars: ✭ 977 (+780.18%)
Mutual labels:  mqtt, esp8266
Pysmartnode
Micropython Smarthome framework
Stars: ✭ 58 (-47.75%)
Mutual labels:  mqtt, esp8266
Hass Yaap
Yet another alarm (control) panel for Home Assistant.
Stars: ✭ 44 (-60.36%)
Mutual labels:  mqtt, esp8266
Mqtt via esp01
TCP/UDP Applicaton for UNO/MEGA/STM32 using ESP8266's AT firmware.
Stars: ✭ 23 (-79.28%)
Mutual labels:  mqtt, esp8266
Hugo Esp8266
Hugo is a 4-button ESP8266 Wi-Fi Remote, Arduino compatible and simple to use.
Stars: ✭ 77 (-30.63%)
Mutual labels:  mqtt, esp8266
Smarthome
SmartHome: firmware per ESP8266 - Casa domotica
Stars: ✭ 28 (-74.77%)
Mutual labels:  mqtt, esp8266
Esp mqtt
MQTT client library for ESP8266
Stars: ✭ 1,047 (+843.24%)
Mutual labels:  mqtt, esp8266
Async Mqtt Client
📶 An Arduino for ESP8266 asynchronous MQTT client implementation
Stars: ✭ 555 (+400%)
Mutual labels:  mqtt, esp8266
Tinygsm
A small Arduino library for GSM modules, that just works
Stars: ✭ 1,186 (+968.47%)
Mutual labels:  mqtt, esp8266
Blinker Library
An IoT Solution,Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.
Stars: ✭ 1,095 (+886.49%)
Mutual labels:  mqtt, esp8266
Esp8266 Anemometer
ESP8266 based wind anemometer project
Stars: ✭ 22 (-80.18%)
Mutual labels:  mqtt, esp8266
Homie Esp8266
💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
Stars: ✭ 1,241 (+1018.02%)
Mutual labels:  mqtt, esp8266
Open Home Automation
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT
Stars: ✭ 820 (+638.74%)
Mutual labels:  mqtt, esp8266
Smarthome
💡 智能电器管理综合系统
Stars: ✭ 33 (-70.27%)
Mutual labels:  mqtt, esp8266
Haswitchplate
LCD touchscreen for Home Automation
Stars: ✭ 666 (+500%)
Mutual labels:  mqtt, esp8266
Wavin Ahc 9000 Mqtt
Esp8266 mqtt interface for Wavin AHC-9000/Jablotron AC-116
Stars: ✭ 47 (-57.66%)
Mutual labels:  mqtt, esp8266
Tdm
GUI application to discover and monitor devices flashed with https://github.com/arendst/Sonoff-Tasmota
Stars: ✭ 385 (+246.85%)
Mutual labels:  mqtt, esp8266
Esp Mqtt Json Digital Leds
(OBSOLETE) ESP8266 MQTT JSON Digital LEDs for Home Assistant
Stars: ✭ 503 (+353.15%)
Mutual labels:  mqtt, esp8266
Mhi Ac Ctrl
Reads and writes data (e.g. power, mode, fan status etc.) from/to a Mitsubishi Heavy Industries (MHI) air conditioner (AC) via SPI controlled by MQTT
Stars: ✭ 64 (-42.34%)
Mutual labels:  mqtt, esp8266
Esp8266 aliyun mqtt app
基于ESP8266官方SDK快速接入阿里云物联网平台
Stars: ✭ 81 (-27.03%)
Mutual labels:  mqtt, esp8266

Build Status

MQTT433gateway

This Project implements a MQTT 433.92MHz radio-frequency device gateway. This is a IoT bridge to couple popular RF devices like RC power-socket switches or weather stations to internet capable devices like smartphone and tables. In this way they can be integrated into a home automation system.

The Software runs on a ESP8266 micro controller/WiFi chip and process many 433.92MHz radio-protocols themselves. The protocols are processed utilizing the ESPiLight Arduino library which is a port of the pilight 433.92MHz protocols to the Arduino platform. The aim is to transmit, receive and parse many 433.92MHz protocols directly on the device and publish the results via MQTT.

A list of supported protocols can be found in the pilight manual: https://manual.pilight.org/protocols/433.92/index.html

Installation

Firmware binary are provided under releases. If you want to build from source please have a look at Development. For the first flash you have multiple possibilities, some of them are:

  • Build and flash with PlatformIO (see Development)
  • Flash with esptool.py
    $ esptool.py --port <serialport> write_flash 0 mqtt433gateway_<env>-<version>.bin
    
  • Flashing the WebUpdater example from Arduino (File -> Examples -> ESP8266HTTPUpdateServer) and uploading the MQTT433gateway binary via browser.

At the moment two binaries are provided:

  • mqtt433gateway_esp12e-*.bin generic ESP8266 module with cpu clock = 80 MHz (recommend)
  • mqtt433gateway_esp12e_160-*.bin generic ESP8266 module with cpu clock = 160 MHz

The platformio.ini provides more environments, but the main different between these are the way how they are flashed via serial connector and how additional components (like LEDs) are connected. Since MQTT433gateway can be fully configured by the web frontend and provided over-the-air programming, these binaries should be sufficient.

Hardware

MQTT433gateway box MQTT433gateway box open

The Software is primarily written for ESP8266 devices. It is tested with an Adafruit HUZZAH ESP8266, but any other ESP8266 board should be fine too. The circuitry can be found in the hardware folder. The circuitry utilizes a separate 5V voltage regulator. This way it is possible to supply the MQTT433gateway with up to 12V. The 434MHz transmitter is directly connected to the power-supply input, thus it can be driven with 12V which enhances the transmitting range. But powering with 12V also means that the voltage regulator dissipates much power and a heat sink is highly recommended.

For transmitting and receiving you need 434MHz-RF modules. More information can be found here:

If you are interested in a good receiving range, then I can not recommend a WRL-10532 module. I only achieved a range of about 5m with it, after changing it against a RXB6 receiver, the range increases to over 30m (including walls).

For the transmitter and receiver module you need separate antennas. 1/4 lambda (17cm) antennas are sufficient, but you may want to try coil loaded antennas.

LED status

The MQTT433gateway indicates its status by a LED:

  • Connecting to WiFi/startup: Flashing at 1 Hz
  • WiFiManager require WiFi configuration: Flashing at 5 Hz
  • Device require configuration: Flashing at 0.5 Hz
  • Normal operation: Heartbeat pulsing
  • OTA Update: on during upload

Configuration

The device is fully configurable through a web browser. If you boot it for the first time, it will create a WiFi access point (default ssid is rf434) where you can connect to. If you type in any url in your browser, you will get directed to the WiFi configuration of the device. You can select your network here and fill in the credentials.

After that it will stop the access point and connect to your network. There you can either discover it via mDNS (default is rf434.local), ask your router for the address of the device or check the serial console output. If you type this address in your browser, you'll see the main configuration frontend. The default username is admin, the default password is MQTT433gateway.

Please fill here your MQTT connection details. You can also change the topics the device will subscribe and publish to. In addition, all hardware related settings, like connection pins of transmitter and receiver are configurable.

Please note: you have to change the configuration password! For security reasons the device will not start working before this password is changed.

MQTT/Automation

The MQTT433gateway communicates via MQTT, therefore a MQTT broker is needed, e.g., Mosquitto. The topics for receiving and transmitting can be configured with the mqttReceiveTopic and mqttSendTopic settings. They default to rf434/recv/ and rf434/send/, respectively. It is possible to use a common topic for multiple gateways in one network and thus to expand the radio range.

After (re)connecting to the MQTT broker, the gateway sends the message {"version":"<git tag or hash>","chipId":"<chipId>"} to the version topic that is set in mqttVersionTopic as well as the message online to the state topic that is set in mqttStateTopic. In addition, it registered with the last will set to the message offline for the state topic. This allows to check the status of the MQTT433gateway, e.g. as a availability topic in Home Assistant.

MQTT subscription is done to the topic <mqttSendTopic><protocol>. The messages to be transmitted must be a valid pilight JSON messages. The setting mqttSendTopic should end with a /. <protocol> is the pilight protocol name. Additionally, <protocol> can be RAW to transmit a RAW signal similar as used with the pilight USB Nano.

Received and decoded RF signals are published in the <mqttReceiveTopic><protocol>[/<id>] topic as pilight JSON message. To avoid receiving errors, a message must be received at least twice before it is published. <protocol> is the pilight protocol name and the optional <id> will be used if the pilight JSON message contains an id attribute.

Integration in Home Assistant

Here are some examples how to integrate the MQTT433gateway into Home Assistant.

Status of the MQTT433gateway:

binary_sensor:
  - platform: mqtt
    state_topic: "rf434/state"
    name: "rf434"
    payload_on: "online"
    payload_off: "offline"
    device_class: connectivity

The message of a TCM 218943 weather station sensor looks like this: rf434/recv/tcm/108 {"id":108,"temperature":22.7,"humidity":50,"battery":1,"button":0}. A corresponding Home Assistant configuration is:

sensor:
  - platform: mqtt
    state_topic: "rf434/recv/tcm/108"
    unit_of_measurement: "°C"
    name: "tcm_a_temp"
    value_template: '{{ value_json.temperature }}'
    device_class: temperature
    availability_topic: "rf434/state"
  - platform: mqtt
    state_topic: "rf434/recv/tcm/108"
    unit_of_measurement: "%"
    name: "tcm_a_humidity"
    value_template: '{{ value_json.humidity }}
    device_class: humidity
    availability_topic: "rf434/state"

binary_sensor:
  - platform: mqtt
    state_topic: "rf434/recv/tcm/108"
    name: "tcm_a_battery"
    sensor_class: power
    payload_on: 0
    payload_off: 1
    value_template: '{{ value_json.battery }}'
    device_class: battery
    availability_topic: "rf434/state"

Impulse RC socket switches, like many RC socket switches with DIP switches:

switch:
  - platform: mqtt
    name: "impuls_24_1"
    command_topic: "rf434/send/impuls"
    payload_on: '{"systemcode":24,"programcode":1,"on":1}'
    payload_off: '{"systemcode":24,"programcode":1,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "impuls_24_2"
    command_topic: "rf434/send/impuls"
    payload_on: '{"systemcode":24,"programcode":2,"on":1}'
    payload_off: '{"systemcode":24,"programcode":2,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "impuls_24_3"
    command_topic: "rf434/send/impuls"
    payload_on: '{"systemcode":24,"programcode":4,"on":1}'
    payload_off: '{"systemcode":24,"programcode":4,"off":1}'
    availability_topic: "rf434/state"

Elro 800 based RC socket switches:

switch:
  - platform: mqtt
    name: "elro800_13_A"
    command_topic: "rf434/send/elro_800_switch"
    payload_on: '{"systemcode":13,"unitcode":1,"on":1}'
    payload_off: '{"systemcode":13,"unitcode":1,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "elro800_13_B"
    command_topic: "rf434/send/elro_800_switch"
    payload_on: '{"systemcode":13,"unitcode":2,"on":1}'
    payload_off: '{"systemcode":13,"unitcode":2,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "elro800_13_C"
    command_topic: "rf434/send/elro_800_switch"
    payload_on: '{"systemcode":13,"unitcode":4,"on":1}'
    payload_off: '{"systemcode":13,"unitcode":4,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "elro800_13_D"
    command_topic: "rf434/send/elro_800_switch"
    payload_on: '{"systemcode":13,"unitcode":8,"on":1}'
    payload_off: '{"systemcode":13,"unitcode":8,"off":1}'
    availability_topic: "rf434/state"

Quigg GT9000 based RC socket switches, e.g., Tevion GT-9000, SilverCrest 91210 or Intertek Unitec 48110:

switch:
  - platform: mqtt
    name: "gt9000_590715_0"
    command_topic: "rf434/send/quigg_gt9000"
    payload_on: '{"id":590715,"unit":0,"on":1}'
    payload_off: '{"id":590715,"unit":0,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "gt9000_590715_2"
    command_topic: "rf434/send/quigg_gt9000"
    payload_on: '{"id":590715,"unit":2,"on":1}'
    payload_off: '{"id":590715,"unit":2,"off":1}'
    availability_topic: "rf434/state"
  - platform: mqtt
    name: "gt9000_590715_3"
    command_topic: "rf434/send/quigg_gt9000"
    payload_on: '{"id":590715,"unit":3,"on":1}'
    payload_off: '{"id":590715,"unit":3,"off":1}'
    availability_topic: "rf434/state"

OTA Update

Updates of the MQTT433gateway can be preformed by OTA (Over-the-air programming) via the web frontend. To do this, you need the binary file that can be found under releases or, if you build with PlatformIO, at <BUILD_DIR>/firmware.bin, e.g. .pio/build/esp12e/firmware.bin.

Debugging/RF-protocol analyzing

The MQTT433gateway has a powerful logging system based on ArduinoSimpleLogging. Messages for different log levels can be logged to serial interface, websocket (web frontend) and syslog server. The configuration can be done via web frontend. The log messages could be very helpful for debugging. In addition, RF-protocol analyzing can be enabled with the protocolRaw debug flag.

Protocol limitation

If you have the situation that there is a lot of noise in the air and/or your device matches multiple protocols, you can limit the available protocols. This is easily possible with via the web frontend.

Development

The software is using the PlatformIO ecosystem. See their install instructions or get their IDE to get the software. More information can be found in their documentation.

  1. Open a terminal and go to the MQTT433Gateway project folder.

  2. After that, decide for which board to create the firmware and give this as --environment to the platformio run command:

    $ platformio run --environment <board>
    

    The available boards are defined in platformio.ini. Currently, this are

    • esp12e for ESP8266-12e/f models,
    • esp12e_160 for ESP8266-12e/f models with cpu clock set to 160MHz,
    • nodemcu for NodeMCU 0.9 boards,
    • nodemcuv2 for NodeMCU 1.0 boards,
    • d1_minifor D1 Mini boards,
    • huzzah for the Huzzah boards.
  3. To flash the firmware to the board, connect the board to the PC via USB or a serial adapter. Make sure, it is the only device currently connected, as otherwise you might flash the wrong unit accidentally. Some boards need to be set manually into a programming mode, please check the manual of the board to get more details about how to do that. The platformio run has the upload target to initialize flashing:

    $ platformio run --environment <board> --target upload
    

    this will try to autodetect the serial port. If this is not successful, try

    $ platformio run --environment <board> --target upload --upload-port <path-to-serial-port>
    

Older versions of MQTT433gateway were developed with the Arduino IDE. You can find the old sources in the departed arduino branch.

Contributions

If you find any bug, please feel free to fill an issue. Also, pull request are welcome. More information can be found in the contributing guide.

Acknowledgement

Big thanks goes to the pilight community, which implemented all the 434MHz protocols. If you want to integrate more protocols, please contribute directly to pilight.

Many thanks goes to @janLo, who developed the web configuration interface.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].