Zwave-JS-UI in place of OH Zwave binding

Great, same as in Zigbee2MQTT. Now its time to switch :grinning:

You might need either a MAP transform or metadata to convert the numbers.
ie

** Thermostat Status Metadata-State description
0=Idle
1=Heating
2=Cooling

and

 ** Door.map
22=OPEN
23=CLOSED

etc.

Are you guys using Named topics or ValueID topics ?
I sometimes have a hard time building the appropriate topic name and think switching to value id would be much easier …

At this point I have used all the available options :wink: Right now my systems need the JSON conversion because I was testing how far I could get with the HA configs. However, I started (first post) with ValueID and just value. I next converted to Named topics because I felt that more people would understand that. The valueID assumes knowledge of the enums for the Zwave CC, but it is quite short.!
Your KWH topic would be zwave/41/50/0/value/65537

Edit: was meaning to add to the first post that a “device level” time (since that is missing with just value) with the ~/lastActive to a dateTime item.

I use ValueID topics and just value for payloads, since I set this up. No transforms required and pretty direct configuration of the mqtt channels.

As I rebuilt my network, everytime I configured something with a new channel type, I just recorded that channel type config in my tracking system:

By the time I was 1/3 of the way through my setup I could just add a new device, add the thing in OH, copy over the relevant channels, add the correct node ID number and it was done. The longest step was excluding from the old network. On devices where I had the dsk saved already it was 3 - 5 minutes per device at most.

