Skip to main content

HomeassistantAPI

Code Coverage PyPI - Downloads GitHub commits since latest release (by date including pre-releases) Read the Docs (version) GitHub release (latest by date)

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

homeassistant_api-6.1.0.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

homeassistant_api-6.1.0-py3-none-any.whl (54.7 kB view details)

Uploaded Python 3

File details

Details for the file homeassistant_api-6.1.0.tar.gz.

File metadata

  • Download URL: homeassistant_api-6.1.0.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for homeassistant_api-6.1.0.tar.gz
Algorithm Hash digest
SHA256 bd80445fd40fb45a4b68a344908d38ce8bb3092c4a75d307e53a6683e75ae4cc
MD5 057d0e1a9da3f7a3f8db819eb020b025
BLAKE2b-256 87ccc091ab71122ac24ec12793757e9cb2009cd835c7b64ee465d97ba9513f8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for homeassistant_api-6.1.0.tar.gz:

Publisher: python-publish.yml on HomeAssistant-API/HomeAssistantAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file homeassistant_api-6.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for homeassistant_api-6.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83eb3aa94ec70ad6fa46afb74863f83f9697cacf574ec81a24396aab930a47e1
MD5 ed287f35730fa38eff40f8c74af8d82b
BLAKE2b-256 daf8c6f74e777f6efbb50d82ebca591b580ba0dbfc1a23489c5b4082e56a8dde

See more details on using hashes here.

Provenance

The following attestation bundles were made for homeassistant_api-6.1.0-py3-none-any.whl:

Publisher: python-publish.yml on HomeAssistant-API/HomeAssistantAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

6.1.0 This release

2 files

6.0.1

2 files

6.0.0

2 files

5.0.3

2 files

5.0.2.post2

2 files

5.0.2.post1

2 files

5.0.2

2 files

5.0.1

2 files

5.0.0

2 files

4.2.2.post2

2 files

4.2.2.post1

2 files

4.2.2

2 files

4.2.1

2 files

4.1.1.post2

2 files

4.1.1.post1

2 files

4.1.1

2 files

4.1.0

2 files

4.0.1

2 files

4.0.0.post2

3 files

4.0.0.post1

2 files

4.0.0

2 files

3.0.4

2 files

3.0.3.post5

2 files

3.0.3.post4

2 files

3.0.3.post3

2 files

3.0.3.post2

2 files

3.0.3.post1

2 files

3.0.3

2 files

3.0.2

2 files

3.0.0

2 files

2.4.0.post2

2 files

2.4.0.post1

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

0.1.2

2 files

0.1.1.post2

2 files

0.1.1.post1

2 files

0.1.1

2 files

0.1.0

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page