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.1.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.1-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for homismart_client-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ccf5c22b14fb97cd54e07cf786f7cedb2b93dd7c1d143bfef4d545b23d9afb26
MD5 41adaa9e32b2c0517b3b72ab5db4266b
BLAKE2b-256 5f6d4bca02ea9a2eaea7f3748b933cdc0ff26e64f889aa242d84689111052fd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for homismart_client-0.2.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for homismart_client-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40ed6395bc7353418bcb4e0c4a648062ab5072e8998555fc48afc74b065e632e
MD5 683b4621323758673313a976c1d1efeb
BLAKE2b-256 aa720eaef05d4a2f33d0c59a90872d767628adf75db7a0f6ca99dea7f520d78d

See more details on using hashes here.

Provenance

The following attestation bundles were made for homismart_client-0.2.1-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