HomeassistantAPI
Python wrapper for Homeassistant's Websocket API and REST API
Note: As of this comment the REST API is not getting any new features or endpoints. However, it is not going to be deprecated according to this comment But it is recommended to use the Websocket API for new integrations.
REST API Examples
from homeassistant_api import Client
with Client(
"<API Server URL>", # i.e. 'http://homeassistant.local:8123/api/'
"<Your Long Lived Access-Token>",
) as client:
client.trigger_service("light", "turn_on", entity_id="light.living_room")
All four client classes share the same method names.
The async clients (AsyncClient, AsyncWebsocketClient) use async def methods that you await.
import asyncio
from homeassistant_api import AsyncClient
async def main():
async with AsyncClient(
"<REST API Server URL>", # i.e. 'http://homeassistant.local:8123/api/'
"<Your Long Lived Access-Token>",
) as client:
await client.trigger_service("light", "turn_on", entity_id="light.living_room")
asyncio.run(main())
Websocket API Example
from homeassistant_api import WebsocketClient
with WebsocketClient(
"<WS API Server URL>", # i.e. 'ws://homeassistant.local:8123/api/websocket'
"<Your Long Lived Access-Token>",
) as ws_client:
ws_client.trigger_service("light", "turn_on", entity_id="light.living_room")
Documentation
All documentation, API reference, contribution guidelines and pretty much everything else you'd want to know is on our readthedocs site here
If there is something missing, open an issue and let us know! Thanks!
Go make some cool stuff! Maybe come back and tell us about it in a discussion? We'd love to hear about how you use our library!!
License
This project is under the GNU GPLv3 license, as defined by the Free Software Foundation.
Metadata
Release files for HomeAssistant-API 6.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| homeassistant_api-6.1.0.tar.gz | 44.5 kB | With provenance | Details for homeassistant_api-6.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| homeassistant_api-6.1.0-py3-none-any.whl | Python 3 | none | any | Details for homeassistant_api-6.1.0-py3-none-any.whl |
Total release size: 99.2 kB
Release files / homeassistant_api-6.1.0.tar.gz
| Download URL | homeassistant_api-6.1.0.tar.gz |
|---|---|
| Size | 44.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd80445fd40fb45a4b68a344908d38ce8bb3092c4a75d307e53a6683e75ae4cc
|
|
BLAKE2b-256 checksum How to use checksums |
87ccc091ab71122ac24ec12793757e9cb2009cd835c7b64ee465d97ba9513f8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / homeassistant_api-6.1.0-py3-none-any.whl
| Download URL | homeassistant_api-6.1.0-py3-none-any.whl |
|---|---|
| Size | 54.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83eb3aa94ec70ad6fa46afb74863f83f9697cacf574ec81a24396aab930a47e1
|
|
BLAKE2b-256 checksum How to use checksums |
daf8c6f74e777f6efbb50d82ebca591b580ba0dbfc1a23489c5b4082e56a8dde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logSecurity for HomeAssistant-API 6.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for homeassistant_api-6.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.