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 Thread integration #85002

Merged
merged 19 commits into from
Jan 17, 2023
Merged

Add Thread integration #85002

merged 19 commits into from
Jan 17, 2023

Conversation

emontnemery
Copy link
Contributor

@emontnemery emontnemery commented Jan 2, 2023

Proposed change

Add Thread integration which interfaces with the Open Thread Border Router's REST API

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.

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.

To help with the load of incoming pull requests:

async def async_get_thread_state(hass: HomeAssistant) -> ThreadState:
"""Get current Thread state."""

response = await async_get_clientsession(hass).get(
Copy link
Member

Choose a reason for hiding this comment

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

Can we make a helper class for the API that has a request wrapper to handle the raise for status?

https://github.com/esphome/dashboard-api/blob/main/esphome_dashboard_api/__init__.py#L42-L54

Copy link
Member

Choose a reason for hiding this comment

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

And I think that we should extract that API class into a new repository under home-assistant-libs.

@emontnemery emontnemery reopened this Jan 16, 2023
return self.async_abort(reason="single_instance_allowed")

config = discovery_info.config
return self.async_create_entry(
Copy link
Member

Choose a reason for hiding this comment

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

for now ok if we only set it up as part of multi pan. In future we should have a confirm step

@emontnemery emontnemery merged commit 11b9a0b into dev Jan 17, 2023
@emontnemery emontnemery deleted the thread_mvp branch January 17, 2023 13:01
@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 Jan 17, 2023
rlippmann pushed a commit to rlippmann/core that referenced this pull request Jan 18, 2023
* Add Thread integration

* Add get/set operational dataset as TLVS

* Add create operational dataset

* Add set thread state

* Adjust after rebase

* Improve HTTP status handling

* Improve test coverage

* Change domains from thread to otbr

* Setup otbr from a config entry

* Add files

* Store URL in config entry data

* Make sure manifest is not sorted

* Remove useless async

* Call the JSON parser more

* Don't raise exceptions without messages

* Remove stuff which will be needed in the future

* Remove more future stuff

* Use API library

* Bump library to 1.0.1
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed has-tests integration: thread new-integration 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.

4 participants