zwavejsui -> mosquitto

For Z-Wave related questions in Domoticz

Moderator: leecollings

Post Reply
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

zwavejsui -> mosquitto

Post by jannl »

Following the message openzwave will be discontinued in the near future I started playing around with Zwave JS UI. In spite of the fact the wiki and zwavejsui documentation is not very clear, I got the docker container running and can connect to port 8091 to get the config.

Zwave seems to be running fine and devices are detected.

As far as I can see I configured MQTT fine. I already use mosquitto for zigbee and my Tosos airco, which work fine.

However, looking at the mosquitto logs, I do not see any zwave devices appearing, so obviously I missed something.

Domoticz version 2022.1, zwavejsui version 8.1.0, because the latest version needs bullseye, which I do not have yet (As far as I know the python plugin is still not compatible).

And tips where to look/what to check?
Searching/googling brought nothing so far.

Jan
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: zwavejsui -> mosquitto

Post by jannl »

I did some more checking, seems mqtt does not start, connection refused at startup.
Not sure yet why, so tips are still welcome. Other services do connect to mosquitto. The difference here is they are not in a docker container.
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: zwavejsui -> mosquitto

Post by FireWizard »

Hello @jannl,

You wrote:
Zwave seems to be running fine and devices are detected.

As far as I can see I configured MQTT fine. I already use mosquitto for zigbee and my Tosos airco, which work fine.

However, looking at the mosquitto logs, I do not see any zwave devices appearing, so obviously I missed something.

Domoticz version 2022.1, zwavejsui version 8.1.0, because the latest version needs bullseye, which I do not have yet (As far as I know the python plugin is still not compatible).
I run zwavejs2mqtt on a separate Raspberry Pi. it is version 7.1.0 and not 8.1.0, so screenshots may slightly differ

You can check the messages in Mosquitto quite easy with MQTT Explorer. (http://mqtt-explorer.com/)

see screenshot below:

Screenshot_MQTT Explorer.png
Screenshot_MQTT Explorer.png (114.97 KiB) Viewed 1756 times
You can check if you see the topics of your Zigbee and Airco.
If so you may assume that Mosquitto is running and is reading the incoming publications.

Next check is to check the ZwaveJS2Mqtt settings.

See the screenshot:

Screenshot_zwavejs2mqtt_panel.png
Screenshot_zwavejs2mqtt_panel.png (20.59 KiB) Viewed 1756 times
Is your Host URL correct? Is the port correct?
If so you should see the topic name, that you inserted under prefix.

And you did not disable MQTT Gateway?

Check this first.

Regards
User avatar
FireWizard
Posts: 1895
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: zwavejsui -> mosquitto

Post by FireWizard »

Oh, I forgot.

You run ZwaveJS2MQTT in a Docker container.
This is not my favorite configuration. But this is probably related to some kind of opening ports between the container and your LAN.
Port 1883?
jannl
Posts: 673
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: zwavejsui -> mosquitto

Post by jannl »

Hi, thx for the answer.

I just found out the answer, if you run from within a docker container and want to reach a service outside by ip, you have to use the actual ip of the pi instead of localhost.

So basically the question is answered.

Jan
solarboy
Posts: 345
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: zwavejsui -> mosquitto

Post by solarboy »

I am running mosquitto, zwavejsui and zigbee2mqtt in containers, and Domoticz runs on the host. Domoticz can access Mosquitto with "localhost:1883" but zwavejsui and zigbee2mqtt can only access using the hosts external IP (192.168.2.9). When I reboot my router MQTT stops working between the containers.

I would like to keep all the networking within the pi/docker without relying on any local network devices (eg.localhost) but I cannot seem to get this working. I have tried using the name of the mosquitto container (for me it is "eclipse-mosquitto") in both zigbee2mqtt and zwavejsui but this doesn't connect. I also tried adding "network=host" to my docker compose files but this didn't work either. I was under the impression Docker automatically added the containers to a bridge network and I just need to refer to the containers by name.

I was wondering if anyone has a similar set up and has managed to get the containers talking to each other with MQTT.

Mosquitto docker-compose file

Code: Select all

version: "3"

services:
  mosquitto:
    image: eclipse-mosquitto
    volumes:
      - ./:/mosquitto/:rw
    ports:
      - 1883:1883
      - 9001:9001
    restart: always
ZwavejsUI docker compose file

Code: Select all

version: '3.7'
services:
  zwave-js-ui:
    container_name: zwave-js-ui
    image: zwavejs/zwave-js-ui:latest
    restart: always
    tty: true
    stop_signal: SIGINT
    environment:
      - SESSION_SECRET=mysupersecretkey
      - ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
      # Uncomment if you want logs time and dates to match your timezone instead of UTC
      # Available at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      - TZ=Europe/Lisbon
    networks:
      - zwave
    devices:
      # Do not use /dev/ttyUSBX serial devices, as those mappings can change over time.
      # Instead, use the /dev/serial/by-id/X serial device for your Z-Wave stick.
      - '/dev/serial/by-id/usb-0658_0200-if00'
      
      #- '/dev/serial/by-id/insert_stick_reference_here:/dev/zwave'
    volumes:
      #- zwave-config:/usr/src/app/store
      - ./store:/usr/src/app/store
    ports:
      - '8091:8091' # port for web interface
      - '3000:3000' # port for Z-Wave JS websocket server
networks:
  zwave:
volumes:
  zwave-config:
    name: zwave-config
zigbee2mqtt docker compose file

Code: Select all

version: '3.8'
services:
  zigbee2mqtt:
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      - ./data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 8085:8085
    environment:
      - TZ=Europe/Lisbon
    devices:
      # Make sure this matched your adapter location
      - /dev/serial/by-id/usb-Silicon_Labs_slae.sh_cc2652rb_stick_-_slaesh_s_iot_stuff_00_12_4B_00_22_98_90_8F-if00-port0
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),SMA Hub (docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
User avatar
waltervl
Posts: 5859
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: zwavejsui -> mosquitto

Post by waltervl »

Did you try the

Code: Select all

--add-host host.docker.internal:host-gateway 
flag as described here https://www.howtogeek.com/devops/how-to ... container/
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
ferrosk
Posts: 44
Joined: Saturday 26 August 2017 20:13
Target OS: Linux
Domoticz version: 2023.2
Contact:

Re: zwavejsui -> mosquitto

Post by ferrosk »

Hello,

for using host mode, update your docker compose files with:

add:

Code: Select all

...
services:
  <service-name>:
    ...
    network_mode: host
    ...
and remove

Code: Select all

    ...
    networks:
      - <network>
    ...
    ports:
      - '<port>:<port>'
     ...
Domoticz 2023.2 on Odroid M1 and Armbian
MySensors (RFM69 Serial GW): bunch of DIY sensors/devices
Zwave (Z-Wave.me RaZberry board): Danfoss devices
Zigbee (Sonoff Dongle Plus): IKEA, Tesla devices
solarboy
Posts: 345
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: zwavejsui -> mosquitto

Post by solarboy »

Thanks for your help. I ended up doing a bit of both solutions, I added to my docker-compose.yaml

Code: Select all

extra_hosts:
  - "host.docker.internal:host-gateway"
The indenting was quite important.

Once I did this I could change my MQTT server settings to "host.docker.internal:1883" and successfully connected.

Should be noted this only works on Docker Engine 20 and above, after updating my distro to buster a couple of years ago, my docker repository was still set to "stretch" so I had to edit my etc/apt/sources.list.d/docker.list to "buster" after which I could upgrade and the solution worked.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),SMA Hub (docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest