Skip to content

Conversation

mj23000
Copy link

@mj23000 mj23000 commented Sep 11, 2025

This async version of the Websocket client is mostly just an async version of the existing client, though with the addition of a RawBaseWebsocketClient that is inherited from by both clients.

No clever handling of the client type has been implemented as with the REST API client with use_async. This does have the benefit of not being a breaking change.

A similar structure to the existing REST API client has been implemented.

Commits will be cleaned up when the PR is more ready to be merged.

Copy link
Owner

@GrandMoff100 GrandMoff100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really awesome! Thank you so much!!!

That just leaves the last thing to do which is to add tests for each of the async websocket methods.

@GrandMoff100
Copy link
Owner

I'm going to convert this to a draft PR, and then you'll convert it back when its ready to be reviewed and merged for real.

@GrandMoff100 GrandMoff100 marked this pull request as draft September 24, 2025 06:12
@mj23000 mj23000 force-pushed the async_websocket branch 3 times, most recently from dab88ba to e7310c9 Compare September 25, 2025 11:53
@mj23000
Copy link
Author

mj23000 commented Sep 25, 2025

Looks really awesome! Thank you so much!!!

That just leaves the last thing to do which is to add tests for each of the async websocket methods.

That should be it. I can't see the coverage, but hopefully I've covered everything.

@mj23000 mj23000 marked this pull request as ready for review September 25, 2025 13:56
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 87.63441% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.49%. Comparing base (e3ea524) to head (9b905d9).
⚠️ Report is 4 commits behind head on dev.

Files with missing lines Patch % Lines
homeassistant_api/rawasyncwebsocket.py 85.02% 25 Missing ⚠️
homeassistant_api/rawwebsocket.py 82.22% 16 Missing ⚠️
homeassistant_api/rawbasewebsocket.py 92.00% 4 Missing ⚠️
homeassistant_api/websocket.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #212      +/-   ##
==========================================
- Coverage   97.44%   96.49%   -0.96%     
==========================================
  Files          25       27       +2     
  Lines        1647     1883     +236     
==========================================
+ Hits         1605     1817     +212     
- Misses         42       66      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GrandMoff100
Copy link
Owner

GrandMoff100 commented Sep 30, 2025

I can't see the coverage

I finally figured out why. Codecov recently changed their behavior so that github actions running on forks now require a CODECOV_TOKEN to upload coverage reports (they say it was for ratelimiting purposes, but its annoying). We have a CODECOV_TOKEN secret setup to work with that. However, secrets are not passed to forked repo actions by default for security purposes. This repository is configured so that first time contributors require approval to run workflows, and I was under the impression that after approving it, that the workflows would be able to access the secrets for that workflow. But that is not the case, so I just decided to hardcode the token in a config file since this is a public repository, the token is not really sensitive, so it's not the best solution, but its fine for now.

@GrandMoff100
Copy link
Owner

@mj23000 I am happy to aid you in developing the tests we need to increase the coverage. There are some parts of the codebase that need some clever ideas to test them appropriately.

@mj23000
Copy link
Author

mj23000 commented Oct 1, 2025

@mj23000 I am happy to aid you in developing the tests we need to increase the coverage. There are some parts of the codebase that need some clever ideas to test them appropriately.

Yes that sounds good!

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