[RELEASE] Sonoff (Tasmota) Intergration via MQTT

Introducing Sonoff (Tasmota) Integration via MQTT:

Those device handlers allow users integrating Sonoff devices into HE through a MQTT broker.


  • Support single or multiple relays devices
  • Auto device integration
  • Device's manual switch synchronization
  • Support stock Sonoff (Tasmota) firmware


  1. Setup a MQTT broker. I installed mosquitto (https://mosquitto.org/) on openwrt router via opkg installer. Quite easy to setup.
  2. Enable MQTT on Sonoff devices (GitHub - arendst/Tasmota: Alternative firmware for ESP8266 with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at). Besides IP settings points the MQTT broker, one critical setting is "Topic", it should be set to "sonoff__". Where is the supported device type, currently, it should be either "sw" for single relay devices or "msw" for multi-relays devices. is mac address of the device without ":". An example of topic is sonoff_msw_8899AABBCCDD, this is a multi-relay device, and its mac address is 88:99:AA:BB:CC:DD
  3. Import three device codes from dh · master · H Yi / he_sonoff_mqtt · GitLab
  4. Add virtual device and set "type" to "HE Sonoff Mqtt Master DH"
  5. In Preferences of newly added virtual device, set MQTT Broker IP Address to the broker server
  6. Restart or power-cycle sonoff device.
  7. After the sonoff device boots up, it should show up as a child device of the manually added virtual device. Its name set to MACADDR, feel free to change to a friendly name. Now the device should work with HE. Please note if the sonoff device is a multi-relay one, Each relay is shown up as a child device of the sonoff device, i.e. they are the grandchild devices of the manually added virtual device.

My tests were based upon Tasmota release 6.5. If you encounter any issue, please report back.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.