Page 11 of 11

Re: Fixing Z-Wave for once and for all!

Posted: Wednesday 01 December 2021 14:00
by Ragdag
hestia wrote: Wednesday 01 December 2021 13:50 port and address are those for the mqtt broker, not the ws server
1883 and localhost for me
I thought I understood, but there is still a missing gap :D
If I run this Docker image (https://github.com/zwave-js/zwavejs2mqtt) on the RPI would I need to also install the broker separately?
So do I need anything else beside Domoticz and zwavejs2mqtt.

Re: Fixing Z-Wave for once and for all!

Posted: Wednesday 01 December 2021 14:06
by heggink
You do need a mosquitto broker indeed. Also, if you run that on the same system as the zwavejs2mqtt docker, do not use localhost in the docker container as localhost IS the docker container, not the host machine! Put in the hostname or IP for the host machine!
So both domoticz and zwavejs need the hostname/IP and port (default 1883) of the mqtt broker.

Re: Fixing Z-Wave for once and for all!

Posted: Wednesday 01 December 2021 14:38
by Ragdag
Thanks, figured that part out as well and created a docker-compose for Mosquitto

Code: Select all

version: '3'
services:
  mosquitto:
    container_name: mosquitto
    image: eclipse-mosquitto:latest
    restart: always
    deploy:
      resources:
        limits:
          memory: 125M
    ports:
       - "1883:1883"
       - "9001:9001"
    volumes:
      - ./config/mosquitto.conf:/mosquitto/config/mosquitto.conf
      - ./data:/mosquitto/data
      - ./log:/mosquitto/log
one for zwavejs2mqtt

Code: Select all

version: '3.7'
services:
  zwavejs2mqtt:
    container_name: zwavejs2mqtt
    image: zwavejs/zwavejs2mqtt: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/Amsterdam
    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/zwave'
    volumes:
      - zwave-config:/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
Now it works with my test wall plug
Image

So far so good, will start some testing and see how it goes.
Thanks for the help and patience, it's a lot to process if this is the first time dipping your toes in Docker, MQTT and zwavejs2mqtt :oops:

Re: Fixing Z-Wave for once and for all!

Posted: Wednesday 01 December 2021 14:44
by heggink
That's understandable but once you get used to the docker approach, you don't go back!

I have been on zwavejs2mqtt and domoticz autodiscovery for nearly a month now and am very happy with the stability and flexibility.

My zwave stick is the aeotec gen5 which, on a pi4, suffers from the reboot problem (the old gen5 didn't follow the usb specs very well and the pi4 is more strict than the 3). That causes me to have to use a usb hub which then triggers the occasional disconnect. Now I can simply write a udev rule to restart the container on a connect. Works like a champ.

Sent from my SM-G980F using Tapatalk


Re: Fixing Z-Wave for once and for all!

Posted: Wednesday 01 December 2021 14:56
by Ragdag
Not sure if I should continue all my questions here or if I should start a new thread.

It appears all devices from the discovered node are added automatically to the Domoticz dashboard.
Image
Is there a way to disable that?

Other thing I see is that I can switch the wall plug on and off from Domoticz but changing the state on the plug physically is not reflected in Domoticz. It stays as off.
I do see it flip over in zwavejs2mqtt
Image

Also see it flipping in Mosquitto
Image

Re: Fixing Z-Wave for once and for all!

Posted: Wednesday 01 December 2021 15:03
by heggink
There was a discussion regarding automatic addition of devices on Slack and this behaviour is by design indeed.
In terms of states not being updated correctly, this can be a bug in domoticz not handling the response message correctly. Best to go onto slack (pm me your email address and I will send you an invitation) and provide the autodiscovery topic/message as well as the response message. If you install mqtt explorer, you can easily find them.

Re: Fixing Z-Wave for once and for all!

Posted: Thursday 02 December 2021 9:33
by Gravityz
i am running domoticz in docker(indeed very pleased) but still use the native zwave devices.
my setup is very stable.
the only problem i have had is that power consumption devices were not stable.
as a result you could se the power go off/on while in reality the device was constant on.

i solved this by using compute on every power/energy device
the problem with zwave is that it generates a lot of devices which apparently doe the same(but in reality do not)

question regarding moving to MQTT

do you replace the old devices with the new devices once you are convinced everything is stable. that way you keep the hisory of those devices

Re: Fixing Z-Wave for once and for all!

Posted: Thursday 02 December 2021 10:19
by heggink
It's doable but a bit tricky since you cannot have your controller connected to both ozw and zwavejs at the same time.

What you can do is to disable ozw, start jwavejs, user autodiscovery such that it creates devices. Once you have those, you can switch the ozw history over but you would need to reenable ozw for that.

As said, it's doable but takes a bit of fiddling and switching backwards and forwards...

Sent from my SM-G980F using Tapatalk


Re: Fixing Z-Wave for once and for all!

Posted: Friday 04 February 2022 1:16
by solarboy
heggink wrote: Thursday 02 December 2021 10:19 It's doable but a bit tricky since you cannot have your controller connected to both ozw and zwavejs at the same time.

What you can do is to disable ozw, start jwavejs, user autodiscovery such that it creates devices. Once you have those, you can switch the ozw history over but you would need to reenable ozw for that.

As said, it's doable but takes a bit of fiddling and switching backwards and forwards...

Sent from my SM-G980F using Tapatalk
I have managed to do this by changing the USB device for OZW to something that won't work but without disabling the OZW hardware device, this way the devices stay in the device list. Then you can start/install zwavejs2mqtt (best to name the devices there before connecting to MQTT) and let the devices populate in Domoticz, Once they are all there you can "replace" which can save a LOT of time. Some devices won't replace though, I noticed a few RGB devices are presented slightly differently but simple switches etc are fine.

Re: Fixing Z-Wave for once and for all!

Posted: Friday 04 February 2022 9:24
by mgugu
solarboy wrote: Friday 04 February 2022 1:16
heggink wrote: Thursday 02 December 2021 10:19 It's doable but a bit tricky since you cannot have your controller connected to both ozw and zwavejs at the same time.

What you can do is to disable ozw, start jwavejs, user autodiscovery such that it creates devices. Once you have those, you can switch the ozw history over but you would need to reenable ozw for that.

As said, it's doable but takes a bit of fiddling and switching backwards and forwards...

Sent from my SM-G980F using Tapatalk
I have managed to do this by changing the USB device for OZW to something that won't work but without disabling the OZW hardware device, this way the devices stay in the device list. Then you can start/install zwavejs2mqtt (best to name the devices there before connecting to MQTT) and let the devices populate in Domoticz, Once they are all there you can "replace" which can save a LOT of time. Some devices won't replace though, I noticed a few RGB devices are presented slightly differently but simple switches etc are fine.
Excellent idea, that can save a lot of time when switching

Re: Fixing Z-Wave for once and for all!

Posted: Friday 04 February 2022 9:32
by heggink
Agreed! Great suggestion! Should be in a kind of transition wiki...

Sent from my SM-G980F using Tapatalk


Re: Fixing Z-Wave for once and for all!

Posted: Friday 04 February 2022 10:49
by waltervl
heggink wrote: Friday 04 February 2022 9:32 Agreed! Great suggestion! Should be in a kind of transition wiki...

Sent from my SM-G980F using Tapatalk
There already is a transition wiki: https://www.domoticz.com/wiki/ZwaveJS2M ... _OpenZwave
You are free to add this information :-)

Edit: But reading it it is already there. Disabling the OCW hardware (instead of delete) should also have the old devices visible to be replaced. After that you can remove the OZW hardware, resulting in removing all old left over devices.

Re: Fixing Z-Wave for once and for all!

Posted: Saturday 05 February 2022 13:27
by barry44
Hello

With the new stable version, I'm planning to migrate from ozw to zwavejs2mqtt. I've about 50 zwave used devices (and 130 not used).
I've juste read the "tip and trick" to disable ozw hardware, to get the old devices visible, and then replace one by one.

It will be long, but not impossible ^^. But I'm wondering what will happen with scripts.

I have a lot of script (lua/blockly/dzVents). With the replace method, we have a new device, with a new name and a new id.
So If I do nothing more, they will be broken.

If after replacing the device, I rename the new device with the old name, will it be enough for the script to work ?
With ID, I'm sure not. The ID is still diffrent
With named device and dzEvents/lua, I think it will be ok. Is it correct ?
With named device and blockly, no idea...

Any idea of other actions to prepare ?

Thank you for your ideas

Re: Fixing Z-Wave for once and for all!

Posted: Saturday 05 February 2022 13:52
by waltervl
In stable after replace the new device will get the name and idx of the old device resulting in no changes for your scripts.

Re: Fixing Z-Wave for once and for all!

Posted: Sunday 06 February 2022 9:47
by barry44
Ohhh, great news

Thank you :)

