Python-homely
Async Python client for the Homely cloud API and realtime websocket updates.
This package was created for the Homely Home Assistant integration, but it is framework-independent and can be used in any Python project that needs to talk to Homely.
Features
- Login and token refresh
- Location and home-data fetches
- Realtime websocket updates
- Typed exceptions
- Async API built on
aiohttp
Installation
python3 -m pip install python-homely
Quick Start
import aiohttp
from homely import HomelyClient
async def main() -> None:
async with aiohttp.ClientSession() as session:
client = HomelyClient(session)
token = await client.authenticate("user@example.com", "password")
locations = await client.get_locations_or_raise(token.access_token)
location_id = locations[0]["locationId"]
data = await client.get_home_data_or_raise(token.access_token, location_id)
print(data["name"])
Websocket Example
import aiohttp
from homely import HomelyClient, HomelyWebSocket
async def on_update(event: dict) -> None:
print(event)
async def main() -> None:
async with aiohttp.ClientSession() as session:
client = HomelyClient(session)
token = await client.authenticate("user@example.com", "password")
locations = await client.get_locations_or_raise(token.access_token)
location_id = locations[0]["locationId"]
websocket = HomelyWebSocket(
location_id=location_id,
token=token.access_token,
on_data_update=on_update,
context_id="example",
)
await websocket.connect_or_raise()
Main API
authenticate(username, password) -> TokenResponserefresh_access_token(refresh_token) -> TokenResponsefetch_token_details(username, password) -> TokenEndpointResultfetch_refresh_token_details(refresh_token) -> TokenEndpointResultget_locations_or_raise(token) -> list[dict]get_home_data_or_raise(token, location_id) -> dictHomelyWebSocket(...).connect_or_raise()
Legacy compatibility helpers remain available:
fetch_token_with_reason(username, password) -> tuple[dict | None, str | None]fetch_token(username, password) -> dict | Nonefetch_refresh_token(refresh_token) -> dict | None
Main exports:
HomelyClientHomelyWebSocketTokenEndpointResultTokenResponseHomelyConnectionErrorHomelyAuthErrorHomelyResponseErrorHomelyWebSocketError
Exceptions
HomelyConnectionError: network or service unavailableHomelyAuthError: invalid credentials or rejected tokenHomelyResponseError: unexpected response or HTTP failure Carriesstatusandbody_previewwhen available.HomelyWebSocketError: websocket could not be established
Token Diagnostics
If you need more than success/failure, use the detailed token helpers:
result = await client.fetch_refresh_token_details(refresh_token)
if result.ok:
print(result.token.access_token)
else:
print(result.reason, result.status, result.detail, result.body_preview)
TokenEndpointResult.reason can distinguish between invalid credentials, invalid refresh
tokens, network errors, timeouts, malformed JSON, malformed payloads, empty responses, and
unexpected HTTP failures.
Websocket Note
Refreshing an access token does not require forcing an already-connected websocket to reconnect. The websocket token only matters when a new websocket connection is established or re-established.
License
MIT. See LICENSE.
⭐ If you find this package useful, please consider giving it a star on GitHub! ⭐
Metadata
Release files for python-homely 0.1.10
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 | |
|---|---|---|---|---|
| python_homely-0.1.10.tar.gz | 18.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_homely-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.2 kB
Release files / python_homely-0.1.10.tar.gz
| Download URL | python_homely-0.1.10.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23460e2aa36bb57d5cb1a0de60b22acf6ca9b813596845db06e577f89246b9e6
|
|
BLAKE2b-256 checksum How to use checksums |
282d2f06f3d3859e72d47e02c3d21c4013f1c0c264263ffdcfb24c4233832115
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 21, 2026.
Transparency logRelease files / python_homely-0.1.10-py3-none-any.whl
| Download URL | python_homely-0.1.10-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7648440934a854a8fb141f66efe8922317490134d381f2f62ec7ae510ab1f02c
|
|
BLAKE2b-256 checksum How to use checksums |
73ada141f1e862a01eb1c0bbd8640ab641e199cfb152f94c932457cd83f01d8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 21, 2026.
Transparency logSecurity for python-homely 0.1.10
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for python_homely-0.1.10.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 Oct 21, 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.