W00D00 / home-assistant-elero

Elero Centero component
GNU General Public License v3.0
39 stars 10 forks source link

Elero Stick not discovered in official HA-Docker image #24

Closed tinkerdudeno1 closed 2 years ago

tinkerdudeno1 commented 2 years ago

First of all: Thanks for your efforts in this project. I'm new to HA and was excited to see someone took a step to get the Elero stuff going. I have HA running in Docker using their official image. Unfortunately, discovery does not seem to be working in there.

Let me try to sum up what I understand: Discovery is done here in your code https://github.com/W00D00/home-assistant-elero/blob/cf8ff7c8fe9406db4a7d9f616509b415abcf7723/config/custom_components/elero/__init__.py#L171-L184

When I e.g. print cp.manufacturer within that loop, it's always None. Just like lsusb on the system returns no detailed info:

Bus 001 Device 009: ID 10c4:ea60
Bus 003 Device 001: ID 1d6b:0002
Bus 002 Device 002: ID 2109:0812
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 2109:2812
Bus 001 Device 002: ID 2109:3431
Bus 004 Device 001: ID 1d6b:0003
Bus 004 Device 002: ID fb5d:0001
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 010: ID 0403:6001

However, usb-devices shows everything we need:

T:  Bus=01 Lev=03 Prnt=03 Port=00 Cnt=01 Dev#= 10 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0403 ProdID=6001 Rev=06.00
S:  Manufacturer=elero GmbH
S:  Product=Transmitter Stick
S:  SerialNumber=XXXXXXXX
C:  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=64mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=ftdi_sio

The info is there, it's just not being used by the pyserial package. All this is a limitation of the Alpine base image HA uses, I have yet to find a different image with the same problems. I think it should be possible to at least add additional queries in the code in case the "traditional" discovery via pyserial fails but it would be quite a rewrite of the code.

tinkerdudeno1 commented 2 years ago

For the record I should add: usd-devices is not part of the virgin HA Docker image. It does work when you mount the host usb-devices command to the container, but it's not there out of the box. But even with the info from there, I wasn't able to reliably link a serial device like /dev/ttyUSB1 to it. That was to much of a deep dive into Linux serial device handling and way to many symbolic links and seemingly duplicate and overwhelmingly cascacded directories for my head.

W00D00 commented 2 years ago

Hi @tinkerdudeno1,

did you try the new version which should solve your situation? Thanks, István

tinkerdudeno1 commented 2 years ago

Yes I did try the new version, it was my own development ;-) Works like a charm for me (hope I didn't break anything) Thanks for merging!