# Home Assistant Supervisor Client
## Client Library for Home Assistant Supervisor
Python client for interfacing with the [Home Assistant Supervisor](https://github.com/home-assistant/supervisor)
via its [REST API](https://developers.home-assistant.io/docs/api/supervisor/endpoints).
Currently used in the [Home Assistant Supervisor integration](https://www.home-assistant.io/integrations/hassio/)
in Home Assistant.
Add-ons which interface with Supervisor can also leverage it. The library expects
to find the access token in the `SUPERVISOR_TOKEN` env which is set automatically
by Supervisor for add-ons. Currently there is no way to get a long-lived access
token for Supervisor outside these use cases so the library's usage is limited
to these.
## Installation
The library is published on `pip` and can be installed that way:
```sh
pip install aiohasupervisor
```
And then used via import
```py
import asyncio
import supervisor_client
asyncio.run(supervisor_client.info())
```
Output would look like the example response in `/info` from [here](https://developers.home-assistant.io/docs/api/supervisor/endpoints#root)
## Developing & contributing
### Prerequisites
The client can interact remotely with the Home Assistant Supervisor using the
`remote_api` add-on from the [developer add-ons repository](https://github.com/home-assistant/addons-development).
After installing and starting the add-on, a token is shown in the `remote_api`
add-on log, which is needed for further development.
It is also recommended you use Visual Studio Code for development with the devcontainer
extension. This will read the published devcontainer configuration and setup the
development environment for you.
### Get the source code
Fork ([https://github.com/home-assistant-libs/python-supervisor-client/fork](https://github.com/home-assistant/python-supervisor-client/fork)) or clone this repository.
### Using it in development
From within the devcontainer, open terminal and do the following:
```shell
uv pip install -e .
export SUPERVISOR_API_URL=http://192.168.1.2
export SUPERVISOR_TOKEN=replace_this_with_remote_api_token
python examples/connectivity_test.py
```
Output should match the example response in `/info` as shown/linked above in [Installation](#installation).
**Note**: Replace the `192.168.1.2` with the IP address of your Home Assistant
instance running the `remote_api` add-on and use the token provided.
### Contributing a change
1. Create a feature branch on your fork/clone of the git repository.
2. Commit your changes.
3. Rebase your local changes against the `main` branch.
4. Run test suite with the `pytest tests` command or use Test Explorer and confirm that it passes.
5. Use `ruff` to format your code with the rules configured in this project
6. Create a new Pull Request
## Release
Any time the API changes for Home Assistant Supervisor a corresponding release
should be published here. Once that release is available on pip a PR should be
created to [Home Assistant Core](https://github.com/home-assistant/core) updating
its [Home Assistant Supervisor integration](https://github.com/home-assistant/core/blob/dev/homeassistant/components/hassio).
Follow the directions for updating [Requirements](https://developers.home-assistant.io/docs/creating_integration_manifest#requirements)
in the Integration manifest.
Raw data
{
"_id": null,
"home_page": null,
"name": "aiohasupervisor",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12.0",
"maintainer_email": null,
"keywords": "docker, home-assistant, api, client-library",
"author": null,
"author_email": "The Home Assistant Authors <hello@home-assistant.io>",
"download_url": "https://files.pythonhosted.org/packages/4b/c8/7eed41d183ae5290761b101651baf688014c4ecf4e398311dd2255a0e6b0/aiohasupervisor-0.2.1.tar.gz",
"platform": "any",
"description": "# Home Assistant Supervisor Client\n\n## Client Library for Home Assistant Supervisor\n\nPython client for interfacing with the [Home Assistant Supervisor](https://github.com/home-assistant/supervisor)\nvia its [REST API](https://developers.home-assistant.io/docs/api/supervisor/endpoints).\nCurrently used in the [Home Assistant Supervisor integration](https://www.home-assistant.io/integrations/hassio/)\nin Home Assistant.\n\nAdd-ons which interface with Supervisor can also leverage it. The library expects\nto find the access token in the `SUPERVISOR_TOKEN` env which is set automatically\nby Supervisor for add-ons. Currently there is no way to get a long-lived access\ntoken for Supervisor outside these use cases so the library's usage is limited\nto these.\n\n## Installation\n\nThe library is published on `pip` and can be installed that way:\n\n```sh\npip install aiohasupervisor\n```\n\nAnd then used via import\n\n```py\nimport asyncio\nimport supervisor_client\n\nasyncio.run(supervisor_client.info())\n```\n\nOutput would look like the example response in `/info` from [here](https://developers.home-assistant.io/docs/api/supervisor/endpoints#root)\n\n## Developing & contributing\n\n### Prerequisites\n\nThe client can interact remotely with the Home Assistant Supervisor using the\n`remote_api` add-on from the [developer add-ons repository](https://github.com/home-assistant/addons-development).\n\nAfter installing and starting the add-on, a token is shown in the `remote_api`\nadd-on log, which is needed for further development.\n\nIt is also recommended you use Visual Studio Code for development with the devcontainer\nextension. This will read the published devcontainer configuration and setup the\ndevelopment environment for you.\n\n### Get the source code\n\nFork ([https://github.com/home-assistant-libs/python-supervisor-client/fork](https://github.com/home-assistant/python-supervisor-client/fork)) or clone this repository.\n\n### Using it in development\n\nFrom within the devcontainer, open terminal and do the following:\n\n```shell\nuv pip install -e .\nexport SUPERVISOR_API_URL=http://192.168.1.2\nexport SUPERVISOR_TOKEN=replace_this_with_remote_api_token\npython examples/connectivity_test.py\n```\n\nOutput should match the example response in `/info` as shown/linked above in [Installation](#installation).\n\n**Note**: Replace the `192.168.1.2` with the IP address of your Home Assistant\ninstance running the `remote_api` add-on and use the token provided.\n\n### Contributing a change\n\n1. Create a feature branch on your fork/clone of the git repository.\n2. Commit your changes.\n3. Rebase your local changes against the `main` branch.\n4. Run test suite with the `pytest tests` command or use Test Explorer and confirm that it passes.\n5. Use `ruff` to format your code with the rules configured in this project\n6. Create a new Pull Request\n\n## Release\n\nAny time the API changes for Home Assistant Supervisor a corresponding release\nshould be published here. Once that release is available on pip a PR should be\ncreated to [Home Assistant Core](https://github.com/home-assistant/core) updating\nits [Home Assistant Supervisor integration](https://github.com/home-assistant/core/blob/dev/homeassistant/components/hassio).\nFollow the directions for updating [Requirements](https://developers.home-assistant.io/docs/creating_integration_manifest#requirements)\nin the Integration manifest.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Asynchronous python client for Home Assistant Supervisor.",
"version": "0.2.1",
"project_urls": {
"Bug Reports": "https://github.com/home-assistant-libs/python-supervisor-client/issues",
"Discord": "https://www.home-assistant.io/join-chat/",
"Docs: Dev": "https://developers.home-assistant.io/",
"Forum": "https://community.home-assistant.io/",
"Homepage": "https://www.home-assistant.io/",
"Source Code": "https://github.com/home-assistant-libs/python-supervisor-client"
},
"split_keywords": [
"docker",
" home-assistant",
" api",
" client-library"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3e483a96f8b3510d82260d0912929ef5337262659688659e1e2e87386deec8e8",
"md5": "82b18eb96f95a6bedd9b83f13a3783d9",
"sha256": "b1e17c916bc1cec13611f74851305c8901525612ac6261e6aba2b225f2b15016"
},
"downloads": -1,
"filename": "aiohasupervisor-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "82b18eb96f95a6bedd9b83f13a3783d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12.0",
"size": 33420,
"upload_time": "2024-10-31T11:25:14",
"upload_time_iso_8601": "2024-10-31T11:25:14.611576Z",
"url": "https://files.pythonhosted.org/packages/3e/48/3a96f8b3510d82260d0912929ef5337262659688659e1e2e87386deec8e8/aiohasupervisor-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4bc87eed41d183ae5290761b101651baf688014c4ecf4e398311dd2255a0e6b0",
"md5": "5e360eea07ca82c49c410f3fc202ef8b",
"sha256": "a1242165fd255796c961dadfbb88fc1f0d45f8441f8af10f42899ab478b1cbd9"
},
"downloads": -1,
"filename": "aiohasupervisor-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "5e360eea07ca82c49c410f3fc202ef8b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12.0",
"size": 34806,
"upload_time": "2024-10-31T11:25:15",
"upload_time_iso_8601": "2024-10-31T11:25:15.958902Z",
"url": "https://files.pythonhosted.org/packages/4b/c8/7eed41d183ae5290761b101651baf688014c4ecf4e398311dd2255a0e6b0/aiohasupervisor-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 11:25:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "home-assistant-libs",
"github_project": "python-supervisor-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiohasupervisor"
}