Skip to main content

Python client for Homismart WebSocket API

Project description

Homismart Client (Unofficial Python Library)

PyPI - Version Python Versions License GitHub stars GitHub last commit

⚠️ 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 asyncio and websockets.
  • 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.0
  • python-dotenv>=1.0.0

License

forthebadge

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

homismart_client-0.2.0.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

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

homismart_client-0.2.0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file homismart_client-0.2.0.tar.gz.

File metadata

  • Download URL: homismart_client-0.2.0.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for homismart_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 586a914e07689b14c826de6f53d9f19ffbc6722c14c6f4b5bcefd6dfec5fadfe
MD5 00c6520a3597bfe8a716d3d3cf4c4d4f
BLAKE2b-256 00da2eb7c4bb91b20c51210cfecfb076d7b13116bc2dcfe5d6e9e7714d79fd9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for homismart_client-0.2.0.tar.gz:

Publisher: python-publish.yml on Krafman/homismart-client

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

File details

Details for the file homismart_client-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for homismart_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6361e72497d0c5c09cb46f6de48cbd7e4d8d229b339e940568bb03e37d320c06
MD5 78ad6746537ca451509d2cbd828a58ab
BLAKE2b-256 c180fe55ed4cae4270583ee7a7de8103914985e0295d464eef65d16b73f6ffb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for homismart_client-0.2.0-py3-none-any.whl:

Publisher: python-publish.yml on Krafman/homismart-client

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page