Re: Fixing Z-Wave for once and for all!

Posted: Thursday 24 March 2022 8:54
by Olgmo
Ragdag wrote: Wednesday 01 December 2021 14:38 Thanks, figured that part out as well and created a docker-compose for Mosquitto

So far so good, will start some testing and see how it goes.
Thanks for the help and patience, it's a lot to process if this is the first time dipping your toes in Docker, MQTT and zwavejs2mqtt :oops:
Thank you for your post.
I am running the same in Docker, but I could not get mosquitto:latest to work, I'm still om 1.6
Could you show you mosquitto.conf file too, please?

Re: Fixing Z-Wave for once and for all!

Posted: Thursday 24 March 2022 16:49
by waltervl
Olgmo wrote: Thursday 24 March 2022 8:54
Ragdag wrote: Wednesday 01 December 2021 14:38 Thanks, figured that part out as well and created a docker-compose for Mosquitto

So far so good, will start some testing and see how it goes.
Thanks for the help and patience, it's a lot to process if this is the first time dipping your toes in Docker, MQTT and zwavejs2mqtt :oops:
Thank you for your post.
I am running the same in Docker, but I could not get mosquitto:latest to work, I'm still om 1.6
Could you show you mosquitto.conf file too, please?
From https://www.domoticz.com/wiki/MQTT#Installing_Mosquitto
Installing Mosquitto
The recommended way to install Mosquitto is by using Docker (Docker Compose).
For this to work you need to:
- Install both Docker Engine and Docker Compose.
- Install Mosquitto using docker (compose) (https://github.com/vvatelot/mosquitto-docker-compose)


Legacy installation method:

It is highly recommended that if you are using Debian or Rasbian that you use the additional Mosquitto repositories. This will ensure you get the latest stable version of Mosquitto as determined by the project itself, rather than an outdated version via the Debian or Raspbian repositories.

Rather than re-iterating the install procedure here, the guide given a thttps://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/ is simple and easy to follow, and we encourage you to give their process a shot.

Warning: from Mosquitto v2.0.x you need extra configuration, else no connection is made with Domoticz see also viewtopic.php?f=28&t=35706

To fix this edit the /etc/mosquitto/mosquitto.conf file and add:

listener 1883
allow_anonymous true

Re: Fixing Z-Wave for once and for all!

Posted: Sunday 27 March 2022 12:46
by Olgmo
Thanks for your reply. I am now on lastest mosquitto 2.0 on Docker.
I had an incorrect location on config file. I was on "./mosquitto/conf" but should have been "./mosquitto/config"
My error :oops: :roll:

Re: Fixing Z-Wave for once and for all!

Posted: Thursday 22 September 2022 8:27
by eSbek
Guys, if you disable the OZW device, to see devices again you must go to settings -> System tab -> Hardware/Devices and uncheck the "Hide Disbaled Hardware Senosors".