Page 1 of 1

Zwavejs-UI Auto discovery works - But data is stale?

Posted: Saturday 27 January 2024 13:47
by Thermojito
Following the Wiki: https://www.domoticz.com/wiki/Zwave-JS-UI I can now see (MQTT autodiscover) zwave devices in Domoticz and I can successfully change (physical) switch status directly through Zwavejs-UI control-panel, BUT changes in switch status and sensor measurements are not propagated to Domoticz and changing switch position from Domoticz does propagate the other way to Zwave-JS-UI and the physical Zwave device.

I suspect that I've not had (and probably still doesn't have) correct settings in Zwave-Js-UI.

I have noted that I initially used the same text ("zwavejsAD") as MQTT-prefix in Zwavejs-UI AND as the "Zwavejs-UI - Home assistant - Discovery prefix" and the Domoticz-Hardware-Auto Discovery prefix which I've now understood is not correct, but separating the first from the other two did not solve the problem.

What is wrong with the enclosed settings:
zwavejsUI MQTT.JPG
zwavejsUI MQTT.JPG (33.97 KiB) Viewed 1410 times
zwavejsUI Gateway.JPG
zwavejsUI Gateway.JPG (38.27 KiB) Viewed 1410 times
zwavejsUI Home Assistant.JPG
zwavejsUI Home Assistant.JPG (51.33 KiB) Viewed 1410 times

Re: Zwavejs-UI Auto discovery works - But data is stale?

Posted: Saturday 27 January 2024 13:53
by Thermojito
I can add that these are the Domoticz settings:
Domoticz Hardware.JPG
Domoticz Hardware.JPG (33.49 KiB) Viewed 1408 times
And this is how the MQTT looks from MQTT-Explorer where I expected the red marked data to change when either the Zwavejs-UI or Domoticz device switch position or physical sensor data is changed:
MQTT Explorer.JPG
MQTT Explorer.JPG (106.12 KiB) Viewed 1408 times
I'm using:
Raspberry pi4
Domoticz 2024.3 on host
MQTT and zwaveJS-UI in separate docker containers

Re: Zwavejs-UI Auto discovery works - But data is stale?

Posted: Saturday 27 January 2024 16:00
by gizmocuz
When using MQTT Explorer, do you see the topic/tree zwavejsAD ?
You should see topics with the names like

zwavejsAD/switch/xx/yy/config
zwavejsAD/light/xx/yy/config
....

But in your screenshot below, it seems i see zwave nodes with status here.

Which is odd, as in your first screenshot your prefix is been set to 'zwave'

What I suggest because you 'had' the same topic name as prefix and MQTT-AD, stop zwavejs2mqtt

Use MQTT explorer to delete the zwavejsAD (and if you have also zwave) tree, so your broker is clean

Next launch zwavejs again, you should now get 2 tree items

Re: Zwavejs-UI Auto discovery works - But data is stale?

Posted: Saturday 27 January 2024 19:02
by Thermojito
Thanks Gizmocuz!
Sounds reasonable. Will try that but it will take me a few days before I get a chance to try.

Re: Zwavejs-UI Auto discovery works - But data is stale?

Posted: Sunday 04 February 2024 16:49
by Thermojito
I've now tried, but cleaning the MQTT broker did not solve the complete problem as the broker stayed completely empty after reactivating zwavejs. (except $SYS and zwavejsAD/status=online after reboot of the complete system)

After enabling and analyzing logs and reading and learning more about MQTT and websockets I've found the missing piece:

Zwavejs-UI was not able to communicate with the MQTT broker but Domoticz were. The reason was that the Port in Zwavejs-UI-Settings-MQTT must be 1883 and not 3000 (that I think was default from installation??) and is the only port mentioned as opened in the zwavejs-UI container defined by the proposed docker-compose.yml file in addition to the web-UI port (which prevented me from suspecting this as an error from the beginning):
ports:
- "8091:8091" # port for web interface
- "3000:3000" # port for Z-Wave JS websocket server

I must have tried to change the port from 3000 to 1883 temporarily while still not having the MQTT-topic different from the Autodiscovery topic, that's the only explanation I have for the "half-filled" MQTT broker shown in the beginning of the thread missing the zwave topic.

Stupid error by me, I admit, but to make the installation process of zwavejs-UI to Domoticz more idiot proof I would suggest that the complete zwavejs-UI MQTT settings were shown in the excellent wiki-page: https://www.domoticz.com/wiki/Zwave-JS-UI like this:
zwavejsUI MQTT OK.JPG
zwavejsUI MQTT OK.JPG (37.78 KiB) Viewed 1214 times