davesmeghead / visonic

Visonic Custom Component for integration with Home Assistant
Apache License 2.0
92 stars 20 forks source link

USB Port Changes on OS Restart #81

Closed skykingisepic closed 6 months ago

skykingisepic commented 1 year ago

When the OS restarts either manually or with an update, the USB port changes in config and requires changing. This can only be done by deleting the integration and adding it back in to get the first config screen to select USB and the port. Because of the change, Visonic is not available because of the USB port mismatch.

The Nortek dual radio for Zigbee and Z-wave take up ttyUSB0 and ttyUSB1 so the Visonic USB becomes ttyUSB2 but after OS restart config shows ttyUSB1 and must be changed to ttyUSB2.

Suggest making the first screen to select USB and port available after integration configed without having to delete and add back in.

davesmeghead commented 1 year ago

The way that the integration software is structured makes this quite difficult to do without some major changes so I've tagged it as an enhancement for the time being

davesmeghead commented 1 year ago

As an after thought, could you create some udev rules to achieve this in the OS?

So within the Integrations config page you use for example /dev/usbpanel and then map this to the device, or perhaps the udev rules could statically assign it directly. I'm no expert with udev and I don't know what OS you're using so it is a bit of a workaround. You would need to set up a udev-rule which will assign symlink /dev/usbpanel to the right device by its VID & PID.

skykingisepic commented 1 year ago

Thanks for the suggestion. HA doesn't allow modifying the HD so can't add the rule. I installed from image onto the Pi4 and the disk is ro.

open1999 commented 1 year ago

On linux the USB port can change when reboot the system.

In my case I have do rules in /etc/udev/rules.d

I have too many problems with USB mini-PC, now I use a USB concentrator.

my rules are :

KERNEL=="ttyUSB", KERNELS=="1-4.1", SYMLINK+="ttyUSB.covers" KERNEL=="ttyUSB", KERNELS=="1-4.2", SYMLINK+="ttyUSB.boiler" KERNEL=="ttyUSB*", KERNELS=="1-4.3", SYMLINK+="ttyUSB.alarm"

you have all explanations

read info USB

udevadm info --attribute-walk --path=/sys/bus/usb-serial/devices/ttyUSB1

https://wiki.debian.org/udev https://vncprado.github.io/udev-rules-for-devices-without-serial-number/ https://askubuntu.com/questions/49910/how-to-distinguish-between-identical-usb-to-serial-adapters

Waiting, if you want to modify USB for visonic projetc you can edit the file data/.storage/core.config_entries

davesmeghead commented 6 months ago

Closing as this is a config issue outside of Home Assistant and is not under the control of this Integration.