home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.04k stars 30.55k forks source link

RFXTRX integration: failed to set up #87905

Closed gevegest closed 6 months ago

gevegest commented 1 year ago

The problem

RFXTRX integration: failed to set up. Please see logs details below.

This is happening in all 2023.2.x releases.

Reverting back to 2023.1.7 solves the issue.

What version of Home Assistant Core has the issue?

2023.2.3

What was the last working version of Home Assistant Core?

2023.1.7

What type of installation are you running?

Home Assistant Container

Integration causing the issue

RFXTRX

Link to integration documentation on our website

No response

Diagnostics information

As the RFXTRX integration fails to set up, no diagnostics data from the integration is available for Home Assistant 2023.2.3.

Below diagnostics data is from Home Assistant 2023.1.7 where RFXTRX works correctly.

{ "home_assistant": { "installation_type": "Home Assistant Container", "version": "2023.1.7", "dev": false, "hassio": false, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "x86_64", "timezone": "Europe/Amsterdam", "os_name": "Linux", "os_version": "4.4.180+", "run_as_root": true }, "custom_components": {}, "integration_manifest": { "domain": "rfxtrx", "name": "RFXCOM RFXtrx", "documentation": "https://www.home-assistant.io/integrations/rfxtrx", "requirements": [ "pyRFXtrx==0.30.0" ], "codeowners": [ "@danielhiversen", "@elupus", "@RobBie1221" ], "config_flow": true, "iot_class": "local_push", "loggers": [ "RFXtrx" ], "is_built_in": true }, "data": { "entry": { "entry_id": "13f6ae54ee4e2768608cac7611ed8b3d", "version": 1, "domain": "rfxtrx", "title": "RFXTRX", "data": { "host": null, "port": null, "device": "/dev/ttyUSB0", "automatic_add": false, "devices": { "071a000001020301": { "device_id": [ "1a", "0", "010203:1" ], "fire_event": true, "signal_repetitions": 1, "venetian_blind_mode": "Unknown" } } }, "options": {}, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "unique_id": "rfxtrx", "disabled_by": null } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-02-11 21:24:44.216 ERROR (Thread-2 (_connect)) [root] Uncaught thread exception
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 985, in _connect
    self.transport.reset()
  File "/usr/local/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/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
AttributeError: 'NoneType' object has no attribute 'write'
2023-02-11 21:25:14.215 ERROR (MainThread) [homeassistant.components.rfxtrx] Connection timeout: failed to receive response from RFXtrx device

Additional information

Running Home Assistant in Docker on Synology NAS DS718+ with RFXtrx433XL connected via USB.

home-assistant[bot] commented 1 year ago

Hey there @danielhiversen, @elupus, @robbie1221, mind taking a look at this issue as it has been labeled with an integration (rfxtrx) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `rfxtrx` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign rfxtrx` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


rfxtrx documentation rfxtrx source (message by IssueLinks)

gevegest commented 1 year ago

Hello, managed to get RFXTRX integration started without error in Home Assistant 2023.2.3 by first disconnecting and reconnecting the RFXtrx433XL before starting Home Assistant. However, when i then try to close the blinds nothing happens and the following error is shown in the log.

2023-02-12 09:18:15.897 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139656262815552] write failed: [Errno 5] I/O error
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/serial/serialposix.py", line 621, in write
    n = os.write(self.fd, d)
OSError: [Errno 5] I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1787, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1824, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 968, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 720, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/rfxtrx/cover.py", line 118, in async_close_cover
    await self._async_send(self._device.send_close)
  File "/usr/src/homeassistant/homeassistant/components/rfxtrx/__init__.py", line 562, in _async_send
    await self.hass.async_add_executor_job(fun, rfx_object.transport, *args)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 135, in send_close
    self.send_command(transport, 0x03)
  File "/usr/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 131, in send_command
    transport.send(pkt.data)
  File "/usr/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
  File "/usr/local/lib/python3.10/site-packages/serial/serialposix.py", line 655, in write
    raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] I/O error
gevegest commented 1 year ago

Hello, I was a bit to optimistic regarding the RFXTRX integration working properly on Home Assistant 2023.1.7. After 24 hours, also there the I/O error above occurred. Disconnecting and reconnecting the RFXtrx433XL and then reloading the integration makes the integration work again.

It seems like the communication with the RFXtrx433XL freezes somehow..

Don't know at which moment this issue occurred as the last time the automation that controls the blinds run is last September 2022.

arch12321 commented 1 year ago

Same issue (I think) - new container install of HA and can't get the RFXTRX integration working at all - lots of UI errors and nothing useful in logs. All works perfectly on domoticz. Looking at the other bugs on this integration it looks like it's no longer actively maintained by anyone - my guess is HA isn't a great place for the RFXCOM. Back to domoticz for me.

user152306 commented 1 year ago

I also got this problem when upgrading from Home Assistant 2023.2.3 to 2023.2.5. Restart of HA or reboot of VM does not change anything.

Logger: homeassistant.components.rfxtrx
Source: components/rfxtrx/__init__.py:94
Integration: RFXCOM RFXtrx (documentation, issues)
First occurred: 08:29:19 (3 occurrences)
Last logged: 08:44:29

Connection timeout: failed to receive response from RFXtrx device
2023-02-20 08:54:35.353 ERROR (Thread-2 (_connect)) [root] Uncaught thread exception
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 985, in _connect
    self.transport.reset()
  File "/usr/local/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/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 828, in send
    self.serial.write(pkt)
AttributeError: 'NoneType' object has no attribute 'write'
jafreenas commented 1 year ago

Same isssue here

Logger: homeassistant.components.rfxtrx Source: components/rfxtrx/init.py:94 Integration: RFXCOM RFXtrx (documentation, issues) First occurred: 16:55:32 (1 occurrences) Last logged: 16:55:32

Connection timeout: failed to receive response from RFXtrx device

from Home Assistant 2023.2.5

elupus commented 1 year ago

What happens if you reload just the integration?

jafreenas commented 1 year ago

i remove rfxcom , and reintegration , i reboot HA , same issue , it 's work on a previous versions on Ha . my english is so bad sorry !

Le dim. 26 févr. 2023 à 17:08, Joakim Plate @.***> a écrit :

What happens if you reload just the integration?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/87905#issuecomment-1445398287, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFBJSAOVK4AJZRXJMRBCVLWZN5WLANCNFSM6AAAAAAUY4PPFA . You are receiving this because you commented.Message ID: @.***>

gevegest commented 1 year ago

Okay just to try something I changed the USB cable to the RFXtrx433XL with one that has a ferrite core and goes through it twice, which i had lying around. This gives it improved RFI/EMI shielding. Now the RFXTRX integration has been running without connection problems for more than a week while before it would have a problem within 24 hours. Maybe the communication between RFXTRX integration and the RFXtrx433XL is suddenly more sensitive to noise? I would not know why or how this would happen, but the improved cable seems to help. Maybe other people can try this solution?

metbril commented 1 year ago

Commit history: https://github.com/home-assistant/core/commits/dev/homeassistant/components/rfxtrx

ei78 commented 1 year ago

I had the same problem. When I disconnected the Home Assistant SkyConnect hardware it worked normal again. And yes I used a usb cable to the Skyconnect. I seems like RFXtrx433 dont like the signals från the Skyconnect.

dbrb2 commented 1 year ago

Commit history: https://github.com/home-assistant/core/commits/dev/homeassistant/components/rfxtrx

This seems to correspond to when I started to have problems. I use the wifi RFXTRX module. After a HA restart, everything will work for a while, then the logs will show:

`Logger: RFXtrx Source: /usr/local/lib/python3.10/site-packages/RFXtrx/init.py:863 First occurred: 20:00:41 (1 occurrences) Last logged: 20:00:41

Failed to create socket, check host port config `

At which point the only way to recover is to restart HA again. A restart of just the integration fails, with the error:

Error unloading entry RFXTRX for rfxtrx Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 539, in async_unload result = await component.async_unload_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/rfxtrx/__init__.py", line 112, in async_unload_entry await hass.async_add_executor_job(rfx_object.close_connection) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 1019, in close_connection self.transport.close() File "/usr/local/lib/python3.10/site-packages/RFXtrx/__init__.py", line 914, in close self.sock.shutdown(socket.SHUT_RDWR) OSError: [Errno 107] Socket not connected

metbril commented 1 year ago

Issue https://github.com/home-assistant/core/pull/88538 has a higher number than this issue so I don't think that this could have caused it. Also haven't checked if it's already been released.

See also https://github.com/Danielhiversen/pyRFXtrx/releases/tag/0.30.1 and https://github.com/Danielhiversen/pyRFXtrx/pull/147

GSV3MiaC commented 1 year ago

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??

metbril commented 1 year ago

This is a really clever thought. I immediately checked my configuration.

My .storage/config.entries json file shows:

      {
        "entry_id": "8c3fc5ddeae30e1ff5946220fdf366dc",
        "version": 1,
        "domain": "rfxtrx",
        "title": "RFXTRX",
        "data": {
          "host": null,
          "port": null,
          "device": "/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1XQFD94-if00-port0",

etc.

and the server shows this port for the RFXTRX device:

Subsysteem:
tty
Apparaatpad:
/dev/ttyUSB0
ID:
/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1XQFD94-if00-port0
Attributen:
DEVLINKS: >-
  /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A1XQFD94-if00-port0
  /dev/serial/by-path/platform-xhci-hcd.1.auto-usb-0:1.1:1.0-port0
DEVNAME: /dev/ttyUSB0
DEVPATH: >-
  /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.1.auto/usb1/1-1/1-1.1/1-1.1:1.0/ttyUSB0/tty/ttyUSB0

So this looks good to me from a mapping perspective.

But I'm still experiencing issues since last December. The device is not working at all.

metbril commented 1 year ago

I finally did it. I completely removed the integration. It will be a lot of work to re-add al devices and sensors if this is working again.

First I tried to re-add the integration immediately. After waiting for long, I got a timeout. So that was not working. Then I shut down my host computer, removed the power plug for 10 seconds and rebooted the host devices. After HA had restarted, I checked the ttyUSB port for the RFXTRX transmitter. That had stayed the same. I then re-added the integration. That succeeded. So it's now technically working again. I enabled auto discovery and went through the house to trigger all sensors.

I have added all devices and sensors back to HA. But still need to rename them and check any automations. Thank goodness it is a weekend.

I'll watch closely and report back if it fails again.

user152306 commented 1 year ago

I forgot to update with my findings here, but it kind of relates to what some of you already have posted. I couldn't get it to work, even when going back to older HA, reboot etc. nothing worked. But I never powered the host off entirely so when I disconnected the USB-cable to the rfxtrx device as a test, and put it back in, i.e. coldstarted the device it worked both with the old and the new HA-versions. Not sure what caused this and why it happened now, but it seems many of us got problems during the same timeframe.

I went from 2023.2.3 to 2023.2.5, and then back to 2023.2.3 when after some days I tested the USB disconnect. It was then running stable with some restarts etc and I then upgraded to 23.3.5 and it still works.

metbril commented 1 year ago

But I never powered the host off entirely so when I disconnected the USB-cable to the rfxtrx device as a test, and put it back in, i.e. coldstarted the device it worked both with the old and the new HA-versions.

The issue returned after a restart of HA (or a host restart, not sure). But the integration could not be loaded.

I then pulled the USB plug from the RFXTRX device out of my host, put it back in and reloaded the integration. That seems to have worked for now, as a WORKAROUND.

I don't think it's a Core or integration issue, but more on a low level, the host OS.

https://github.com/home-assistant/operating-system/releases

prmfeddema commented 1 year ago

Fyi: with the latest hassos update to 10.3 is stopped working/sending command...

Ari-run commented 1 year ago

Hello same here juste after install i "allways" have trouble with this "usually" a couple of reboot and i regain acces to rfxcomm ... but not since this update having this : 2023-06-20 08:22:04.846 ERROR (Thread-4 (_connect)) [root] Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/usr/local/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.11/site-packages/RFXtrx/__init__.py", line 990, in _connect self.set_recmodes(self._modes) File "/usr/local/lib/python3.11/site-packages/RFXtrx/__init__.py", line 1028, in set_recmodes data[5] = self._status.device.tranceiver_type ^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'device'

prmfeddema commented 1 year ago

Lets hope that this can be fixed fast

Ari-run commented 1 year ago

Hello for information the unplug / replug of the rfxcomm usb and a reload of the integartion and it's work ! (hopping no electrical issue during vacation :-) )

prmfeddema commented 1 year ago

Thanks - i will try in a few minutes and let you know.

Op wo 21 jun 2023 om 09:56 schreef Ari-run @.***>:

Hello for information the unplug / replug of the rfxcomm usb and a reload of the integartion and it's work ! (hopping no electrical issue during vacation :-) )

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/87905#issuecomment-1600367616, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANORV3EWYKT3Y4HX4ZY5FV3XMKSMPANCNFSM6AAAAAAUY4PPFA . You are receiving this because you commented.Message ID: @.***>

prmfeddema commented 1 year ago

just tested - your solution works! Thanks!

Op wo 21 jun 2023 om 09:56 schreef Ari-run @.***>:

Hello for information the unplug / replug of the rfxcomm usb and a reload of the integartion and it's work ! (hopping no electrical issue during vacation :-) )

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/87905#issuecomment-1600367616, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANORV3EWYKT3Y4HX4ZY5FV3XMKSMPANCNFSM6AAAAAAUY4PPFA . You are receiving this because you commented.Message ID: @.***>

Ari-run commented 1 year ago

Thanks to @metbril metbril :-) hopping a fix . always affraid by a reboot :-(

jafreenas commented 1 year ago

I have the same problem , but unplug / replug of the rfxcomm usb and a reload of the integartion and doesnt work for me ...

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Ari-run commented 1 year ago

Still have problrm just after Last upgade. Home Assistant 2023.10.3 Supervisor 2023.10.0 Operating System 11.0 Interface utilisateur : 20231005.0 - latest

maddinhome commented 1 year ago

In my installation it is also the case that rfx does not work: rfxtrx433xl usb Synology VM

Home Assistant 2023.10.4 Supervisor 2023.10.0 Operating System 11.0 Frontend 20231005.0 - latest

ganimed07 commented 11 months ago

Same problem rfxtrx433e

Core 2023.11.3 Supervisor 2023.11.3 Operating System 11.1 Frontend 20231030.2

prmfeddema commented 11 months ago

My problem disappeared after a few random attempts covering de-installing/re-installing/plugging out and in again..

Op vr 24 nov 2023 om 19:09 schreef ganimed07 @.***>:

Same problem rfxtrx433e

Core 2023.11.3 Supervisor 2023.11.3 Operating System 11.1 Frontend 20231030.2

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/87905#issuecomment-1825970568, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANORV3FCEEJE5NLL6PA3LMLYGDPE3AVCNFSM6AAAAAAUY4PPFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVHE3TANJWHA . You are receiving this because you commented.Message ID: @.***>

tim-rivett commented 9 months ago

Not able to get working rfxtrx433 and rfxtrx433XL Core 2024.1.3 Supervisor 2023.12.1 Frontend 20240104.0 Debian Linux kernel 4.4.194

prmfeddema commented 9 months ago

I had a number of issues and the following helped: 1) unplugging/replugging the usb cable when HA was running on my older "nuc"with an intel N2807

2) when moving from the older Intel n2807 to a spare Raspberry PI 4 (4GB + SSD) i could not get it to work. I knew that there was a potential issue with the USB hub power supply in combination with the PI so I replaced it with the one listed below (from Amazon, €36) and all problems have been resolved. (I plugged it into the USB2 port).

RSHTECH Aluminum 24W 7-Port USB 3.0 Hub, 12V/2A Power Supply and Transfer Rate 5Gbps, Multiport USB 3.0 Distributor with Separate Switch, LED Indicator and Hot Swap Support (RSH-A37S)

Op vr 19 jan 2024 om 15:24 schreef Tim Rivett @.***>:

Not able to get working rfxtrx433 and rfxtrx433XL Core 2024.1.3 Supervisor 2023.12.1 Frontend 20240104.0 Debian Linux kernel 4.4.194

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/87905#issuecomment-1900513060, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANORV3HTKTX5ZL2TMSBYB2LYPJ63RAVCNFSM6AAAAAAUY4PPFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBQGUYTGMBWGA . You are receiving this because you commented.Message ID: @.***>

issue-triage-workflows[bot] commented 6 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.