I’m running the latest HA as a VirtualBox VM. I plug the Zooz S2 zwave stick into the host and see it as /dev/serial/by-id/usb-0658_0200-if00. In the vm setup I map that host device to /dev/ttyS0. I use ZWaveJS and point it to /dev/ttyS0. The connection times out. Is this the correct approach?
Not sure how device mapping works (which kernel picks the driver to use, etc), but ttyS0
is a regular old-fashioned serial port. Try mapping it to /dev/ttyACM0
.
Can you use the by-id string in the zwavejs addon?
I assumed that since the S2 was under /dev/serial/… on the host that it was using regular serial communication, hence the mapping to /dev/ttyS0. Serial port mapping in the vm is easy. Getting host usb devices exposed in the vm is harder. It means I’ll need to install the guest additions which means I’ll need to mount an iso in the vm. I’m working through that now. Thanks for the input!
To close out the thread I never made this work. To mount a host USB inside a VirtualBox vm, you have to install client tools. That entails mounting an iso as a drive. I couldn’t get it mounted inside the HA OS. So I punted and stood my HA up using docker-compose. I defined ZWaveJS as a service along with HA. Below is my docker-compose.yml in case anyone else wants to try this approach…
version: '3'
services:
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- /home/tim/homeassistant:/config
- /etc/localtime:/etc/localtime:ro
restart: unless-stopped
privileged: true
network_mode: host
zjs:
container_name: zjs
image: kpine/zwave-js-server:latest
restart: unless-stopped
environment:
S2_ACCESS_CONTROL_KEY: "<randomness>"
S2_AUTHENTICATED_KEY: "<randomness>"
S2_UNAUTHENTICATED_KEY: "<randomness>"
S0_LEGACY_KEY: "<randomness>"
devices:
- '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave'
volumes:
- ./cache:/cache
ports:
- '3000:3000'
Not sure what Host OS you are using, but in Windows it’s super easy.
- Install VB and Extension Pack on windows
- Create a filter in VB to capture the USB stick
- Go into HA, grab the by-id string and use it in (my case) z-wave-to-mqtt.
Done, no need to install anything in the HA OS.
I’m using Linux for host but your approach may have worked. I saw the USB Filter setting for the VM but unclear of its function. I may give that a try. Thanks
For anyone else using Virtualbox and windows.
Plug in the stick and fire up the VM. Once its all booted, set the USB passthrough in the USB settings of virtualbox. Unplug the stick and shut down the VM. After its shut down, plug the stick back in and start the VM.
It should be recognized at that point.
Ive used this method on 3 machines.
I couldnt see the USB stick on the virtaulbox GUI even though I can see it in /dev/serial. I restarted VirtualBox as root and now I see all the USB devices on the host and I can pass them through to the VM and Zwave JS can see it too. Its showing up as an option in the configuration of the add-on and the logs seems indicate it is connecting fine.
Thank you Rich! Seems ridiculous but it worked for me!