Zwavejs2mqtt snap package

Hi there.
Thanks for the great work on this!
After running sudo zwavejs2mqtt.copy-2-zui, I get this message:
The zui-store (/var/snap/zwavejs2mqtt/common/zui-store) is not empty, exiting...

Does that mean it’s not working?

Can you give me the output of snap connections zwavejs2mqtt and snap connections zwave-js-ui

Not sure if it’s plural of singular.

I just removed ZUI to be able to switch Z2M to the edge channel again.

Think that typo in there is the culprit:

pi@hassbian:~ $ cat /snap/zwavejs2mqtt/476/snap/hooks/connect-plug-zui-store
#!/usr/bin/env bash
cpy_2_zui
if [ $? -eq 0 ]; then
sudo snap stop --disable “${SNAP_NAME}.${SNAP_NAME}”
else
exit 1
fi
logger “Connected ZUI (from: z2m)”

Not sure if the connections output question was for me, but here is it anyway!

pi@hassbian:~ $ snap connections zwavejs2mqtt
Interface Plug Slot Notes
content zwavejs2mqtt:zui-store - -
hardware-observe zwavejs2mqtt:hardware-observe :hardware-observe manual
log-observe zwavejs2mqtt:log-observe - -
network zwavejs2mqtt:network :network -
network-bind zwavejs2mqtt:network-bind :network-bind -
raw-usb zwavejs2mqtt:raw-usb :raw-usb manual
serial-port zwavejs2mqtt:serial-port - -

Can’t run connections on the ZUI snap as it’s currently removed and won’t install due to the typo I guess

OK, now I get this when I run zwave-js-ui.exec:
WARN STORE: scenes.json not found

And then it does not continue. Before, it actually ran, but I realized that I had not connected the correct serial port slot.

It’s actually all working on my end. I thought something was wrong because I could not bring up the web interface. But then I realized that I needed sudo snap set zwave-js-ui server.host='<IP>', where <IP> is the local address of the machine running the zwave server (as I was trying to bring up the interface from another machine).

Found a part of my issue, connect-plug-zui-store calls for cpy_2_zui (underscores), but the actual file in the bin directory is cpy-2-zui (dashes), so it’s not finding the file. Did a bit of mount trickery to modify the connect-plug-zui-store hook file to use the correct filename, but then I get errors in the copy command:

error: cannot perform the following tasks:
- Run hook connect-plug-zui-store of snap "zwavejs2mqtt" (run hook "connect-plug-zui-store":
-----
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/config': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.json': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.jsonl': No such file or directory
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.jsonl.lock': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.metadata.jsonl': No such file or directory
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.metadata.jsonl.lock': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.values.jsonl': No such file or directory
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/ef5cf873.values.jsonl.lock': No such file or directory
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/logs': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/nodes.json': No such file or directory
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/sessions': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/settings.json': No such file or directory
cp: cannot create directory '/var/snap/zwavejs2mqtt/common/zui-store/snippets': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/users.json': No such file or directory
cp: cannot create regular file '/var/snap/zwavejs2mqtt/common/zui-store/zwavejs_2022-04-09.log': No such file or directory
cp: cannot create symbolic link '/var/snap/zwavejs2mqtt/common/zui-store/zwavejs_current.log': No such file or directory
Failed copying data from /var/snap/zwavejs2mqtt/common/zui-store
-----)

Which I don’t really understand, because the actual /var/snap/zwavejs2mqtt/common/zui-store folder does exist.

I followed the instructs above and successfully moved from z2m to z-ui. However when I run:

# snap connections zwave-js-ui
Interface              Plug                          Slot                   Notes
content[vscs-content]  zwavejs2mqtt:zui-store        zwave-js-ui:store-dir  -
...

I see the above ref to z2m still. I see a symmetrical ref when I look at the z2m connections.
MY QUESTION: can i remove the z2m package now or are these cross-references needed and will be broken if I remove it?

I’ve tried to update. I got the “store is not empty” with the copy command too.

The web socket appears to be working, but the UI on port 8091 isn’t there anymore.

Then you tried to start ZUI before you ran the copy command. Starting ZUI will generate new configuration files, and the copy command will fail, to make sure it doesn’t overwrite anything. You can delete that content, if you know there isn’t anything to keep by logging into the shell:

