Sikerdebaard / hacs-ducobox-connector

Other
1 stars 1 forks source link

Failed to fetch data #1

Open ernsttanaka opened 5 days ago

ernsttanaka commented 5 days ago

Hi trying your new Duco integration:

I am getting the following error in the logs:

Logger: custom_components.ducobox-connectivity-board.sensor Source: custom_components/ducobox-connectivity-board/sensor.py:414 integration: ducobox-connectivity-board First occurred: 12:16:58 PM (14 occurrences) Last logged: 12:46:58 PM

Failed to fetch data from Ducobox API: HTTPConnectionPool(host='192.168.4.89.local', port=80): Max retries exceeded with url: /info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff16b893bc0>: Failed to establish a new connection: [Errno -5] Name has no usable address')) Failed to fetch data from Ducobox API: HTTPConnectionPool(host='192.168.4.89.local', port=80): Max retries exceeded with url: /info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff16f5c1130>: Failed to establish a new connection: [Errno -5] Name has no usable address')) Failed to fetch data from Ducobox API: HTTPConnectionPool(host='192.168.4.89.local', port=80): Max retries exceeded with url: /info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff16f5faa50>: Failed to establish a new connection: [Errno -5] Name has no usable address')) Failed to fetch data from Ducobox API: HTTPConnectionPool(host='192.168.4.89.local', port=80): Max retries exceeded with url: /info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff16f6d5910>: Failed to establish a new connection: [Errno -5] Name has no usable address')) Failed to fetch data from Ducobox API: HTTPConnectionPool(host='192.168.4.89.local', port=80): Max retries exceeded with url: /info (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff16f46f4d0>: Failed to establish a new connection: [Errno -5] Name has no usable address'))

Sikerdebaard commented 5 days ago
  1. Are you using a ducobox connectivity board?
  2. The integration is trying to connect over port 80 (http) but the connectivity board can only be reached over port 443 (https). Have you added the box manually or automatically through zeroconf / mDNS?
ernsttanaka commented 5 days ago

Yes, I have a duco energy premium with a connectivity board. the reference for port=80 comes from the integration. the Duco was self discovered by HA, I only added it to an area.

This is a working url if and when I type it directly in safari: https://192.168.4.89/info/nodes

ernsttanaka commented 5 days ago

here is another error I am also seeing the log:

This error originated from a custom integration.

Logger: custom_components.ducobox-connectivity-board.sensor Source: custom_components/ducobox-connectivity-board/sensor.py:414 integration: ducobox-connectivity-board First occurred: 12:59:32 PM (28 occurrences) Last logged: 1:30:39 PM

Failed to fetch data from Ducobox API: 503 Server Error: for url: https://192.168.4.89/info/nodes Failed to fetch data from Ducobox API: 10 validation errors for NodesResponse Nodes -> 0 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 1 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 2 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 3 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 4 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 5 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 6 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 7 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 8 -> General -> Type -> Id field required (type=value_error.missing) Nodes -> 9 -> General -> Type -> Id field required (type=value_error.missing) Failed to fetch data from Ducobox API: 503 Server Error: for url: https://192.168.4.89/info


when I go directly to this address in Safari I get:

{"Nodes":[{"Node":1,"General":{"Type":{"Val":"BOX"},"SubType":{"Val":29},"NetworkType":{"Val":"VIRT"},"Parent":{"Val":0},"Asso":{"Val":0},"Name":{"Val":""},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"AUTO"},"FlowLvlTgt":{"Val":15}},"Sensor":{"IaqRh":{"Val":89}}},{"Node":2,"General":{"Type":{"Val":"UCCO2"},"SubType":{"Val":2},"NetworkType":{"Val":"WI"},"Parent":{"Val":68},"Asso":{"Val":68},"Name":{"Val":"Keiko co2"},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}},"Sensor":{"IaqCo2":{"Val":96}}},{"Node":3,"General":{"Type":{"Val":"UCCO2"},"SubType":{"Val":2},"NetworkType":{"Val":"WI"},"Parent":{"Val":68},"Asso":{"Val":68},"Name":{"Val":"Mikito co2"},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}},"Sensor":{"IaqCo2":{"Val":96}}},{"Node":4,"General":{"Type":{"Val":"UCCO2"},"SubType":{"Val":2},"NetworkType":{"Val":"WI"},"Parent":{"Val":68},"Asso":{"Val":68},"Name":{"Val":"Master co2"},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}},"Sensor":{"IaqCo2":{"Val":86}}},{"Node":5,"General":{"Type":{"Val":"UCCO2"},"SubType":{"Val":2},"NetworkType":{"Val":"WI"},"Parent":{"Val":68},"Asso":{"Val":68},"Name":{"Val":"Gast co2"},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}},"Sensor":{"IaqCo2":{"Val":96}}},{"Node":6,"General":{"Type":{"Val":"UCCO2"},"SubType":{"Val":2},"NetworkType":{"Val":"WI"},"Parent":{"Val":67},"Asso":{"Val":67},"Name":{"Val":"Keuken co2"},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}},"Sensor":{"IaqCo2":{"Val":96}}},{"Node":7,"General":{"Type":{"Val":"SWITCH"},"SubType":{"Val":0},"NetworkType":{"Val":"RF"},"Parent":{"Val":1},"Asso":{"Val":1},"Name":{"Val":"Schakel contact wc"},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}}},{"Node":58,"General":{"Type":{"Val":"BSRH"},"SubType":{"Val":0},"NetworkType":{"Val":"VIRT"},"Parent":{"Val":1},"Asso":{"Val":1},"Name":{"Val":""},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"-"}},"Sensor":{"IaqRh":{"Val":89}}},{"Node":67,"General":{"Type":{"Val":"VLV"},"SubType":{"Val":0},"NetworkType":{"Val":"VIRT"},"Parent":{"Val":1},"Asso":{"Val":0},"Name":{"Val":""},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"AUTO"},"FlowLvlTgt":{"Val":15}}},{"Node":68,"General":{"Type":{"Val":"VLV"},"SubType":{"Val":0},"NetworkType":{"Val":"VIRT"},"Parent":{"Val":1},"Asso":{"Val":0},"Name":{"Val":""},"Identify":{"Val":0}},"Ventilation":{"State":{"Val":"AUTO"},"TimeStateRemain":{"Val":0},"TimeStateEnd":{"Val":0},"Mode":{"Val":"AUTO"},"FlowLvlTgt":{"Val":15}}}]}

