RFXtrx intergation not loading on 2021.12.7

RFXtrx intergation not loading on 2021.12.7 (recently upgraded from 2021.4)
Docker container with Rfxtrx mapped /dev/ttyUSB1

Any pointers how to resolve?

Relevant log extracts

2022-01-02 00:08:12 INFO (MainThread) [homeassistant.setup] Setting up rfxtrx

2022-01-02 00:08:12 INFO (MainThread) [homeassistant.setup] Setup of domain rfxtrx took 0.0 seconds
2022-01-02 00:08:13 INFO (MainThread) [homeassistant.components.zwave] Z-Wave USB path is /dev/ttyACM0

2022-01-02 00:08:13 DEBUG (Thread-3) [RFXtrx] Send: 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

2022-01-02 00:08:13 ERROR (Thread-3) [root] Uncaught thread exception

Traceback (most recent call last):

  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner

    self.run()

  File "/usr/local/lib/python3.9/threading.py", line 910, in run

    self._target(*self._args, **self._kwargs)

  File "/usr/local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 876, in _connect

    self.transport.reset()

  File "/usr/local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 723, in reset

    self.send(b'\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')

  File "/usr/local/lib/python3.9/site-packages/RFXtrx/__init__.py", line 719, in send

    self.serial.write(pkt)

AttributeError: 'NoneType' object has no attribute 'write'

2022-01-02 00:08:13 INFO (MainThread) [homeassistant.setup] Setup of domain apcupsd took 1.4 seconds
2022-01-02 00:08:43 ERROR (MainThread) [homeassistant.components.rfxtrx] Connection timeout: failed to receive response from RFXtrx device

lsusb

[admin@dockerhost opt]$ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 18d1:9302 Google Inc.
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 004: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 002 Device 003: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 002 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 002 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 002 Device 002: ID 214b:7250 Huasheng Electronics
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
You have mail in /var/spool/mail/admin

[admin@dockerhost opt]$ ./USBid.sh 
/dev/ttyUSB1 - RFXCOM_RFXtrx433_A1YKMXYW
/dev/ttyUSB0 - FTDI_FT230X_Basic_UART_DM01C7DN
/dev/ttyACM0 - 0658_0200

Same here , not in Docker though but on NUC (core-2012.12.08 and Supervisor 2021.12.2)
constant ā€œConnection timeout: failed to receive response from RFXtrx deviceā€ messages on a RFXtrx433E device after updating
Upgraded firmware to no avail, removed integration and added makes no change, restarting Core does not help either.
Device is working on a Windows machine using RFXmngr.
Havenā€™t found a workaround yet, hope to find some directions here

Hi, I solved this but only by removing the integration, rebooting my full docker host and then readding the rfxtrx integration. Check that correct usb is being passed to container (sometimes not in my case).

Had to re-add all my devices but only have 6 so not too much of a pain.

Running fine since.

Thanks for getting back, done the same thing and changed ports but after a while it timed out again.
will continue to investigate

I got it working by adding ā€œā€“device /dev/ttyUSB0:/dev/ttyUSB0ā€ to the docker run statement. That also allowed me to keep the already installed devices.
Please note that my docker for HA runs on ā€˜hostā€™ and in 2021.11 it did not (!) need this mapping (as on ā€˜hostā€™)
Without this setting the connection works fine through using ip/port (using ser2net) but ser2net is not stable.

Bumping this hold thread.

Could you please specify where to add the ā€œā€“device /dev/ttyUSB0:/dev/ttyUSB0ā€ ?

the way above in the ā€œdocker runā€¦ā€ of homeassistant container, slightly different you can also add this to a docker_compose but I have no example

Ahā€¦ I already have it in docker-compose.yml. Was hoping I missed somethingā€¦

This error. Might it be caused by my Raspberry Pi? Or Home Assistant or the RFXtrx integration?

You have the exact same error as the OP?
If so, even though I answered, never got a response to that so no clue exactly
EDIT: your HA instance can see this device?

Not sure, maybe only the symptom are the same, the integration not loading.

I donā€™t know if my HA can see the device. If I delete the integration and try to add it again, then it donā€™t see it. However both ttyUSB1 and usbRFXcom are created in:

$ docker exec -it TestHA bash
root@hallonpaj:/# ls /dev
fd  full  mqueue  null	ptmx  pts  random  shm	stderr	stdin  stdout  tty  ttyUSB1  urandom  usbRFXcom  zero

As per my yaml:

version: '2.1'

services:
     homeassistant:
        image: lscr.io/linuxserver/homeassistant
        container_name: TestHA
        network_mode: host
        environment:
            - PUID=1000
            - PGID=1000
            - TZ=Europe/Stockholm

        volumes:
            - /home/david/docker/TempHA/data:/config
        restart: unless-stopped
        devices:
            - /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO5OP3V5-if00-port0:/dev/usbRFXcom
            - /dev/ttyUSB1:/dev/ttyUSB1

You can see more information about my specific case in this thread, I am grateful for any help

Other things I can rememer ( I wish Iā€™d written them down) are to make the tty/USB0 read/write for all (chmod 777) and I made the container run ā€˜prevailedā€™ which is a recommended setting btw.

Generic x86-64 - Home Assistant (home-assistant.io)

I assume you mean ā€œprivilegedā€, I tried that and now it works :smiley:
chmod 77 didnā€™t make any difference privileged: true in my yaml did the trick.

Thank you so much! :smiley:

Stupid auto correction ā€¦ :slight_smile: happy it worked

1 Like

My problem was solved when I plugged the RFXtrx in the back of the thin client!
Tried everythingā€¦ But this was the solution.

That is usually a different port so possibly that explains why it worked not on the front, ttyUSB0 instead of 1 or something

The stupid thing was, it worked fine on the front, but after a restart I had that problemā€¦ Weird

In case you use
/dev/serial/ttyUSB1:/dev/serial/RFX
then you are mapping usb 1, however what number that gets assigned to which port is random upon boot. Thatā€™s is probably why it worked fine until you restarted because then the usb port you used got another number and the RFX device was no longer mapped. Therefore it is supposedly better to use /dev/serial/by-id, ie:
/dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO5OP3V5-if00-port0:/dev/serial/RFX
Because that long name is a unique ID that the actual device has and will be the same whichever usb port or computer is used.

Use

~ $ ls -l /dev/serial/by-id/

to get you identifier.

However in my case this donā€™t help, sometimes I get more luck with ttyUSB0, or if is just randomā€¦

I have another usb device, a zwave stick which works flawlessly (with /dev/serial/by-id/.