Asynchronous Home Assistant Supervisor Client
aiohasupervisor is an asynchronous Python client designed for interfacing with the Home Assistant Supervisor's REST API. It is currently at version 0.4.3 and is actively maintained, with a release cadence tied to the development and releases of Home Assistant itself, as it's primarily used within the Home Assistant ecosystem, particularly by its Supervisor integration and add-ons.
Common errors
-
aiohasupervisor.exceptions.SupervisorTimeoutError: Timeout connecting to Supervisor
cause The client could not establish a connection or receive a response from the Home Assistant Supervisor within the allotted time. This can be due to network issues, an overloaded Supervisor, incorrect `SUPERVISOR_API_URL`, or an unavailable Supervisor instance.fixVerify network connectivity to the Home Assistant Supervisor. Check the `SUPERVISOR_API_URL` environment variable if configured. Ensure the Home Assistant Supervisor is running and responsive. Increase the client's timeout if necessary, though this typically points to an underlying connectivity or performance issue. -
AttributeError: module 'aiohasupervisor.models' has no attribute 'IngressPanel'
cause Attempting to import `IngressPanel` from `aiohasupervisor.models` in newer versions of the library, especially when Home Assistant Core is run in a venv without Supervisor, as the `hassio` integration might still attempt this import.fixIf developing a custom component or modifying Home Assistant Core in a venv, consider adding a try-except block around the `IngressPanel` import. Alternatively, creating an empty `custom_component/hassio/__init__.py` can prevent the problematic `hassio` integration bootstrap. -
aiohasupervisor.exceptions.SupervisorBadRequestError: Update of Supervisor failed: Can't install ghcr.io/home-assistant/...: 500 Server Error for http+docker://localhost/v1.47/images/create?tag=...: Internal Server Error
cause This error often occurs during Supervisor updates and can be related to issues with the Docker daemon, image pulls from `ghcr.io` (e.g., rate limits), or an internal Supervisor error during the update process.fixReboot the host machine or at least the Home Assistant Supervisor. Check Supervisor logs for more specific errors. If related to `ghcr.io` rate limits, waiting and retrying may resolve the issue.
Warnings
- breaking The `IngressPanel` class was removed from `aiohasupervisor.models`. Home Assistant Core installations (especially venv) starting from 2026.4 might fail to start if they incorrectly try to import this class via the `hassio` integration.
- gotcha The library heavily relies on `SUPERVISOR_TOKEN` and optionally `SUPERVISOR_API_URL` environment variables for authentication and endpoint discovery. Without these, the client cannot connect to the Home Assistant Supervisor.
- deprecated Older versions of `aiohasupervisor` (e.g., 0.2.2b5) were sometimes included as pre-release dependencies in Home Assistant Core, causing issues with dependency resolvers like `uv`.
Install
-
pip install aiohasupervisor
Imports
- Client
from aiohasupervisor.client import Client
- SupervisorTimeoutError
from aiohasupervisor.exceptions import SupervisorTimeoutError
- SupervisorBadRequestError
from aiohasupervisor.exceptions import SupervisorBadRequestError
- IngressPanel
from aiohasupervisor.models import IngressPanel (if running HA Core 2026.4+ in venv without Supervisor)
from aiohasupervisor.models import IngressPanel
Quickstart
import asyncio
import os
from aiohasupervisor.client import Client
async def get_supervisor_info():
# The SUPERVISOR_TOKEN environment variable is automatically set for Home Assistant add-ons.
# For remote development/testing, use the remote_api add-on to get a token and set SUPERVISOR_API_URL.
supervisor_token = os.environ.get('SUPERVISOR_TOKEN', 'YOUR_SUPERVISOR_TOKEN')
supervisor_api_url = os.environ.get('SUPERVISOR_API_URL', 'http://supervisor/core') # Default for add-ons
if supervisor_token == 'YOUR_SUPERVISOR_TOKEN':
print("Warning: SUPERVISOR_TOKEN not set. This example may not work without a valid token.")
print("Please refer to the aiohasupervisor GitHub for development setup with remote_api add-on.")
return
async with Client(supervisor_api_url, supervisor_token) as client:
try:
info = await client.info()
print("Supervisor Info:", info)
except Exception as e:
print(f"Error fetching Supervisor info: {e}")
if __name__ == "__main__":
asyncio.run(get_supervisor_info())