Page 1 of 2

Z-wave JS UI failed to open serial port

Posted: Wednesday 03 January 2024 18:57
by remko2000
Hai there. I followed:
https://www.domoticz.com/wiki/Zwave-JS-UI to pass form OZW to Zwave JS UI.
I am now ready to open JS UI' s user interface.
I do al the recommended settings but I get the error in Z-wave JS UI:
driver: failed to open the serial port: error : no such file or directory, cannot open /dev/serial/by-id/usb-0658_0200-if00:/dev/zwave (ZW0100)
Schermafbeelding 2024-01-04 om 15.28.52.png
Schermafbeelding 2024-01-04 om 15.28.52.png (305.12 KiB) Viewed 30003 times
In domoticz I get also an error in my log:
2024-01-03 18:47:26.148 Error: MQTT Auto Discovery Client Gateway with LAN interface: Failed to start, return code: 14/Connection refused (Check IP/Port)
Schermafbeelding 2024-01-04 om 15.01.12.png
Schermafbeelding 2024-01-04 om 15.01.12.png (304.72 KiB) Viewed 30009 times
My docker-compose.yml file in root@homebridge:~/mosquitto-docker-compose# looks like this:

Code: Select all

version: "3.7"
services:
  zwave-js-ui:
    container_name: zwave-js-ui
    image: zwavejs/zwave-js-ui:latest
    restart: unless-stopped
    tty: true
    stop_signal: SIGINT
    environment:
      - SESSION_SECRET=mySecretSession
      - TZ=Europe/Amsterdam
    devices:
      - /dev/serial/by-id/usb-0658_0200-if00-port0:/dev/zwave
    volumes:
      - ./store:/usr/src/app/store
    ports:
      - "8091:8091" # port for web interface
      - "3000:3000" # port for Z-Wave JS websocket server
My mosquitto.conf file is:

Code: Select all

listener 1883
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log

## Authentication ##
# By default, Mosquitto >=2.0 allows only authenticated connections. Change to >
allow_anonymous true
# password_file /mosquitto/config/password.txt
The USB address is correct and from my z wave stick aeotec 5 (pluged in). What can be the problem? Do I need to reset de zwavestick?

If I check mosquitto by:

Code: Select all

netstat -na | grep 1883
I get nothing back.

Re: Z-wave JS UI failed to open serial port

Posted: Thursday 04 January 2024 15:46
by remko2000
After many searching, I haven't gotten much further, anyone who can help me so that I can use my zwave devices again?

Re: Z-wave JS UI failed to open serial port

