Page 1 of 1

Zigbee2mqtt plugin don't work with z2m new api

Posted: Thursday 26 May 2022 21:22
by saper2
Hi,

Either I just got a problem (like it's always only me :lol: ), or there is a really problem with latest zigbee2mqtt (1.25.1) and latest domoticz plugin (3.1.0-beta).

So... yesterday (or day before :P ) I switched to new z2m (I have it now running in docker (already :D ) and in my main server; also there is new coordinator on CC2652P 8-) :twisted: ). With this I also decided to update domoticz too (I've been running still on early 2021 version :P ), so I bumped up domoticz to latest version too (from github, compiled by myself).
Next, came z2m plugin to update too, so, I grabbed z2m from git too...

Domoticz :arrow: working fine.
Z2M and it's new web-interface works fine (and looks nice at least for me), I repaired all devices to new coordinator without much problems too.

So, now I have:
Domoticz version: 2022.1 (build 14341) ; Build Hash: d479d6cb8 ; Compile Date: 2022-05-23 01:01:38
Zigbee2MQTT version: 1.25.1 , commit: 3f6a137
Z2M-dmoticz-plugin version: 3.1.0-beta (commit: 3ca1419 from 2022-04-30 17:33 CEST)


And I got problems :( - plugin for domoticz won't load devices tab (and other tabs too, just keep displaying "loading..." )...

So, I did a bit digging, and I came to conclusion that folks in z2m changed API (so much) - they removed some methods, changed other things - so the z2m plugin don't work anymore :( .


So far I noticed changes:
  1. z2m plugin use topic to get devices list

    Code: Select all

    bridge/devices/get
    , but now z2m don't support at all populating device list on request.
    Now z2m creates topic

    Code: Select all

    bridge/devices
    with retained flag, and it have now device list in zigbee network.
    Publishing to bridge/devices/get causes mqtt-broker to drop "retained" flag on bridge/devices :( - which is problematic because this topic won't be pushed to any new mqtt-client who connect to the broker and want to listen to zigbee2mqtt topics
  2. z2m status is now changed to json format - no plain text, so the topic

    Code: Select all

    bridge/status
    now have json data

    Code: Select all

    {"status":"online"}
    this throw an error in plugin.py:

    Code: Select all

    Error: Zigbee2MQTT: TypeError: can only concatenate str (not "dict") to str**
    . There is suggested fix for this on github already (in issues).

Or maybe I'm just "stupid" :mrgreen: , and I don't have something enabled in cofing in z2m :?:

Re: Zigbee2mqtt plugin don't work with z2m new api

Posted: Sunday 05 June 2022 17:24
by Derik
quit with the plugin. Change to hardcored z2m in Domoticz
One time learn all new devices

Then never the plugin needed..

Re: Zigbee2mqtt plugin don't work with z2m new api

Posted: Sunday 05 June 2022 21:13
by acaonweb
Derik wrote: Sunday 05 June 2022 17:24 quit with the plugin. Change to hardcored z2m in Domoticz
One time learn all new devices

Then never the plugin needed..
What do you mean?

Re: Zigbee2mqtt plugin don't work with z2m new api

Posted: Sunday 05 June 2022 21:17
by acaonweb
saper2 wrote: Thursday 26 May 2022 21:22 Hi,

Either I just got a problem (like it's always only me :lol: ), or there is a really problem with latest zigbee2mqtt (1.25.1) and latest domoticz plugin (3.1.0-beta).

So... yesterday (or day before :P ) I switched to new z2m (I have it now running in docker (already :D ) and in my main server; also there is new coordinator on CC2652P 8-) :twisted: ). With this I also decided to update domoticz too (I've been running still on early 2021 version :P ), so I bumped up domoticz to latest version too (from github, compiled by myself).
Next, came z2m plugin to update too, so, I grabbed z2m from git too...

Domoticz :arrow: working fine.
Z2M and it's new web-interface works fine (and looks nice at least for me), I repaired all devices to new coordinator without much problems too.

So, now I have:
Domoticz version: 2022.1 (build 14341) ; Build Hash: d479d6cb8 ; Compile Date: 2022-05-23 01:01:38
Zigbee2MQTT version: 1.25.1 , commit: 3f6a137
Z2M-dmoticz-plugin version: 3.1.0-beta (commit: 3ca1419 from 2022-04-30 17:33 CEST)


And I got problems :( - plugin for domoticz won't load devices tab (and other tabs too, just keep displaying "loading..." )...

So, I did a bit digging, and I came to conclusion that folks in z2m changed API (so much) - they removed some methods, changed other things - so the z2m plugin don't work anymore :( .


So far I noticed changes:
  1. z2m plugin use topic to get devices list

    Code: Select all

    bridge/devices/get
    , but now z2m don't support at all populating device list on request.
    Now z2m creates topic

    Code: Select all

    bridge/devices
    with retained flag, and it have now device list in zigbee network.
    Publishing to bridge/devices/get causes mqtt-broker to drop "retained" flag on bridge/devices :( - which is problematic because this topic won't be pushed to any new mqtt-client who connect to the broker and want to listen to zigbee2mqtt topics
  2. z2m status is now changed to json format - no plain text, so the topic

    Code: Select all

    bridge/status
    now have json data

    Code: Select all

    {"status":"online"}
    this throw an error in plugin.py:

    Code: Select all

    Error: Zigbee2MQTT: TypeError: can only concatenate str (not "dict") to str**
    . There is suggested fix for this on github already (in issues).

Or maybe I'm just "stupid" :mrgreen: , and I don't have something enabled in cofing in z2m :?:
Well, maybe I didn't understand your problem but zigbee2mqtt 3.1.0-beta works fine, I've installed using plugin manager.
Schermata 2022-06-05 alle 21.14.50.png
Schermata 2022-06-05 alle 21.14.50.png (283.66 KiB) Viewed 980 times

Re: Zigbee2mqtt plugin don't work with z2m new api

Posted: Sunday 05 June 2022 22:39
by Derik
acaonweb wrote: Sunday 05 June 2022 21:13
Derik wrote: Sunday 05 June 2022 17:24 quit with the plugin. Change to hardcored z2m in Domoticz
One time learn all new devices

Then never the plugin needed..
What do you mean?
Look at hardware there you can add z2m with the homeassitent trick . Google

Re: Zigbee2mqtt plugin don't work with z2m new api

Posted: Saturday 18 June 2022 14:54
by saper2
Hello,

Yeah... It is like it always me only :oops:
The problem (I had) was that: I did not added device api_transport like it is mentioned in installation steps on github repo (this was added in commit from 2021-12-25) - because I have already installed plugin, so I did not even bother read README.md (again), I just run only git pull and that it (so I thought :oops: )
Yesterday - today ;) , I made db-copy, and I deleted whole z2m plugin and everything related to it. Then I looked on Installation points in z2m repo and I got enlightened 8-)


I am so soooooooryyy :) :oops:

Derik wrote: Sunday 05 June 2022 22:39 Look at hardware there you can add z2m with the homeassitent trick . Google
Could you elaborate? I did tried google it (I found it interesting), but what I found was just "poop" (like blogs/books/etc.. comparing Domo vs HASS, set-up domo or ha... ).
I have HA too (and I have few automations that take from domoticz/out topic ,and re-publish those in different topics that are split by sensor idx). I love the plots of sensors from Domoticz - HA have crappy plots, and toying with grafana I found annoying...

Re: Zigbee2mqtt plugin don't work with z2m new api

Posted: Saturday 18 June 2022 15:31
by sammyke007
I think he means the "MQTT Auto Discovery Client Gateway with LAN interface" hardware. This auto discovers everything with the autodiscovery prefix "homeassistant" by default from MQTT and creates devices for it without the need of a plugin. It handles some devices different however. A button for example is created by the plugin as a selector device, but with the "MQTT Auto Discovery Client Gateway with LAN interface" it creates different devices for single press, double press, ... Just try it out and disable the hardware if you don't like it.