Sikerdebaard commented 5 days ago

I've made some adjustments to the code and enabled some extra debugging. Could you try updating and report back if it does or doesn't work? If it doesn't: please enable debugging for this plugin and send me the logs.

image

ernsttanaka commented 5 days ago

appreciate the help, it now works - most entities are being populated.

The Duco integration has been split up in 8 devices and which collectively have 38 entities. The box, every CO2 sensor and the BOX RH have become a device (in my case a total of 8.

After a few minutes it stops working;

Initially I get a warning:

Logger: py.warnings Source: custom_components/ducobox-connectivity-board/sensor.py:420 integration: ducobox-connectivity-board First occurred: 3:24:25 PM (6 occurrences) Last logged: 3:26:41 PM

/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py:1064: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.4.89'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn(


Which then turns into a error:

Logger: custom_components.ducobox-connectivity-board.sensor Source: custom_components/ducobox-connectivity-board/sensor.py:414 integration: ducobox-connectivity-board First occurred: 3:29:08 PM (4 occurrences) Last logged: 3:32:43 PM

Failed to fetch data from Ducobox API: 503 Server Error: for url: https://192.168.4.89/info/nodes Failed to fetch data from Ducobox API: 503 Server Error: for url: https://192.168.4.89/info

Sikerdebaard commented 5 days ago

The InsecureRequestWarning is unlikely to be the culprit here. That's more related to the self-signed certificate that the ducobox connectivity board uses. The root library, ducopy, does not have this issue as it uses certificate pinning to prevent this error. But I haven't gotten certificate pinning working yet from home assistant. HA seems to override some ssl/tls settings. In any case, it is something to fix later. It can wait.

The error 503 happens on my connectivity board as well. I am not sure why it does that. But after a few minutes it works again. Can you verify that it is picking up samples again after a few minutes in your installation? Or is it permanently dysfunctional after this error?

ernsttanaka commented 5 days ago

home-assistant_ducobox_connectivity_board_2024-11-17T14-45-43.357Z.log Now after 24 minutes they havent returned. The logs don't show much info

ernsttanaka commented 5 days ago

another "find" in the logs

Logger: homeassistant.config_entries Source: config_entries.py:850 First occurred: 3:37:55 PM (1 occurrences) Last logged: 3:37:55 PM

Error unloading entry Ducobox (192.168.4.89) for ducobox_connectivity_board Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 850, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ducobox-connectivity-board/init.py", line 35, in async_unload_entry hass.data[DOMAIN].pop(entry.entry_id) ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'DucoPy' object has no attribute 'pop'

ernsttanaka commented 5 days ago

on tweeker I read that 503 comes when we poll too often in a time span. No indication of time span or freq what's regarded too Often.

ernsttanaka commented 4 days ago

good morning The reading is still intermitted. See the graph from last nights co2 measures on one of my sensors. I have no good indication what this causes. I have reduced the scanning to 5min. IMG_0364

ernsttanaka commented 2 days ago

Installed the lasted version. Still issues with intermittent data. I set the scan to 300sec that improves the situation a little