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.17k stars 30.57k forks source link

Error fetching homewizard data: Timeout occurred while connecting to the HomeWizard Energy device #122970

Closed P-Verbrugge closed 2 months ago

P-Verbrugge commented 3 months ago

The problem

Logger: homeassistant.components.homewizard.coordinator Bron: helpers/update_coordinator.py:344 integratie: HomeWizard Energy (documentatie, problemen) Eerst voorgekomen: 20:12:50 (1 gebeurtenissen) Laatst gelogd: 20:12:50

Error fetching homewizard data: Timeout occurred while connecting to the HomeWizard Energy device

What version of Home Assistant Core has the issue?

core-2024.7.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeWizard

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homewizard/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

I can not see what device is causing the issue. I have a Homewizard Wi-Fi P1 Meter and a[Wi-Fi Watermeter. Both devices are visible in HomeAssistant and update the data like I would expect.

Both devices run the latest firmware. When cloud is enabled they also report back to HomeWizard.

I have my cloud disabled in both cases and only use the local API.

home-assistant[bot] commented 3 months ago

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

Code owner commands Code owners of `homewizard` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign homewizard` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


homewizard documentation homewizard source (message by IssueLinks)

DCSBL commented 3 months ago

Hi, thank you!

So, do you have a connection/integration issue that for example causes missing data? Or is the actual ‘problem’ the log entry itself?

For the latter, feel free to suggest how you think we can improve that 😉.

P-Verbrugge commented 3 months ago

The integration is working as far as I can see.

So basically i don’t understand where the log is coming from and why. I can also not see what device is the problem.

It would be helpful of the log would at least say which device is the problem. Now I have no clue why there are suddenly log errors.

DCSBL commented 3 months ago

I am vacation right now, so if you are open for it you can see if you can improve the error message (which is emitted here)

When approved by the core developers, it will be added at the earliest in HA 2024.9, so take your time. I can take a look/work at this in a few weeks.

P-Verbrugge commented 3 months ago

I am not familiar with Python code. 😄

Perhaps I should start to learn it.

DCSBL commented 3 months ago

This would be a great starter project! If you wish follow this guide and don’t be afraid to make mistakes.

https://developers.home-assistant.io/docs/development_environment/

(follow the manual environment path, as a devcontainer does not work with local devices like HomeWizard)

Again, if you don’t want or don’t have time no worries. I can pick this one up too as I have have the same issue with the log.

durableandsmart commented 2 months ago

Same error here. P1 stopt fetching data. P1 is online and give data to hw app. watermeter is working

guydl012 commented 2 months ago

Hello, Same error here since several weeks. I suspected the wifi but found nothing wrong with it (dedicated 2.4 Ghz for iOT). Lots of error (15 Homewizard devices: 1 P1 meter, 1 watermeter, 1 display and 12 Energy Sockets).

Capture d’écran 2024-08-07 à 15 35 42

The effect is visible:

Capture d’écran 2024-08-07 à 15 43 46

Usually, on the dashboard, it only lasts a couple of seconds.

Same config as initial post, running on a RPI4. Using local API for the integration. But the HW cloud is also enabled.

P-Verbrugge commented 2 months ago

In my case the problem was solved by unplugging the P1 meter and putting it back in. Although the app never had a problem and only HA had an issue, that solved it for me.

guydl012 commented 2 months ago

Already done. Also reconfiguration of wifi using the HW app. If it solved anything, in my case that only lasted for a while.

guydl012 commented 2 months ago

Deactivating UPNP on the router seems to restore the stability with HW entities in Hassio.

I hope it confirms after 24h #FingersCrossed

erikgeurts commented 2 months ago

I posted a similar (identical?) issue on the community forum in early July, at https://community.home-assistant.io/t/homewizard-energy-device-timout-how-to-find-out-which-one-it-is/745958 . It did not get a response there. I have a similar setup as @guydl012 with multiple HomeWizard devices in my network.

I started noticing HomeWizard devices briefly being unavailable to Home Assistant over the local network in the second half of June 2024. In my case it results in template sensors acting up because values from the P1 dongle, kWH meters and sockets are sometimes not available causing the sensors be invalid as well, leading to broken dashboards or failing automations.

Since the log only mentions that Home Assistant had issues connecting with "the HomeWizard energy device", but doesn't specify which one exactly, it's hard to pinpoint if there is perhaps a specific issue with a specific device, for example it being in a spot that has bad wifi coverage.

Prompted by @guydl012 I have now disabled UPnP on my wifi network (in my case it's Google Wifi), hopefully that results in more reliable connections to the dongle and sockets, while hopefully not causing new issues with other devices.

P-Verbrugge commented 2 months ago

In my case upnp was never disabled. But after unplugging my HomeWizard device has no issues a anymore.

erikgeurts commented 2 months ago

I have many HomeWizard devices, including 3 kWh meters which are fixed to the "groepenkast" so unplugging those is not an option. But it can't hurt to briefly unplug 1 or 2 of the others, as in https://www.youtube.com/watch?v=t2F1rFmyQmY and see if it helps in my case.

To diagnose this, I have been using the Uptime card (available in HACS) to display the connection status of my HomeWizard devices, here's what I can see for example for my watermeter for the past 24 hours: image I'm not entirely sure if this particular sensor for the device is the right one to monitor, but these 'outages' do seem to coincide with the system log entries as far as timing is concerned.

guydl012 commented 2 months ago

Deactivating UPNP seems a valid work-around in my case. Occurence is drastically reduced. Counting around 30 occurrences per hour before, now less than 1 per hour.

Capture d’écran 2024-08-08 à 09 53 38
erikgeurts commented 2 months ago

Deactivating UPNP seems a valid work-around in my case. Occurence is drastically reduced. Counting around 30 occurrences per hour before, now less than 1 per hour.

I see, 30 per hour would be terrible, essentially unusable, even once an hour would be bad.

I have at most 1 or 2 per day as far as I can see, per device, and some of the devices even have a 100% availability.

I've enabled UPnP on my network again, and will see if the device that I've briefly unplugged as per @guydl012 improves it for that particular device. Never a good idea to make to changes at once.

erikgeurts commented 2 months ago

I think closing this issue was premature.

It's great that a future version of HA will show the name of the affected device(s) that are briefly unavailable to HA.

But we're still trying to get to the bottom of why that happens in the first place, given that there is no indication (AFAIK) that the sockets or other meters are disconnecting from wifi at all.

Please consider reopening this issue, so that affected users can continue to easily find it and post their observations.

guydl012 commented 2 months ago

Same remark. Previously i had the issue. Now still have the issue with an IP adress.

Same error message, counter increases and one single IP adress that changes from time to time. Already seen 5 different, i would not be surprised to see most if not all my HW devices IP eventually (12).

guydl012 commented 2 months ago

IMG_2869

DCSBL commented 2 months ago

I do not really agree this issue was closed preliminary. The issue was that the log message was unclear, which is now resolved.

The actual issue seems to be a duplicate of https://github.com/home-assistant/core/issues/87432

If you still have issues please make sure your network/wifi is stable and your device has a good enough wifi connection, and make sure your device is up-to-date. Please contact HomeWizard support if you need help with this.

durableandsmart commented 2 months ago

Same error here. P1 stopt fetching data. P1 is online and give data to hw app. watermeter is working

Solved. 😃

guydl012 commented 2 months ago

I don't relate agree this issue was closed preliminary. The issue was that the log message was unclear, which is now resolved.

The actual issue seems to be a duplicate of #87432

If you still have issues please make sure your network/wifi is stable and your device has a good enough wifi connection, and make sure your device is up-to-date. Please contact HomeWizard support if you need help with this.

Thanks for your reply.

All devices are up to date. Wifi with 5 AP, signal is good to very good everywhere. IOT’2.4 Ghz dedicated SSID. Mesh desactivated for all HW devices.

Seems indeed a regression of the #87432 This issue is closed (or limited to contributor). Will you reopen it or should we open a new one in reference ?

Reading that topic, I’ve assigned manually an AP to each HW device to avoid roaming.

erikgeurts commented 2 months ago

I still think this issue was closed prematurely, but let's wait and see if the upcoming change (retrying if a connection fails initially) in https://github.com/home-assistant/core/pull/124150 will improve things.

guydl012 commented 1 month ago

Indeed. And probably worsened by another phenomenon: in my setup, I found that several related HW devices are mixed into multiple Home Assistant Devices.

Here for instance, this socket Home Assistant Devices is connected to multiple integrations (its own but also another socket) while a 1-1 relation is expected.

My guess: this multiplication of integrations, increase the # of connections and polling, reaching faster the maximum active connections limit of the device. Capture d’écran 2024-09-01 à 10 58 13

This is not limited to this devices, in this overview, you can see that multiple HW devices have multiple integrations. Capture d’écran 2024-09-01 à 11 05 24

DCSBL commented 1 month ago

@erikgeurts, I've already mentioned that the issue you're experiencing is not related to #122970 (this issue). If you believe the problem still exists, could you please open a new issue here? You can also double-check if you have the latest firmware version at: https://api-documentation.homewizard.com/docs/versioning. Maybe that will help. Thank you!


@guydl012 This is new for me, I have never seen a situation like that before and I think this situation is unique. I agree that it may cause issues, but the duplication is the issue, not the unstable connection. Can you open a new issue here where you can fill in all the details? We are missing a lot of information and context to figure this one out. Thank you!

erikgeurts commented 1 month ago

Hi @DCSBL thanks for your reply. I checked all my Homewizard devices, and they're all on the latest firmware.

I actually happened to see the P1 dongle lose its connection briefly the other day (as in: it was flashing green), even though at that very same moment in time, the Google Home app showed that the dongle was connected to the wifi network without issues.

The local API on the P1 dongle was also unconnected, because there are entries in the logs for the time this occurred.

It may just be that for whatever reason the dongle decided to reconnect to another access point (I have several). What I don't understand is why that would have taken more than just a few seconds, the P1 dongle was unconnected for several minutes.

I'll investigate more, and I'll also wait for https://github.com/home-assistant/core/pull/124150 to make it into the production release and see if this helps stabilize things within Home Assistant for me.