Restart Home Assistant automatically when zwave stick is plugged in

If you use an Aoen Labs this will restart home assistant when the usb stick is plugged in. This will take care of usb issues (when devices seemed to be unplugged and re-plugged). You can use the bash file to also run a curl to set a device to a certain value (and/or run automations instead of restarting home assistant)

If the stick is not an Aeon Labs run lsusb command via ssh and replace 0658 and 0200 bellow with the value provided by lsusb (they’re in the format x:y)

Also, this mounts the usb stick as /dev/zwave. You can remove , SYMLINK+=“zwave” if you don’t want that.

file: /etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", SYMLINK+="zwave", RUN+="/bin/x-hass-restart-zwave-replug"

file: /bin/x-hass-restart-zwave-replug
systemctl restart hass

Replace “hass” with the service name (probably home-assistant@homeassistant)

Hope it’s useful!