The only three issues I’ve encountered are

  1. the battery reporting issue that’s already come up
  2. I decided to try this with an 800 series controller because I could. It seems that zwave-js is still working on associations for 800 series controllers, so the few places where I had direct associations, I had to shift that function over to OH with a follow profile (added another 1 minute to the process).
  3. This was the big one for me: On multi-button scene controllers where the OH binding would provide all the values on the same channel as [Button #].[Event value], Zwave js splits all these into separate MQTT topics and just provides [Event value]. Rather than reconfigure all my remotes with additional items for each button, I just created a quick js-script transform:
(function(data) {
  var returnValue = zButton + "." + data
  return returnValue
})(input)

And I link each of the different button channels to the same item:

And each link has a Script profile:

I have a HEM node which I frequently find needs a manual refresh of the values read.
In the OH Zwave binding I just issued a “REFRESH” item command to the node.
How do I issue a manual refresh of all values of the specific node now with MQTT thing command?

And another question;
The node has a “RESET accumulated values” button on the UI.
How do I “push” this button through a MQTT thing command?

I collect a midnight KWH reading for mysql persistance in DSL it looks like this; There is documentation on the zwave-js-ui github about these API commands.

rule "HEM KWH Refresh"
when 
    Time cron "0 58 23 ? * * *"
then
    getActions('mqtt', 'mqtt:broker:f06f8352c2').publishMQTT('zwave2/_CLIENTS/ZWAVE_GATEWAY-zwave-js-ui2/api/refreshCCValues/set', '{"args":[3,50]}', 'TRUE' === 'TRUE')
    Thread::sleep(1000)
    getActions('mqtt', 'mqtt:broker:f06f8352c2').publishMQTT('zwave2/_CLIENTS/ZWAVE_GATEWAY-zwave-js-ui2/api/refreshCCValues/set', '{"args":[2,50]}', 'TRUE' === 'TRUE')
    Thread::sleep(1000)
    getActions('mqtt', 'mqtt:broker:f06f8352c2').publishMQTT('zwave2/_CLIENTS/ZWAVE_GATEWAY-zwave-js-ui2/api/refreshCCValues/set', '{"args":[6,50]}', 'TRUE' === 'TRUE')
    Thread::sleep(1000)
etc...

I download into Excel and do the subtraction there, so am not sure about the refresh command.
Could just be topic/set like a configuration item. e.g.
zwave/25/50/0/reset (/set, or /0 or blank or 255 ?)

But I’m just guessing. Could ask on the zwave-js-ui github discussion/question tab.

That’s how I reset the power plug values.
Topic depends on your config. I use “zwave/location/device/50/0/reset”
Use a switch channel and link a switch item to that channel. Item needs an expire time of 2 sec.

Did anyone get a color channel working? I’m struggling using my fibaro dimmers in color mode.
I tried hexColor but openHAB provides r,g,b which does not work.

I use this with a ja transformation

const rgbToHex = (r, g, b) => {
  return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}


Can post the real syntax tomorrow…

I figured it out with a quick and dirty HABApp hack :smiley: !
Also if some wonders how to set a transition time - here is what I found out:

{
    "value": "000000",
    "options": {
        "transitionDuration": "10s"
    }
}

I switch the following config off
grafik
so I can properly name my nodes in zwave-js-ui

I too moved to Zwave-JS-UI on docker.
Manually configured all nodes into MQTT things through a “.things” file.
Now a week into the move and all is working as usual.
It sometimes feels the response time has improved slightly.

Thing mqtt:topic:zwave-node17 "DoorSensor"  (mqtt:broker:mymqtt) 
{
    Type contact : Door_state [stateTopic="zwave/nodeID_17/113/0/Access_Control/Door_state_simple", transformationPattern="MAP:door.map"]
	Type switch : Door [stateTopic="zwave/nodeID_17/48/0/Door-Window", off="true", on="false"]
	Type number : Battery_Level [stateTopic="zwave/nodeID_17/128/0/level"]
}
Thing mqtt:topic:zwave-node20 "WallPlug3"  (mqtt:broker:mymqtt) 
{
    Type switch : switch
	[ 
		stateTopic="zwave/nodeID_20/37/0/currentValue",
		commandTopic="zwave/nodeID_20/37/0/currentValue/set",
		on="true", 
		off="false"
	]
}
Thing mqtt:topic:zwave-node25 "HEM"  (mqtt:broker:mymqtt) 
{
 	Type number : Total_Current [stateTopic="zwave/nodeID_25/50/0/value/66817"]
	Type number : Total_Watt [stateTopic="zwave/nodeID_25/50/0/value/66049"]
	Type number : Total_KWH [stateTopic="zwave/nodeID_25/50/0/value/65537"] 
	Type number : Total_Volts [stateTopic="zwave/nodeID_25/50/0/value/66561"]

 	Type number : PH1_Current [stateTopic="zwave/nodeID_25/50/1/value/66817"]
	Type number : PH1_Watt [stateTopic="zwave/nodeID_25/50/1/value/66049"]
	Type number : PH1_KWH [stateTopic="zwave/nodeID_25/50/1/value/65537"] 
	Type number : PH1_Volts [stateTopic="zwave/nodeID_25/50/1/value/66561"]

 	Type number : PH2_Current [stateTopic="zwave/nodeID_25/50/2/value/66817"]
	Type number : PH2_Watt [stateTopic="zwave/nodeID_25/50/2/value/66049"]
	Type number : PH2_KWH [stateTopic="zwave/nodeID_25/50/2/value/65537"] 
	Type number : PH2_Volts [stateTopic="zwave/nodeID_25/50/2/value/66561"]

 	Type number : PH3_Current [stateTopic="zwave/nodeID_25/50/3/value/66817"]
	Type number : PH3_Watt [stateTopic="zwave/nodeID_25/50/3/value/66049"]
	Type number : PH3_KWH [stateTopic="zwave/nodeID_25/50/3/value/65537"] 
	Type number : PH3_Volts [stateTopic="zwave/nodeID_25/50/3/value/66561"]
	
}
Thing mqtt:topic:zwave-node2 "MotionSensor"  (mqtt:broker:mymqtt) 
{
    Type switch : Motion [stateTopic="zwave/nodeID_2/113/0/Home_Security/Motion_sensor_status", transformationPattern="MAP:motion.map"]
	Type number : Air_temperature [stateTopic="zwave/nodeID_2/49/0/Air_temperature"]
	Type number : Battery_Level [stateTopic="zwave/nodeID_2/128/0/level"]
}
Thing mqtt:topic:zwave-node16 "FloodSensor1"  (mqtt:broker:mymqtt) 
{
	Type switch : Water_Alarm [stateTopic="zwave/nodeID_16/48/0/Water", off="false", on="true"]
	Type number : Battery_Level [stateTopic="zwave/nodeID_16/128/0/level"]
}
Thing mqtt:topic:zwave-node4 "BasementLightSwitch"  (mqtt:broker:mymqtt) 
{
    Type switch : BasementLightSwitch
	[ 
		stateTopic="zwave/nodeID_4/37/1/currentValue",
		commandTopic="zwave/nodeID_4/37/1/targetValue/set",
		on="true", 
		off="false"
	]
	Type number : BasementLightSwitchWatts [stateTopic="zwave/nodeID_4/50/1/value/66049"]
}
2 Likes

Just a short update to a side-problem:
(solved):Zwave remote connection rfc2217 vs tcp (raw). running zwave-js-ui with zwave binding - #10 by Oekel

My working stack/docker-compose:

version: '3.7'

services:
  openhab:
    image: "openhab/openhab:4.1.1"
    container_name: openhab-bremen
    restart: unless-stopped
    ports:
      - "8081:8080"
      - "8444:8443"
      - "9004:9001"
    #network_mode: host
    networks:
      vlan50:
        ipv4_address: 192.168.5.201
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "openhab_addons:/openhab/addons"
      - "openhab_conf:/openhab/conf"
      - "openhab_userdata:/openhab/userdata"
    environment:
      CRYPTO_POLICY: "unlimited"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"

  mosquitto:
    image: eclipse-mosquitto
    container_name: mosquitto-bremen
    volumes:
      - /var/lib/docker/custom/mosquitto/config:/mosquitto/config
      - mosquitto_data:/mosquitto/data
      - mosquitto_log:/mosquitto/log
    ports:
      - 1884:1883
      - 9002:9001
    networks:
      vlan50:
        ipv4_address: 192.168.5.202
    environment:
      MOSQUITTO_USERNAME: "openhab"
      MOSQUITTO_PASSWORD: "mqtt63535"

  zwave-js-ui:
    container_name: zwave-js-ui-bremen
    image: zwavejs/zwave-js-ui:latest
    restart: unless-stopped
    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/Berlin
    networks:
      vlan50:
        ipv4_address: 192.168.5.203
    #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.
      #- 'tcp://192.168.1.102:4000'
    volumes:
      - zwave-config:/usr/src/app/store
    #ports:
      #- '8091:8091' # port for web interface
      #- '3000:3000' # port for Z-Wave JS websocket server

volumes:
  openhab_addons:
    driver: local
  openhab_conf:
    driver: local
  openhab_userdata:
    driver: local

  mosquitto_data:
    driver: local
  mosquitto_log:
    driver: local

  zwave-config:
    name: zwave-config

networks:
  vlan50:
    external: true

1 Like

Just for feedback, I moved from zwave binding to zwavejsui mqtt too.
I spent too much time trying to debug and optimize the old binding with my new aeotec zstick7 (which os not very performant).
Now with zwavejsui it is more powerfull and resilent in my case and my configuration.
I moved all devices from zwavebinding to MQTT, with same endpoint names, so I just had to change the channel prefix in my item file (from zwave:xxx to mqtt:xxx) with a replace all and voila.
With previous configuration examples (thanks again to them), I successfullly reconfigure all my devices that work flawlessly, and here is the list for information :

  • FGD212
  • FGS223
  • FGS213
  • FGMS001
  • NAS-PD07Z
  • ZW100
  • NAS-DS01Z
  • NEO-DS07Z
  • FGDW002

Tempting to move over, but question is when mqtt support will be dropped :grimacing:.

As I understand it, the whole point of ZUI is to make Z-Wave available over MQTT, so I don’t see any reason they’d drop it. Is there a particular reason for your concern?

My impression was that they are moving over to websockets?

Websockets is their preferred interface, but I’ve never heard anything about dropping MQTT altogether. The Home Assistant Discovery via MQTT isn’t well maintained, but I’ve made a few PRs recently and they’ve been accepted. I fully use Home Assistant Discovery with openHAB and zwave-js-ui now. No manually configured MQTT things.

3 Likes

For anyone wondering whether a move to an 800 series controller is possible as part of this migration I’m happy to report following the recent addition of 800 series backup/restore to Zwave-JS in Feb that this works really well.

I took the plunge and moved to a Zooz ZST39 800 series controller, the migration was trivial and my network has been as stable as with my 500 series controller with most of my nodes now talking directly with the controller where previously several of them had 2-3 hops via other nodes.

Thank you.
It works as you described.