Python client for Homismart WebSocket API
Project description
Homismart Client (Unofficial Python Library)
⚠️ Disclaimer: This is an unofficial, community-driven library. It is not affiliated with, authorized, or endorsed by Homismart or its parent company. Use at your own risk — changes to Homismart's API may break functionality without notice.
A Python library for interacting with Homismart smart home devices via their WebSocket API. This client was developed by reverse-engineering the protocol used by the official Homismart web application.
Features
- Asynchronous API using
asyncioandwebsockets. - Login and session handling for Homismart accounts.
- Real-time device updates via WebSocket.
- Object-oriented interface for:
- Switchable devices (sockets, lights)
- Curtain/shutter controls
- Door locks
- Hubs
- Custom event system for reacting to device changes, session status, or errors.
- Built-in reconnection and redirection handling.
Installation
pip install homismart-client
Or from source:
git clone https://github.com/krafman/homismart-client.git
cd homismart-client
pip install .
✅ All dependencies (e.g.
websockets,python-dotenv) will be installed automatically.
Quick Start
1. Set your credentials
You can use environment variables or a .env file:
export HOMISMART_USERNAME="your_email@example.com"
export HOMISMART_PASSWORD="your_password"
Or create a .env file:
HOMISMART_USERNAME="your_email@example.com"
HOMISMART_PASSWORD="your_password"
And in your Python script:
from dotenv import load_dotenv
load_dotenv()
2. Connect and control devices
import asyncio
from homismart_client import HomismartClient
async def main():
async with HomismartClient() as client:
await client.login()
devices = client.session.get_all_devices()
for device in devices:
print(f"{device.name} ({device.device_type}): {device.online}")
if device.supports_on_off:
await device.turn_on()
asyncio.run(main())
Event Handling Example
You can register callbacks to respond to device changes:
def on_update(device):
print(f"{device.name} updated: {device}")
client.session.register_event_listener("device_updated", on_update)
Project Status
This project is currently in Alpha. The protocol is still being reverse-engineered and APIs may change between versions.
Requirements
- Python 3.8+
websockets>=10.0,<13.0python-dotenv>=1.0.0
License
MIT © Adir Krafman
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file homismart_client-0.1.4.tar.gz.
File metadata
- Download URL: homismart_client-0.1.4.tar.gz
- Upload date:
- Size: 35.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91bba5056581d0de9af4e8887883325561a6843384db13f995a2143d51c0e69b
|
|
| MD5 |
082d5e20ec69fc230be57ef96076316e
|
|
| BLAKE2b-256 |
56a5aeae501449b26406edbc42252d43cd9bc18e384f9a7a511996d7f82dc053
|
Provenance
The following attestation bundles were made for homismart_client-0.1.4.tar.gz:
Publisher:
python-publish.yml on Krafman/homismart-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
homismart_client-0.1.4.tar.gz -
Subject digest:
91bba5056581d0de9af4e8887883325561a6843384db13f995a2143d51c0e69b - Sigstore transparency entry: 232205407
- Sigstore integration time:
-
Permalink:
Krafman/homismart-client@0d889d1ac0d933095fc227138dd8153a32f9a25a -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/Krafman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0d889d1ac0d933095fc227138dd8153a32f9a25a -
Trigger Event:
release
-
Statement type:
File details
Details for the file homismart_client-0.1.4-py3-none-any.whl.
File metadata
- Download URL: homismart_client-0.1.4-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
933225628ccf23866332f155712d52d291a28d17212433dd05f28535232e9832
|
|
| MD5 |
ae7a1e093da3ca45fb36ed87e560b206
|
|
| BLAKE2b-256 |
92aad3960dbf8d193874fc21b6ae4210fb4e5879423b1547d1c7c007912b8814
|
Provenance
The following attestation bundles were made for homismart_client-0.1.4-py3-none-any.whl:
Publisher:
python-publish.yml on Krafman/homismart-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
homismart_client-0.1.4-py3-none-any.whl -
Subject digest:
933225628ccf23866332f155712d52d291a28d17212433dd05f28535232e9832 - Sigstore transparency entry: 232205408
- Sigstore integration time:
-
Permalink:
Krafman/homismart-client@0d889d1ac0d933095fc227138dd8153a32f9a25a -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/Krafman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@0d889d1ac0d933095fc227138dd8153a32f9a25a -
Trigger Event:
release
-
Statement type: