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.56k stars 30.73k forks source link

Keba: "Slow" response leads to "Could not find a charging station" #124129

Open nifoc opened 2 months ago

nifoc commented 2 months ago

The problem

When restarting HA, the Keba integration only sometimes works. Most of the time all I get is Could not find a charging station at 10.0.51.155.

Restarting HA a couple of times fixes the issue and everything works fine.

There appears to be a race condition, where the integration does not wait long enough for the charging station to respond. The attached debug log appears to confirm this.

What version of Home Assistant Core has the issue?

core-2024.8.2

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

Keba Charging Station

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-08-08 20:22:55.873 DEBUG (MainThread) [keba_kecontact.keba_protocol] Asyncio UDP connection setup complete.
2024-08-08 20:22:55.879 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 1
2024-08-08 20:22:55.991 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 2
2024-08-08 20:22:56.095 DEBUG (MainThread) [keba_kecontact.keba_protocol] Send report 3
2024-08-08 20:22:56.218 ERROR (MainThread) [homeassistant.components.keba] Could not find a charging station at 10.0.51.155
2024-08-08 20:22:56.219 ERROR (MainThread) [homeassistant.setup] Setup failed for 'keba': Integration failed to initialize.
2024-08-08 20:22:56.408 DEBUG (MainThread) [keba_kecontact.keba_protocol] Datagram received.
2024-08-08 20:22:56.409 DEBUG (MainThread) [keba_kecontact.keba_protocol] Execute callback
2024-08-08 20:22:56.409 DEBUG (MainThread) [homeassistant.components.keba] Notifying 0 listeners

Additional information

home-assistant[bot] commented 2 months ago

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

Code owner commands Code owners of `keba` 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 keba` 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)


keba documentation keba source (message by IssueLinks)

dannerph commented 2 months ago

Hi @nifoc , thanks for the bug report. While not helping to solve this specific issue, you could try out my beta version of the keba integration. In long term, I plan to integrate it here but a bit of work still pending. The beta version is a completely rewritten integration using a more up-to-date library version, supporting multiple charging stations, ...

nifoc commented 2 months ago

Wouldn't it be possible to just increase the timeout in the existing (stable) integration?

nifoc commented 1 month ago

@dannerph Can you let me know if (ultimately) this is the timeout that has to be increased? https://github.com/dannerph/keba-kecontact/blob/1.2.0/keba_kecontact/connection.py#L43

I understand that there are newer versions of the library that handle timeouts differently, but as far as I can tell, HA uses version 1.x of the keba_kecontact library.