Skip to content

Reuse UDP sockets and increase polling timing#472

Merged
RobHofmann merged 8 commits into
RobHofmann:4.0-pre-releasefrom
p-monteiro:connection-fixes
Jul 8, 2026
Merged

Reuse UDP sockets and increase polling timing#472
RobHofmann merged 8 commits into
RobHofmann:4.0-pre-releasefrom
p-monteiro:connection-fixes

Conversation

@p-monteiro

Copy link
Copy Markdown
Contributor

This PR tries to fix the reported issues with the device becoming unavailable and disconnected from Wifi (#470)

List of changes:

  • Bump default pool interval from 30 to 60 seconds. Existing configs must be manually reconfigured or re-added.
  • Reuse a single asyncio_dgram client instead of reconnecting per request
  • Remove unnecessary recv task creation and await recv() directly
  • Reset the transport after timeouts or communication errors
  • Serialize requests with a lock to avoid concurrent send/recv races

p-monteiro and others added 8 commits June 26, 2026 16:27
This allows to debug the value of all unknown props found in firmware disassembly. Might be useful to debug and find new features.

TODO: Hook it to HA
Try to fix connection problems by reusing connection streams with the device while possible:
- Reuse a single asyncio_dgram client instead of reconnecting per request
- Remove unnecessary recv task creation and await recv() directly
- Reset the transport after timeouts or communication errors
- Serialize requests with a lock to avoid concurrent send/recv races
@p-monteiro

Copy link
Copy Markdown
Contributor Author

@RobHofmann Did this fix your issues? Would like to have this merged. I already have other things to send for PR. To avoid constant rebases, I am waiting for PRs to be merged before making new ones. I do this to keep PR to a minimum change, but if you prefer, I can start adding more and more commits to a single PR.

@RobHofmann

Copy link
Copy Markdown
Owner

Hey man. Haven't had the time yet to check & test this. What I can do for now is merge it to the 4.0 prerelease branch so people can test this in parallel. Let me know if thats ok.

@p-monteiro

Copy link
Copy Markdown
Contributor Author

@RobHofmann Sure, merging is fine if you'd like to. I just would like a bit more agility in v4 merging, since there is still heavy development going into it, and not all of it requires a dedicated release.

@RobHofmann

Copy link
Copy Markdown
Owner

I tried to check if theres any options where I can give you PR Merge access to the branch, but I think it's impossible. My assumption is that it's because it's not within an GitHub Organization (theres seem to be a bit more options there with branch protections).

@RobHofmann

Copy link
Copy Markdown
Owner

I will merge it for now. I think it has quite some impact if I would move this repo to an org (URL changes and we need to inform HACS etc).

@RobHofmann RobHofmann merged commit 7ea3651 into RobHofmann:4.0-pre-release Jul 8, 2026
2 checks passed
@RobHofmann

Copy link
Copy Markdown
Owner

For now lets just say I'll merge PR's to the 4.0-prerelease branch from you. Bit of a hassle, but let's try to be pragmatic here.

@p-monteiro

Copy link
Copy Markdown
Contributor Author

Thanks 👍 No problem. I don't think there needs to be an org. Maybe branch protection rules would be enough, but I understand if you don't want that.

@p-monteiro p-monteiro deleted the connection-fixes branch July 9, 2026 08:35
@RobHofmann

Copy link
Copy Markdown
Owner

Thanks 👍 No problem. I don't think there needs to be an org. Maybe branch protection rules would be enough, but I understand if you don't want that.

This was exactly what I was looking for, but apparently to allow certain people (you) to push to a certain branch, you (from what I read) need to have your repo inside an organization. With personal repo's like this one, that feature does not show.

@p-monteiro

Copy link
Copy Markdown
Contributor Author

Bummer.

The docs say otherwise. I think the correct way is to lock the master instead of adding permissions to 4.0-pre-release.
But it is fine, as long as merges happen somewhat frequently, there's no real issue here. I can wait.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants