Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Awair Local API support #75535

Merged
merged 20 commits into from
Aug 11, 2022
Merged

Add Awair Local API support #75535

merged 20 commits into from
Aug 11, 2022

Conversation

zachberger
Copy link

@zachberger zachberger commented Jul 20, 2022

Proposed change

Add support for Awair's (beta) Local API. This API supports more frequent polling and will work when there is no Internet connection.

Previous attempt in #39538 but that was introducing an entirely new integration. #39538#issuecomment-693547702 suggested extending the current awair component to add an option for the local API, which this new PR does. #39538 also suggested mDNS discovery, that is not in this PR, but could be explored and submitted in a future PR.

Still to be done:

  • More tests need to be written
  • more thoughtful unique IDs for local API
  • more thoughtful strings for ConfigFlow

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works. TODO

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @ahayworth, @danielsjf, mind taking a look at this pull request as it has been labeled with an integration (awair) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@zachberger zachberger marked this pull request as draft July 20, 2022 22:26
Copy link
Contributor

@ahayworth ahayworth left a comment

Choose a reason for hiding this comment

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

🎉 🎉

Yes, I think this is the right approach. I keep thinking "gosh, we should really come back to the local api" but I've had approximately zero time/drive to do so. Thank you so much for taking up the charge!

I will reserve thorough review until it's marked as ready, but I do think the overall direction at the moment is correct.

Regarding mDNS discovery: yes, that can come later. In the future, I think we should have a flow that prefers local by default (and does mDNS discovery for you) but accepts an API token to still support the oldest generation devices. But like you proposed: we'll do that next. A list of hosts is a good next step and we need momentum to keep going. This gives us that momentum!

Thank you! Excited to review it when it's done! 😄

@zachberger
Copy link
Author

Slowly making some progress on this. Its summer so not too much free time.

.gitignore Outdated Show resolved Hide resolved
tests/components/awair/test_config_flow.py Outdated Show resolved Hide resolved
tests/components/awair/test_config_flow.py Outdated Show resolved Hide resolved
tests/components/awair/test_config_flow.py Outdated Show resolved Hide resolved
* Only patch when needed
* Patch correct methods
@zachberger
Copy link
Author

I have more tests to add before this is done, but @ahayworth could you PTAL too, I'd appreciate your feedback on the state of the integration.

@zachberger zachberger marked this pull request as ready for review August 11, 2022 05:26
@zachberger zachberger requested a review from a team as a code owner August 11, 2022 05:26
@zachberger zachberger changed the title WIP: Add Awair Local API support Add Awair Local API support Aug 11, 2022
@balloob balloob merged commit ebbff7b into home-assistant:dev Aug 11, 2022
@balloob
Copy link
Member

balloob commented Aug 11, 2022

Great contribution, thanks! 🎉

@ahayworth
Copy link
Contributor

ahayworth commented Aug 11, 2022

@zachberger I think it's lovely. 😄 If you want to help maintain this component ... that's lovely too 😉 I don't have as much time for open source right now as I would like, and I don't want to be a blocker for further improvements!

@zachberger
Copy link
Author

Thanks everyone for the help getting this across the line!

@github-actions github-actions bot locked and limited conversation to collaborators Aug 12, 2022
@frenck frenck added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Aug 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: awair new-feature noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants