MQTT device discovery not working after migration to OH 5.1?

Hello,

I’ve got a really odd problem with the MQTT binding in OH =5.1 with the device discovery after migrating from OH4.3.8 on RP 32bit to OH5.1 on RP 64 bit, so a complete reinstall. I also copied the OH backup from 4.3.8 onto 5.1. I have reinstalled MQTT, ZWave-JS-UI (831), Zigbee2MQTT. ZWave and Zigbee run file, the network is up, I can spy on MQTT and see the traffic.

My problem is with getting the Openhab MQTT binding to work and discover the Zwave and Zigbee devices:

All my MQTT devices were in state “missing handler” when OH 5.1 came up the first time. I read in the OH 5 release notes that the MQTT things need to be recreated if the discovery results are too old, so I deleted all of them. I uninstalled the MQTT binding, stopped OH, cleaned the OH cache using the command line tool, restarted it (twice, first time I always see tons of errors). After the restart of OH I installed the MQTT binding again, created the MQTT bridge thing and connected it to MQTT (user/pass, IP, port,…). But the OH does not discover any of the Zwave or Zigbee things using MQTT HomeAssistent discovery as it used to with 4.x ?

I checked:

  • in both system the Zwave and Zigbee HomeAssistent discovery is enabled.
  • I have discovered a new Zwave device (in case the Zwave discovery message of old devices are lost somehow). In OH 5.0 the new device is not discovered as a MQTT thing, booting into OH 4.3.8 I immediately get the new device as a MQTT thing discovered.
  • I tried to play with the MQTT bridge settings, no change

I ran out of ideas on how to fix this. Any hint what I might be missing ?

Many thanks in advance, Markus

Please read the breaking changes section of the release notes:

Home Assistant Binding
  • The binding has been split from the main MQTT binding, and will not be auto-installed. If you use this binding, it will need to be manually re-installed. You may also need to re-configure the binding if discovery settings have been customized.

Did you run the upgrade script after?

Did you install the HomeAssistant add-on? It’s a separate binding now and no longer comes with the MQTT binding. It must be separately installed.

If you ran the upgrade script and had at least one HomeAssistant Thing, it would have installed the add-on for you.

See, I missed something simple, I didn’t run the upgrade script, no. Investigating…

managed to get it going, but it was more rocky and still is, than I hoped:

- I restored my OH4.3.8 backup and all the *.item, *.rules and *.persist files that I had modified by hand already

- I found out that the command was:

$ sudo java -jar $OPENHAB_RUNTIME/bin/upgradetool.jar --userdata /var/lib/openhab --conf /etc/openhab/ --command homeAssistantAddonUpgrader

(I think the docs here: [https://www.openhab.org/docs/installation/](https://www.openhab.org/docs/installation/) should be fixed, they don’t give the path and the command is wrong)

- After a cleaning of the OH cache and 2 restarts (first gave errors as usual) the MQTT things came ONLINE.

- The HomeAssistent binding recreated all the discovery results, I thought they were duplicated and deleted them (not a good idea as it turns out)

- I realised the UIDs of the channels have changed with the HomeAssistent add-on, so I deleted my old things.

- A scan using the HomeAssistent binding only found ZWave devices and NO Zigbee devices, a restart fixed that

- I fixed all my *.item files for the syntax changes

- "mqtt:homeassistant" prefix became "homeassistant:device"

- Several of the Zigbee channel names have changed

- I still have 21 orphan links, some is linked to changes in Zigbee2MQTT it seems, others look like channels not supported anymore in the new HomeAssistent add-on that were supported in 4.3.8

(I noticed that I had to restart to remove some already fixed links from the orphan link list, possible that is a bug)

I will continue to investigate my orphan links tomorrow. Otherwise it seems my system is now mostly working. Thanks for your help.

Best, Markus

The binding works with both the old IDs and the new so that probably wasn’t necessary.