RFXCOM RFXtrx stopped working

Hi
I’m new to Home Assistant and after much ado I got my home automations and smart setup about 80% finished, when all of a sudden the RFXCOM FRXtrx integration stopped working, it can not load. I have searched and tried various tricks and fixes but can’t get it to work. I don’t have the energy to start all over from a clean slate, and hope that won’t be necessary.

I run HA in docker on a Raspberry Pi4 with RaspberryOS (up to date)
A note that might be of relevance, I could not get

devices:
            - '/dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO5OP3V5-if00-port0:/dev/usb_RFXcom'

or

devices:
            - /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO5OP3V5-if00-port0:/dev/usb_RFXcom

But

            - /dev/ttyUSB1:/dev/rfxcom
            - /dev/ttyUSB0:/dev/zwave

Have worked stable until now. I tried to change them around, using ie USB2 or 3 renders an error, and the Z-Wave stick still works. The RFXtrx device itself seems to work fine in windows with rfxmngr, receiving sensor data.

In the Pi shell

$ ls -l /dev/serial/by-id
totalt 0
lrwxrwxrwx 1 root root 13  3 mar 22.20 usb-RFXCOM_RFXtrx433XL_DO5OP3V5-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13  3 mar 22.20 usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_1e914fd02487ec118153e93719c2d21c-if00-port0 -> ../../ttyUSB1

If I enable debug logging in the RTXtrx integration and click Reload, I get this log