Posted: Thursday 04 January 2024 16:38
by boum
in the field “Serial Port” of your zwave JS (the one on port 8091/#/settings), there you should only put ”/dev/zwave”
the docker compose file tells to map external (out of docker) usb device by ID to internal (where zwave js runs) /dev/zwave

Re: Z-wave JS UI failed to open serial port

Posted: Thursday 04 January 2024 16:44
by boum
also not sure about your MQTT server. It should have its docker compose file in its own directory (if you go that way like described in the wiki).
those are 2 different docker images

Re: Z-wave JS UI failed to open serial port

Posted: Thursday 04 January 2024 22:20
by capitalT
Are you sure your device ID is correct and it is not: usb-0658_0200-if00 (without the port0 part)
My docker-compose.yml file in root@homebridge:~/mosquitto-docker-compose# looks like this:
Is this a typo? Or do you zwave-js and mosquitto in the same directory?

Re: Z-wave JS UI failed to open serial port

Posted: Thursday 04 January 2024 22:32
by solarboy
capitalT wrote: Thursday 04 January 2024 22:20 Are you sure your device ID is correct and it is not: usb-0658_0200-if00 (without the port0 part)
My docker-compose.yml file in root@homebridge:~/mosquitto-docker-compose# looks like this:
Is this a typo? Or do you zwave-js and mosquitto in the same directory?
This seems the right response as I have the same device and in my working zwave-js-ui it is

Code: Select all

/dev/serial/by-id/usb-0658_0200-if00

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 11:13
by remko2000
solarboy wrote: Thursday 04 January 2024 22:32
capitalT wrote: Thursday 04 January 2024 22:20 Are you sure your device ID is correct and it is not: usb-0658_0200-if00 (without the port0 part)
My docker-compose.yml file in root@homebridge:~/mosquitto-docker-compose# looks like this:
Is this a typo? Or do you zwave-js and mosquitto in the same directory?
This seems the right response as I have the same device and in my working zwave-js-ui it is

Code: Select all

/dev/serial/by-id/usb-0658_0200-if00
Tried it and fill ' /dev/serial/by-id/usb-0658_0200-if00' in in the zwave js ui. Still the same error.............

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 11:43
by boum
remko2000 wrote: Friday 05 January 2024 11:13 Tried it and fill ' /dev/serial/by-id/usb-0658_0200-if00' in in the zwave js ui. Still the same error.............

/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave
should be in your docker compose file in the ports section
/dev/zwave should be in you zwave js ui

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 14:03
by remko2000
I' confused:
In my zwave js ui I set '/dev/zwave' :
Image

I also checked my docker-compose.yaml file. The strange thing is that I have two of these docker-compose.yaml files.
One in
map ‘mosquitto-docker-compose’ (root@homebridge:~# mosquitto-docker-compose)

the other in
map ‘zwavejs-ui’ (root@homebridge:/opt/zwavejs-ui#)


They now both contain the same content:

Code: Select all

version: "3.7"
services:
  zwave-js-ui:
    container_name: zwave-js-ui
    image: zwavejs/zwave-js-ui:latest
    restart: unless-stopped
    tty: true
    stop_signal: SIGINT
    environment:
      - SESSION_SECRET=mySecretSession
      - TZ=Europe/Amsterdam
    devices:
      - '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave'
    volumes:
      - ./store:/usr/src/app/store
    ports:
      - "8091:8091" # port for web interface
      - "3000:3000" # port for Z-Wave JS websocket server
However, I still get the same error (even after a reboot). Is it normal I have two of these files or did I make a mistake with the installation? I'm not very proficient in Linux.

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 14:58
by remko2000
boum wrote: Thursday 04 January 2024 16:44 also not sure about your MQTT server. It should have its docker compose file in its own directory (if you go that way like described in the wiki).
those are 2 different docker images
My mosquitto file is in:
root@homebridge:~/mosquitto-docker-compose/config#

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 15:00
by remko2000
capitalT wrote: Thursday 04 January 2024 22:20 Are you sure your device ID is correct and it is not: usb-0658_0200-if00 (without the port0 part)
My docker-compose.yml file in root@homebridge:~/mosquitto-docker-compose# looks like this:
Is this a typo? Or do you zwave-js and mosquitto in the same directory?
the path to mosquitto is:
root@homebridge:~# mosquitto-docker-compose

(in this map: bin docker-compose.override.yml.dist Dockerfile log README.md
config docker-compose.yaml LICENSE Makefile)

the path to zwave js ui is:
root@homebridge:/opt/zwavejs-ui#

(in this map: bin docker-compose.yaml Makefile
config Dockerfile README.md
docker-compose.override.yml LICENSE
docker-compose.override.yml.dist log)

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 15:29
by tjabas
borrow this topic, where do i put the security key from the open zwave configuration?

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 15:47
by remko2000
after many trial and error I tried again:
' docker compose up -d'
after recomposing zwave js ui, I see zwave devices in my control panel:
Image

I think this is ok.
However, the mqt error in domoticz remains:
Error: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

what could I have done wrong when installing mqqt and how could I fix it?

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 15:54
by boum
In your mosquitto directory, the docker compose file should be completely different and should look like
https://github.com/vvatelot/mosquitto-d ... mpose.yaml

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 16:07
by remko2000
The MQTT behavior I experience:
when I enter in my terminal:
cd /opt/mosquitto
make setup project
docker compose up -d

and then:
netstat -na | group 1883

then I get back:
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN
tcp 0 0 172.18.0.1:48468 172.18.0.2:1883 ESTABLISHED
tcp6 0 0 :::1883 :::* LISTEN
tcp6 0 0 ::1:1883 ::1:36644 ESTABLISHED
tcp6 0 0 ::1:36644 ::1:1883 ESTABLISHED

and the error disappears in my domoticz log (however, I don't see any zwave device appearing under devices yet).

After restarting my raspberry, the mqqt communication disappears and I have to repeat the above. I don't think that's the intention. I don't read anything about this in the wiki. Did I do something wrong?

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 16:08
by gizmocuz
No that's not correct. Please follow the (updated) domoticz wiki about migrating to zwavejs.
There the steps are explained correctly how to install mosquitto
After you install it, test with MQTT Explorer to see if you can connect to it
You should enter the IP address of the machine, not localhost !!!
also not 127.0.0.1, but the IP address the of machine (like 192.168.30.40) or the IP address of the mosquitto docker (each docker gets a unique IP address), but you should use the machine's IP address

Re: Z-wave JS UI failed to open serial port

Posted: Friday 05 January 2024 16:36
by remko2000
thx.

step by step........
In domoticz I do use localhost with the mqqt auto discovery hardware.

In zwave-JS UI I have now set the IP of my machine instead of localhost. I am now indeed receiving zwave hardware devices.

But again this only works if I follow these steps from the domoticz wiki:
cd /opt/mosquitto
make setup project
docker compose up -d

After a restart my raspberry I get the same error again:
error: MQTT: Failed to start, return code: 14/Connection refused (Check IP/Port)

After a restart the system loses my mqqt install settings and and my mqtt communication seems to be dropping.

I don't understand any of this. How is this possible?

Re: Z-wave JS UI failed to open serial port

Posted: Saturday 06 January 2024 0:06
by Lebo2d9
Hi,

A friend of me had the same problem. 1st I found that the USB port of the dongle wasn't correctly mapped in the yaml.

After the correction all the Zwave devices where visible in the Z-Wave JS UI controll panel.
But I had still the connection error on the MQTT.
I removed the MQTT docker and installed Mosquito without docker but had still the same problem.
MQTT was working (tested with mosquitto_sub en mosquitto_pub)

I saw that mosquito was listening on 127.0.0.1:1883
I adapted the mosquitto.conf (added listener 1883 and allow_anonymous true)
After the restart of mosquito, mosquito was listening on *:1883 and I didn't had any connecetion errors any more
Spoiler: show
2024-01-05 23:29:53.623 Error: Zwave: Failed to start, return code: 14/Connection refused (Check IP/Port)
2024-01-05 23:30:23.647 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:30:23.647 Error: Zwave: Failed to start, return code: 14/Connection refused (Check IP/Port)
2024-01-05 23:30:53.674 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:30:53.675 Error: Zwave: Failed to start, return code: 14/Connection refused (Check IP/Port)
2024-01-05 23:31:23.702 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:31:23.702 Error: Zwave: Failed to start, return code: 14/Connection refused (Check IP/Port)
2024-01-05 23:31:53.728 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:31:53.729 Error: Zwave: Failed to start, return code: 14/Connection refused (Check IP/Port)
2024-01-05 23:32:23.755 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:32:23.756 Error: Zwave: Failed to start, return code: 14/Connection refused (Check IP/Port)
2024-01-05 23:32:53.781 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:32:53.982 Status: Zwave: connected to: 192.168.20.99:1883
2024-01-05 23:33:46.267 Status: [web:8080] Incoming connection from: 192.168.20.182
2024-01-05 23:35:49.012 Active notification Subsystems: browser (1/13)
2024-01-05 23:36:13.067 Status: Zwave: Worker stopped...
2024-01-05 23:36:19.123 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:36:19.324 Status: Zwave: connected to: 192.168.20.99:1883
2024-01-05 23:46:36.034 Status: Zwave: Worker stopped...
2024-01-05 23:46:37.046 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:46:37.246 Status: Zwave: connected to: 192.168.20.99:1883
2024-01-05 23:48:36.422 Status: Zwave: Worker stopped...
2024-01-05 23:48:42.076 Status: Zwave: Connecting to 192.168.20.99:1883
2024-01-05 23:48:42.277 Status: Zwave: connected to: 192.168.20.99:1883
2024-01-06 00:00:00.564 Sunrise: 08:46:00 SunSet: 16:53:00
2024-01-06 00:00:00.564 Day length: 08:06:00 Sun at south: 12:50:00
2024-01-06 00:00:00.564 Civil twilight start: 08:08:00 Civil twilight end: 17:32:00
2024-01-06 00:00:00.564 Nautical twilight start: 07:25:00 Nautical twilight end: 18:14:00
2024-01-06 00:00:00.564 Astronomical twilight start: 06:45:00 Astronomical twilight end: 18:54:00
2024-01-06 00:00:00.564 Status: EventSystem: reset all events...
2024-01-06 00:00:00.750 Status: Starting automatic database backup procedure...
2024-01-06 00:00:11.814 Status: Ending automatic database backup procedure...
2024-01-06 00:03:24.894 Status: [web:8080] Incoming connection from: 192.168.20.182
I still need to test if all devices are working but this is something for tommorrow

Kind Regards
Koen

Re: Z-wave JS UI failed to open serial port

Posted: Saturday 06 January 2024 4:53
by Xrim
Had the same trouble with Failed to start, return code: 14/Connection refused (Check IP/Port)

I redid everything several times with no luck,BUT!!!

After running

sudo su -
git clone https://github. com/vvatelot/mosquitto-docker-compose /opt/mosquitto
cd /opt/mosquitto
make setup-project
docker compose up -d

I wrote exit and pressed enter, suddenly the installation text appeared and I no longer get the node error in Domoticz.
But I get no new info in the setup and if I reboot my raspberry the problem is back.

Re: Z-wave JS UI failed to open serial port

Posted: Saturday 06 January 2024 8:14
by gizmocuz
You have to type each command line-by-line, do not copy the whole text block
go to the folder where you tried to install mosquitto (/opt/mosquitto) and issue

docker compose down

next remove this folder

next start again to enter all commands step by step

After you issued the 'docker compose up -d' command your mosquitto MQTT broker should be up and running.

First thing to do, test this with 'MQTT Explorer', you should be able to connect to your IP Address on port 1883 (IP address is not localhost or 127.0.0.1 but the IP address of the machine you run this docker on)
When this is working and you can connect, continue to the next step

@Lebo2d9

Sure the docker is listening to 127.0.0.1 as well on the machine you installed it, it also listens on 0.0.0.0:1883
Remember that each docker has it's own private IP address, it does not have the IP address of the machine or has a IP address in the range of your local subnet.
In the yaml file you specify which ports you want to make available on the host system (for example 1883)
So you can now imagine that if you want to connect from one docker to a port from another docker, that you cannot use 127.0.0.1, and you have to use the IP address of the machine