Python library for Heiman smart home devices
Project description
Heiman Connect Library
Python library for communicating with Heiman smart home devices.
Installation
pip install heiman-connect
Usage
import asyncio
from heimanconnect import HeimanAuth, HeimanCloudClient, HeimanHttpClient
from heimanconnect.models import AuthInfo
async def main():
# Initialize OAuth client
oauth_client = HeimanOauthClient(
client_id="app",
redirect_url="http://localhost:8123/auth/external_callback",
)
# Generate auth URL for user authorization
auth_url = oauth_client.gen_auth_url()
print(f"Authorize at: {auth_url}")
# After getting code from OAuth callback
auth_info = await oauth_client.get_access_token_async(code="your_code")
# Create HTTP client
http_client = HeimanHttpClient(
api_url="https://api.heiman.cn",
client_id="app",
access_token=auth_info.access_token,
)
# Create cloud client
auth = HeimanAuth(oauth_client, auth_info)
cloud_client = HeimanCloudClient(http_client, auth)
# Get homes
homes = await cloud_client.async_get_homes()
# Get devices
devices = await cloud_client.async_get_devices(home_id=homes[0].home_id)
# Control device
await cloud_client.async_control_device(
device_id=device_id,
property_identifier="Switch",
value=True,
)
asyncio.run(main())
Features
- OAuth2 authentication
- HTTP API client
- MQTT real-time communication
- Device management
- Property control
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
heiman_connect-1.0.0.tar.gz
(10.8 kB
view details)
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 heiman_connect-1.0.0.tar.gz.
File metadata
- Download URL: heiman_connect-1.0.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49c9e011fa3321f28e694fb45847e6c81a3fbe8bf9fe963b2dddc9cc7f63dfd8
|
|
| MD5 |
47f50d95cb792661597fba06f7684094
|
|
| BLAKE2b-256 |
a6ab3a72515f0459ee2108b5fca0f41f634e5512f244239dcd82f07b97387bfb
|
File details
Details for the file heiman_connect-1.0.0-py3-none-any.whl.
File metadata
- Download URL: heiman_connect-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e8ca051c3fc622afc5ab88751eb153273f89dea5c552f785ca3d1df01959b5a
|
|
| MD5 |
de389356a14ef8973d260692bdbab1c0
|
|
| BLAKE2b-256 |
cab14fa144a7a8cd99a484ef0dbe5a61ed48fb5796997b08d839d3f1067ed0f7
|