andersevenrud / ha-nexa-bridge-x

Home Assistant - Nexa Bridge X Integration
Other
9 stars 3 forks source link

Fix legacy bridge poll timeout issues #35

Closed andersevenrud closed 6 months ago

andersevenrud commented 8 months ago

Hopefully this fixes the timeout issues users have been reporting by creating another poll implementation for legacy bridges.

Overview

Changes only applies to legacy devices

Potential downsides


sonite commented 6 months ago

Adding this two file changes to v1.5.1 does not make it better. It does not run through the nodes.

2024-05-02 21:39:25.654 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-02 21:39:25.655 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration nordpool which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-02 21:39:25.655 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration nexa_bridge_x which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-02 21:39:27.945 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hacs' accesses hass.components.frontend. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to import functions used from frontend directly at custom_components/hacs/frontend.py, line 68: hass.components.frontend.async_register_built_in_panel(, please create a bug report at https://github.com/hacs/integration/issues
2024-05-02 21:39:29.010 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'hacs' accesses hass.helpers.event. This is deprecated and will stop working in Home Assistant 2024.11, it should be updated to import functions used from event directly at custom_components/hacs/base.py, line 642: self.hass.helpers.event.async_track_time_interval(, please create a bug report at https://github.com/hacs/integration/issues
2024-05-02 21:40:48.334 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:40:53.862 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:41:04.439 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:41:06.897 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:41:12.770 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:41:23.573 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:41:25.044 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:42:05.765 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:42:47.414 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: null
2024-05-02 21:42:47.591 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: 200
2024-05-02 21:42:47.592 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: null
2024-05-02 21:42:47.593 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/nodes: null
2024-05-02 21:42:47.594 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/energy: null
2024-05-02 21:42:47.831 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/nodes: 200
2024-05-02 21:42:47.832 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:42:47.832 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] Finished fetching Nexa Bridge X Coordinator data in 0.241 seconds (success: False)
2024-05-02 21:42:47.835 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/energy: 200
2024-05-02 21:42:47.887 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: 200
2024-05-02 21:42:53.301 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: null
2024-05-02 21:42:53.455 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: 200
2024-05-02 21:42:53.456 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: null
2024-05-02 21:42:53.457 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/nodes: null
2024-05-02 21:42:53.458 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/energy: null
2024-05-02 21:42:53.651 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/nodes: 200
2024-05-02 21:42:53.652 ERROR (MainThread) [custom_components.nexa_bridge_x.nexa] Unexpected error fetching Nexa Bridge X Coordinator data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 672, in _async_update_data
    results = await asyncio.gather(*[
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nexa_bridge_x/nexa.py", line 347, in fetch_nodes
    async for r in result:
TypeError: 'async for' requires an object with __aiter__ method, got list
2024-05-02 21:42:53.653 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] Finished fetching Nexa Bridge X Coordinator data in 0.197 seconds (success: False)
2024-05-02 21:42:53.655 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/energy: 200
2024-05-02 21:42:53.715 DEBUG (MainThread) [custom_components.nexa_bridge_x.nexa] GET http://192.168.1.122/v1/info: 200
andersevenrud commented 6 months ago

I've pushed an additional change to this PR that might take care of that TypeError: 'async for' requires an object with __aiter__ method, got list which is the underlying cause of this error.

Getting a bit late here, and I don't have my Nexa running atm, so didn't have a chance to actually test this change. I must have messed up when I tried this myself last time we talked...

Ref: https://github.com/andersevenrud/ha-nexa-bridge-x/pull/35/commits/a4e2ba1063ad7c07fbeed1e4d8520de069708326

andersevenrud commented 6 months ago

Glad to hear that it worked (https://github.com/andersevenrud/ha-nexa-bridge-x/commit/a4e2ba1063ad7c07fbeed1e4d8520de069708326#commitcomment-141638719)!

I'll merge this and create a new release :)