OH2.x + Sonoff/Shely + MQTT + Homie - Next generation firmware and binding options?


Question: As many people have Sonoff / Shely hardware flashed with new firmware supporting MQTT, what are the options to get the best from the very promising MQTT Generic Thing Binding which supports auto-discovery via the Homie HQTT naming convention?

I’d like this post to constructively discuss the cost/ benefit of the high-level options, not to go through individual config issues - there’s several other threads for that aspect, thanks!

My research this far suggests there are at least the following options…

  1. Stick with the MQTT v1.x binding for now
    Minimum change, but no benefits from auto-discovery
    (hint: Enable legacy bindings in Paper UI, and keep your existing broker, config, binding)

  2. Use MQTT v2.x binding with manually defined Bridge, Things and Items, translating existing MQTT config
    Looks posible, no hardware flashing, but the work to create manual config files needs research, and gives no benefits from auto-discovery

  3. Attempt to re-configure Sonoff Tasmota firmware to follow the Homie HQTT naming convention?
    May avoid hardware firmware flashing - just re-config, might gain auto-discovery benefits

  4. Switch from Tasmota to a Homie-based firmware, and manually configure it on Sonoff/ Shely hardware?
    Highest hardware effort with reflashing and significany reconfig, but might give long-term auto-discovery benefits

I’ve not listed the combinations of using an external broker (e.g. Mosquitto) verses the new OH2.0 one, as getting the hardware and binding talking is the interesting bit (I think!).

After getting over the surprise of the amount of change between OpenHAB 2.3 and OpenHAB 2.4, and reading up on the changes, I’m rather impressed with the architectural vision and what it could offer to home automation.

Upgrading from 2.3 to 2.4 changes existing config, leading to a flurry of posts. After some setup effort, I have seen real benefits from the changes.

After re-including Z-Wave Items, Z-Wave seems faster with better device Channel support (Thanks @chris !). I was surprised to see the new v2.x OneWire binding auto-discover all my Things in about two seconds (Thanks Jan N. Klug !). This is impressive as the OneWire v1.x binding took a lot of work to get Items working with config files.

Next on my list was the new MQTT v2.x binding which looked rather complex and full of changes from v1.x. There’s a lot of new documentation, but don’t do as I initially did and jump over the WHY of the changes to try and recreate a v1.x MQTT setup using v2.x! (Hint again: don’t bother - Enable legacy bindings in Paper UI, and keep your existing config)

Here’s a few references to the the ideas behind the MQTT changes which I suggest looking at before upgrading to x2.4.0 so you better understand what is going on:

I have to say that the goal of auto-discovery of home-brew MQTT device Things sounds like black magic after years of editing config files, but the recent flurry of posts to this community shows there’s a real need for it! Thanks @David_Graeff!

Personally - I don’t have all the answers as there are still a few things to fix on my own OpenHABian install, but I’d love to hear what sets of choices you have had success using Sonoff/Shely/ generic ESP8266 devices with OpenHAB 2.0.



One thing to note is Shelly supports Mqtt natively so there is no real need to flash an alternative firmware.

To my knowledge neither Tasmota nor ESP Easy implements Homie, though I think there is an issue filed on both. So to get Homie support I think you will have to roll your own firmware using the Homie esp8266 library.

Were it me, and it will be me in the near future, I would keep the native Shelly firmware configured to use mqtt with the Mqtt 2.4 binding and a generic mqtt thing. At such time that espeasy or Tasmota or one of the other firmwares gets Homie 3.0 support I’d move to them at that time.

If you are just getting started with mqtt and oh, there is no advantage to using the 1.x version binding. Only if you have a lot of mqtt 1.x bound items already and don’t have the time to migrate now, or if you need transformations on messages sent or from oh would I recommend stick with the 1.x version binding.