Asynchronous python client for Home Assistant Supervisor.
Actively maintained. Last release 3 weeks ago, commits in 26 of the last 26 weeks. A safe choice.
pip install aiohasupervisorHome Assistant Supervisor Client
Client Library for Home Assistant Supervisor
Python client for interfacing with the Home Assistant Supervisor via its REST API. Currently used in the Home Assistant Supervisor integration 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.
Where Supervisor provides a Unix socket, pass its path as unix_socket instead.
Supervisor identifies the caller by the socket, so no token is needed or sent:
client = SupervisorClient(unix_socket=Path(os.environ["SUPERVISOR_SOCKET"]))
Installation
The library is published on pip and can be installed that way:
pip install aiohasupervisor
And then used via import
import asyncio
import supervisor_client
asyncio.run(supervisor_client.info())
Output would look like the example response in /info from here
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.
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) or clone this repository.