ha-xthings-cloud
Async Python client for the Xthings Cloud API, designed for Home Assistant integration.
Installation
pip install ha-xthings-cloud
Usage
API Client
import aiohttp
from ha_xthings_cloud import XthingsCloudApiClient
async with aiohttp.ClientSession() as session:
client = XthingsCloudApiClient(session)
# Login (supports 2FA)
result = await client.async_login("user@example.com", "password")
# Get devices
devices = await client.async_get_devices()
# Control devices
await client.async_switch_on("device-uuid")
await client.async_brite_brightness("device-uuid", 80)
await client.async_lock_lock("device-uuid")
WebSocket (Real-time Push)
from ha_xthings_cloud import XthingsCloudWebSocket
def on_status(device_uuid, status):
print(f"Device {device_uuid}: {status}")
async def on_token_expired():
# refresh token logic
pass
ws = XthingsCloudWebSocket(session, token, on_status, on_token_expired)
await ws.async_start()
KVS Signaling (Camera WebRTC)
from ha_xthings_cloud import KvsSignalingClient
kvs = KvsSignalingClient(session, region, channel_arn, credentials)
answer_sdp = await kvs.async_get_answer_sdp(offer_sdp, on_ice_candidate=callback)
Features
- Async HTTP client with
aiohttp.ClientSessioninjection - Authentication: login, token refresh, 2FA (email/phone)
- Device control: Switch, Plug, Light (brightness/HS color/color temp), Lock, Camera
- WebSocket: real-time device status push with auto-reconnect
- KVS Signaling: AWS Kinesis Video Streams WebRTC SDP exchange with SigV4 auth
- FRP remote access configuration
API Reference
XthingsCloudApiClient
| Method | Description |
|---|---|
async_login(email, password, ...) |
Login with optional 2FA |
async_refresh_token(refresh_token) |
Refresh auth token |
async_get_devices() |
Get device list |
async_get_device_status(device_id) |
Get single device status |
async_switch_on/off(device_id) |
Switch control |
async_plug_on/off(device_id) |
Plug control |
async_brite_on/off(device_id) |
Light on/off |
async_brite_brightness(device_id, brightness) |
Light brightness (0-100) |
async_brite_color(device_id, color) |
Light color (HS/color temp) |
async_lock_lock/unlock(device_id) |
Lock control |
async_get_camera_webrtc(device_id) |
Get camera KVS credentials |
async_get_frp_config(client_id) |
Get FRP remote access config |
XthingsCloudWebSocket
| Method | Description |
|---|---|
async_start() |
Start WebSocket with auto-reconnect |
async_stop() |
Stop WebSocket connection |
KvsSignalingClient
| Method | Description |
|---|---|
async_get_answer_sdp(offer_sdp, on_ice_candidate) |
SDP offer/answer exchange |
async_send_ice_candidate(candidate, sdp_mid, sdp_mline_index) |
Send ICE candidate |
async_get_ice_server_config() |
Get TURN/STUN servers |
async_close() |
Close signaling connection |
License
Apache-2.0
Metadata
Release files for ha-xthings-cloud 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ha_xthings_cloud-1.0.5.tar.gz | 11.4 kB | With provenance | Details for ha_xthings_cloud-1.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ha_xthings_cloud-1.0.5-py3-none-any.whl | Python 3 | none | any | Details for ha_xthings_cloud-1.0.5-py3-none-any.whl |
Total release size: 24.0 kB
Release files / ha_xthings_cloud-1.0.5.tar.gz
| Download URL | ha_xthings_cloud-1.0.5.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60109c9d4377599f32d7971489e3a1cc999ea44c9c344b848e41295210144e7d
|
|
BLAKE2b-256 checksum How to use checksums |
e49fe488d6fac9b520526bf058535f9449ae44863467572b009aa55ab7eeb043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / ha_xthings_cloud-1.0.5-py3-none-any.whl
| Download URL | ha_xthings_cloud-1.0.5-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4b91870efb1d9e45a1b69be35efeeef940d214593316e2e4785b49e5bb25f51
|
|
BLAKE2b-256 checksum How to use checksums |
6d7d07c5785c438bd6967688cbaaa71adac48f5b8539f84c26174680503c72c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logSecurity for ha-xthings-cloud 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ha_xthings_cloud-1.0.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.