2023-03-04 15:40:09.308 ERROR (Thread-2 (_connect)) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 985, in _connect
    self.transport.reset()
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 832, in reset
    self.send(b'\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
AttributeError: 'NoneType' object has no attribute 'write'
2023-03-04 15:40:39.306 ERROR (MainThread) [homeassistant.components.rfxtrx] Connection timeout: failed to receive response from RFXtrx device
2023-03-04 15:47:00.935 ERROR (Thread-13 (_connect)) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 985, in _connect
    self.transport.reset()
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 832, in reset
    self.send(b'\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
AttributeError: 'NoneType' object has no attribute 'write'

The main log also contains this line

2023-03-04 15:47:30.934 ERROR (MainThread) [homeassistant.components.rfxtrx] Connection timeout: failed to receive response from RFXtrx device

If I restart HA fro within the gui, and immediately after start go to Settings -System -Logs this is what I find

2023-03-04 19:33:30.113 ERROR (Thread-2 (_connect)) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 985, in _connect
    self.transport.reset()
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 832, in reset
    self.send(b'\x0D\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
  File "/usr/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
AttributeError: 'NoneType' object has no attribute 'write'
2023-03-04 19:34:00.108 ERROR (MainThread) [homeassistant.components.rfxtrx] Connection timeout: failed to receive response from RFXtrx device

If I delete the RFXtrx integration and try to add it again, it won’t find the physical device. So my guts tells me that there is where the problem is. But what do I know, I’m addicted to licorice.

I’ll be happy to provide any other logs that might help, just tell me how to get them, and I will be deeply grateful to anyone that is able to help.

In portainer I can access a console and get

root@hallonpaj:/# ls /dev
fd  full  mqueue  null  ptmx  pts  random  shm  stderr  stdin  stdout  tty  urandom  usb_RFXcom  zero

My current yml are

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/julian/docker/TempHA/data:/config
        restart: unless-stopped
        devices:
            - /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO5OP3V5-if00-port0:/dev/usb_RFXcom
#            - /dev/ttyUSB1:/dev/ttyUSB1

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

Do this mean the device or correctly mappen? How can I further test this?

Solved!

The solution was found thanks to @vingerha in this thread RFXtrx intergation not loading on 2021.12.7 - #10 by MilesObrien

The solution is to add “privileged: true” to my yml, like so:

version: '3.1'

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

        privileged: true #    <------- like that

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

Not quite solved… It happened again…

This time I got it working by changing to

- /dev/ttyUSB1:/dev/serial/rfx

But this inconsistent behavior is puzzling. If there might be a bug around, how can I troubleshoot to see if is within my Pi, Docker, Home Assistant or the RFXTRX integration?

I have same or similar problems - updated HA and now my RFXCOM devices are not accessible. Looking at the log/debug I see:

Traceback (most recent call last):
File “/usr/local/lib/python3.10/threading.py”, line 1016, in _bootstrap_inner
self.run()
File “/usr/local/lib/python3.10/threading.py”, line 953, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/lib/python3.10/site-packages/RFXtrx/init.py”, line 1003, in _connect
event = self.transport.receive_blocking()
File “/usr/local/lib/python3.10/site-packages/RFXtrx/init.py”, line 808, in receive_blocking
data = self.serial.read(pkt[0])
File “/usr/local/lib/python3.10/site-packages/serial/serialposix.py”, line 595, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

and looking at the rfxcom config I see

“data”: {
“entry”: {
“entry_id”: “29774a693a549419a6a1d6676429a651”,
“version”: 1,
“domain”: “rfxtrx”,
“title”: “RFXTRX”,
“data”: {
“host”: null,
“port”: null,
“device”: “/dev/ttyUSB1”,
“automatic_add”: false,
“devices”: {
“08500700ea00023859”: {
“fire_event”: false,

Which is worrying since the device is actually on ttyUSB0, and I passed it into the docker container using:

–device /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO2ZXZA1-if00-port0:/dev/serial/rfx \

So what am I doing wrong? I WAS working, but I had to reboot the Pi, so possible the ports all swapped, and it USED to be on ttyUSB1? How do I tell this integration where to find the device??

You seem to be doing the same as me. You can try to reboot your Pi, if it does not work, reboot it again, and again… I’m beginning to think that maybe there is a timing issue. I got my zwave stick in a usb 3 port, an ssd in the other ssd port and the RFXcom in one of the usb2 ports (I tried the other port as well as another cable). Maybe the root hub for usb 2 doesn’t start up properly before docker service starts… Next time I will try to only restart docker, again and again…

Also, I’m not sure my RFXcom usb device shows up with lsusb

$ lsusb
Bus 002 Device 002: ID 154b:f00a PNY PNY ELITE PSSD
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 003: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Silicon Labs is my zwave stick. Can the FRXcom be VIA Labs???

Do you also use a Raspberry Pi 4?

I’m running on a pi3. Solved my problem by removing and then re-adding the rfxcom integration, at which point it let me select among the serial ports (and yes, the rfxcom was one of the options). The downside being I had to re add all my devices and switches. I can find no way to tell the integration to use a changed port.

Try looking at /dev/serial/by-id/ to see what is there… Pretty easy to ID the rfxcom device from that list.

In …/by-id/ the RFXcom is easy to identify, but shouldn’t it be listed by lsusb as well?

I would expect it to be, yes. Iirc (I am no Unix expert) there are some other usb exploration commands.

1 Like

I struggled with my config to. After every reboot it was random if my devices started or not. I have 3: RFXtx, a Zigbee stick and a P1 meter.

First i went to /dev/serial/by-id/ and issued the ls -al command.
The output was:

usb-FTDI_FT232R_USB_UART_A52SMHRQ-if00-port0 -> ../../ttyUSB0
usb-RFXCOM_RFXtrx433_A12UCVS-if00-port0 -> ../../ttyUSB2
usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0 -> ../../ttyUSB1

Then I wrote my docker-compose.yaml:

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:latest"
    volumes:
      - ./config:/config
      - /etc/localtime:/etc/localtime:ro
    devices:
       - /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A12UCVS-if00-port0:/dev/ttyUSB2

    restart: unless-stopped
    privileged: true
    network_mode: host

After the boot it finally all started.

Extra note: had to remove the Zigbee and P1 device in the docker file. Still debugging what went wrong…

1 Like

Have you one or several reboots since that config?

Yes I did. Its terrible! Sometimes i spend an hour rebooting before i have a working configuration and a recoverd database again. Cant find out why my database keeps getting corrupted or an integration wont load.

I moved from Raspberry Pi to NUC, and now I’ve got the same problem.

I set RFXTRX config using
/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1YR74YY-if00-port0:/dev/rfxtrx
or
–device /dev/ttyUSB2:/dev/rfxtrx
but that does not make a difference. A reboot sometimes works and sometimes does not.

Debug log shows a real communication between HASS and the com port, but the RFXTRX integration fails expecting some kind of specific answer.

When evertything works the answer is like this:

2024-03-20 21:40:10.611 DEBUG (Thread-2 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:10.914 DEBUG (Thread-2 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:10.939 DEBUG (Thread-2 (_connect)) [RFXtrx] Recv: 0x14 0x01 0x00 0x01 0x02 0x53 0x2c 0x0a 0x0c 0x2c 0x01 0x01 0x02 0x1c 0x05 0x40 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:10.939 DEBUG (Thread-2 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x00 0x03 0x53 0x1c 0x08 0x0c 0x2d 0x01 0x00 0x00 0x00
2024-03-20 21:40:11.276 DEBUG (Thread-2 (_connect)) [RFXtrx] Recv: 0x14 0x01 0x00 0x00 0x03 0x53 0x2c 0x08 0x0c 0x2d 0x01 0x01 0x02 0x1c 0x05 0x41 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:11.276 DEBUG (Thread-2 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:11.302 DEBUG (Thread-2 (_connect)) [RFXtrx] Recv: 0x14 0x01 0x00 0x01 0x02 0x53 0x2c 0x08 0x0c 0x2d 0x01 0x01 0x02 0x1c 0x05 0x41 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:11.303 DEBUG (Thread-2 (_connect)) [RFXtrx] Status: Status [subtype=433.92MHz, firmware=44, output_power=28, devices=[‘ac’, ‘hideki’, ‘homeeasy’, ‘keeloq’, ‘lacrosse’, ‘lighting4’, ‘oregon’, ‘x10’]]
2024-03-20 21:40:11.303 DEBUG (Thread-2 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x03 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2024-03-20 21:40:11.426 DEBUG (Thread-2 (_connect)) [RFXtrx] Recv: 0x14 0x01 0x07 0x03 0x07 0x43 0x6f 0x70 0x79 0x72 0x69 0x67 0x68 0x74 0x20 0x52 0x46 0x58 0x43 0x4f 0x4d

Interesting…

I’m running HA in docker on a RPi4 and have the same problem.

/dev/serial/by-id (on my docker-compose) often doesn’t work.
/dev/ttyUSBx works more often, but not always, even though
ls -l /dev/serial/by-id shows ttyUSB to be right.

So I reboot and reebot again til it works, usually not more than 3 times. And I really only need to reboot when there is a new kernel.

I suspect there is a bug in the integration.

I am trying to isolate this issue.

Using pyRFXtrx I have run a little example script that connects to my RFXtrxE, sends an init string (I think it is identical to HASS init string), and receive the answer with the list of active protocols.

It works perfect every time. But I if I reload the RFXtrx integration in HASS the log shows the fatal:

2024-05-16 17:24:32.888 ERROR (MainThread) [homeassistant.components.rfxtrx] Connection timeout: failed to receive response from RFXtrx device
2024-05-16 17:26:56.113 DEBUG (Thread-6 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2024-05-16 17:26:56.413 DEBUG (Thread-6 (_connect)) [RFXtrx] Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

Great, hope your onvestigation leads to a solution. Who made the integration in the first place?