sudo snap run --shell zwave-js-ui
rm -rf $SNAP_DATA/*
exit

(yes you can also delete it from outside the shell, but this way you know that the path that might differ from the OS’s is correct!)
and then run the copy command.

To get the UI (aka SERVER) to listen to every interface, set it to listen to 0.0.0.0:

sudo snap set zwave-js-ui server.host=0.0.0.0

Cherio!

Yes, if ZUI runs fine, you can delete - and even purge - Z2M. ZUI runs just from it’s local files.

sudo snap remove --purge zwavejs2mqtt

Does the snap package store any state? I’m looking at running a dual boot configuration (Win10 +WSL2 Ubuntu and regular Ubuntu) and was wondering if there was any configuration files that would need to be moved when I switch.

Or does it just pull its information from the Zwave controller?

Hello, I am really running into trouble with switching from zwavejs2mqtt to zwave-js-ui. Running a Pi3 with Raspian Bullseye.

Here is what I am doing:
‘sudo snap switch zwavejs2mqtt --edge’
‘sudo snap refresh zwavejs2mqtt’ → it works well I get to the latest version

but then, it becomes impossible to install zwave-js-ui
‘sudo snap install zwave-js-ui --candidate’ → fails with error

error: cannot perform the following tasks:

  • Run hook connect-plug-zui-store of snap “zwavejs2mqtt” (run hook “connect-plug-zui-store”: /snap/zwavejs2mqtt/476/snap/hooks/connect-plug-zui-store: line 2: cpy_2_zui: command not found)

I have tried to install candidate and edge versions, same result.
I have also tried downgrading zwavejs2mqtt, and then I can install zwave-js-ui. But I cannot move zwavejs2mqtt back to the latest release as it fails with the same error. And if it is not the latest, then ‘snap connect zwavejs2mqtt:zui-store zwave-js-ui:store-dir’ also fails…

So, I am stuck in a loop… what is the sequence I need to follow to upgrade?

Hi,

Can you survive on Z2M for a day until I solve these issues? I don’t have my computer in front of me, so I’m not able to give you any guidance.

I can definitely survive a lot more than that ! Thank you for looking into it whenever you have the time

Hello,

I am getting the same error as @benobi, and I am running Pi3 with Raspian Stretch 32bit

pi@raspberrypi:~ $ sudo snap install zwave-js-ui --candidate
error: cannot perform the following tasks:
- Run hook connect-plug-zui-store of snap "zwavejs2mqtt" (run hook "connect-plug-zui-store": /snap/zwavejs2mqtt/476/snap/hooks/connect-plug-zui-store: line 2: cpy_2_zui: command not found)

I have successfully ran the codes below with no errors

sudo snap switch zwavejs2mqtt --edge
sudo snap refresh zwavejs2mqtt

FYI, I did some digging and I think the armhf is not up to date comparing to the amd64/arm64 on the snap store. Otherwise I wouldn’t get the

cpy_2_zui 

should have been

cpy-2-zui

Thanks,

Hi,
Right. There’s issues with the build platform for armhf. They don’t have enough resources (occasionally). I will try to trigger some rebuilds so you can overcome the issue.

I will also try to find time to complete the cpy-2-zui command; I’ve been way to busy with work :frowning:

1 Like


Looks like you guys are in luck tonight.

1 Like

Thank you so much! I was able to install zwave-js-ui and migrate the settings to zwavejs2mqtt!

Great! Enjoy the future of Zwave-js :sweat_smile:

Latest build won’t even start on amd64. Logs don’t give any information as to why it’s failing.

syslog says:
Jan 28 19:57:35 pkitty kernel: [ 4139.570081] audit: type=1400 audit(1674953855.952:672): apparmor=“DENIED” operation=“mkdir” profile=“snap.zwave-js-ui.zwave-js-ui” name="/var/snap/zwave-js-ui/39/" pid=119803 comm=“node” requested_mask=“c” denied_mask=“c” fsuid=0 ouid=0
Jan 28 19:57:36 pkitty zwave-js-ui.zwave-js-ui[119803]: [Error: EACCES: permission denied, mkdir ‘/var/snap/zwavejs2mqtt’] {
Jan 28 19:57:36 pkitty zwave-js-ui.zwave-js-ui[119803]: errno: -13,
Jan 28 19:57:36 pkitty zwave-js-ui.zwave-js-ui[119803]: code: ‘EACCES’,
Jan 28 19:57:36 pkitty zwave-js-ui.zwave-js-ui[119803]: syscall: ‘mkdir’,
Jan 28 19:57:36 pkitty zwave-js-ui.zwave-js-ui[119803]: path: ‘/var/snap/zwavejs2mqtt’
Jan 28 19:57:36 pkitty zwave-js-ui.zwave-js-ui[119803]: }
Jan 28 19:57:36 pkitty systemd[1]: snap.zwave-js-ui.zwave-js-ui.service: Main process exited, code=exited, status=1/FAILURE

I’ve even tried rolling back to version 48, same error.

Removed and reinstalled, still doesn’t work. And I’ve lost all my nodes.

I sure don’t feel lucky about this update.