ConnectLife Cloud API client library for Home Assistant integrations
Project description
ConnectLife Cloud API Client
A Python client library for the ConnectLife Cloud API, designed for Home Assistant integrations.
Features
- Async/await support
- Full type hints
- Comprehensive error handling
- Device management
- Real-time status updates
- Power consumption tracking
- Self-check diagnostics
Installation
pip install connectlife-cloud
Usage
import asyncio
from connectlife_cloud import ConnectLifeCloudClient
async def main():
client = ConnectLifeCloudClient(
client_id="your_client_id",
client_secret="your_client_secret"
)
try:
# Get devices
devices = await client.get_devices(access_token="your_token")
print(f"Found {len(devices)} devices")
# Control a device
result = await client.control_device(
puid="device_puid",
properties={"power": True, "mode": "cool"},
access_token="your_token"
)
print(f"Control result: {result}")
finally:
await client.close()
asyncio.run(main())
API Reference
ConnectLifeCloudClient
The main client class for interacting with the ConnectLife Cloud API.
Methods
get_devices(access_token): Get list of devicescontrol_device(puid, properties, access_token): Control a deviceget_property_list(device_type_code, device_feature_code, access_token): Get device propertiesquery_static_data(puid, access_token): Query static device dataget_hour_power(date, puid, access_token): Get hourly power consumptionget_self_check(no_record, puid, access_token): Get device self-check infoget_devices_with_parsers(access_token): Get devices with their parsersparse_device_status(device_id, status): Parse device status using appropriate parser
Mode Converter
Utilities for converting device mode descriptions (Chinese or English) to standard Home Assistant strings.
HVAC Mode Functions:
convert_mode_to_ha_string(mode_description): Convert HVAC mode description to HA standard stringget_ha_mode_string(value_map, device_value): Get HA HVAC mode string from device value mapfind_device_value_for_ha_mode(value_map, ha_mode_string): Find device value for given HA mode (reverse lookup)
Fan Mode Functions:
convert_fan_mode_to_ha_string(fan_description): Convert fan mode description to HA standard stringget_ha_fan_mode_string(value_map, device_value): Get HA fan mode string from device value mapfind_device_value_for_ha_fan_mode(value_map, ha_fan_mode_string): Find device value for given HA fan mode (reverse lookup)
The library handles bilingual support internally, converting Chinese descriptions (自动, 制冷, 制热, etc.) to standard English strings that can be directly used with Home Assistant enums like HVACMode("auto").
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
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 connectlife_cloud-0.3.5.tar.gz.
File metadata
- Download URL: connectlife_cloud-0.3.5.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30e7b16f9882c94a188cb9406c8bd8517f9df2e011703f32ba4db830f0df9c75
|
|
| MD5 |
d7e8305fed73d8b98fbc4fa1b52e3364
|
|
| BLAKE2b-256 |
53e804b407d83a64d62ab731fe262212e66314b0e10301da9d28d2e40678c3b1
|
File details
Details for the file connectlife_cloud-0.3.5-py3-none-any.whl.
File metadata
- Download URL: connectlife_cloud-0.3.5-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7174f9436062364aa6cf72fbfc58ce6124919470522fdf1b6ef956ae97e485ec
|
|
| MD5 |
b4a4bbede9c0d700b717b1b8cf7555cf
|
|
| BLAKE2b-256 |
dd8314b11dcc5e3eb17848694210dd2fbe0cc993f1eae1a9e8a240b56beddd79
|