Async Python client for the BLANCO Smart Home Cloud API
Project description
blanco-smart-home-api-client
Async Python client library for the BLANCO Smart Home Cloud API.
- PyPI package name:
blanco-smart-home-api-client - Import name:
blanco_smart_home_api_client - Requires: Python ≥ 3.13, aiohttp ≥ 3.9
- License: MIT
Installation
pip install blanco-smart-home-api-client
Usage
Basic setup
import aiohttp
from blanco_smart_home_api_client import BlancoApiClient
async def main() -> None:
async with aiohttp.ClientSession() as session:
client = BlancoApiClient(
session,
app_version="1.0.0", # your application version
app_build="1", # your application build number
os_version="3.13.0", # host OS / platform version string
)
# Register the app and obtain an app_id.
reg = await client.register_app("en")
print("app_id:", reg["app_id"])
# Authenticate the device.
auth = await client.authenticate(dev_id="<sha256-derived-device-id>")
print("token:", auth["token"])
# Poll device data.
status, system = await client.get_device_system("<dev_id>")
print("system params:", system["params"])
Error handling
All exceptions are subclasses of BlancoApiError:
from blanco_smart_home_api_client import (
BlancoApiClient,
BlancoAuthError,
BlancoConnectionError,
BlancoDeviceTypeError,
BlancoTokenExpiredError,
)
try:
auth = await client.authenticate(dev_id)
except BlancoAuthError:
print("Access not yet granted — open the BLANCO UNIT App")
except BlancoDeviceTypeError:
print("Device type not supported for Smart Home")
except BlancoConnectionError as err:
print("Network error:", err)
Token renewal
A BlancoTokenExpiredError is raised when any device endpoint returns HTTP 401.
Call renew_token() and then retry:
from blanco_smart_home_api_client import BlancoTokenExpiredError
try:
status, result = await client.get_device_status(dev_id)
except BlancoTokenExpiredError:
await client.renew_token(dev_id)
status, result = await client.get_device_status(dev_id)
Package Structure
blanco_smart_home_api_client/
├── __init__.py # Public API — re-exports all key types
├── client.py # BlancoApiClient — all HTTP methods
├── config.py # API stage config, endpoint constants, API keys
├── errors.py # ApiErrorCode enum + exception hierarchy
├── http_status.py # HttpStatus enum
├── log.py # BlancoLogLevel enum, LOG_LEVEL constant, blanco_log()
├── mask.py # mask_headers(), mask_dev_id(), mask_response_body()
├── models.py # BlancoErrorType, BlancoActionType, BlancoWaterType enums
└── results.py # TypedDict result types and response-parsing helpers
Available Endpoints
| Method | HTTP | Endpoint |
|---|---|---|
register_app(locale) |
POST | /apps/registrations |
update_app_locale(locale) |
PUT | /apps/registrations |
deregister_app() |
DELETE | /apps/registrations |
authenticate(dev_id) |
POST | /auth/token |
renew_token(dev_id) |
POST | /auth/token |
get_device_system(dev_id) |
GET | /devices/{dev_id}/system |
get_device_status(dev_id) |
GET | /devices/{dev_id}/status |
get_device_settings(dev_id) |
GET | /devices/{dev_id}/settings |
get_device_errors(dev_id) |
GET | /devices/{dev_id}/errors |
get_device_actions(dev_id, from_ts, count, asc) |
GET | /devices/{dev_id}/actions |
get_device_stats(dev_id, ranges) |
POST | /devices/{dev_id}/stats |
Home Assistant Integration
This library is used as the HTTP communication layer by the BLANCO Home Assistant integration. All network I/O and response parsing is handled here; the integration only orchestrates polling, state management, and HA-specific entity registration.
Authors
| Name | Role |
|---|---|
| Michael Weiss | Conception, implementation, and documentation |
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 blanco_smart_home_api_client-1.0.1.tar.gz.
File metadata
- Download URL: blanco_smart_home_api_client-1.0.1.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa314a792cc72edeab1f5f19dcf0fefce9761a38ae787ab975ed2e6c9c0c23c
|
|
| MD5 |
8531c14ae02799d4edc7e25cb4c0963e
|
|
| BLAKE2b-256 |
8695afb7369efe3ecde66715f8cdf186b8b2f7266a8b9902cc277c598a41c003
|
Provenance
The following attestation bundles were made for blanco_smart_home_api_client-1.0.1.tar.gz:
Publisher:
publish.yml on blancoGDPD/blanco-smart-home-api-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blanco_smart_home_api_client-1.0.1.tar.gz -
Subject digest:
4aa314a792cc72edeab1f5f19dcf0fefce9761a38ae787ab975ed2e6c9c0c23c - Sigstore transparency entry: 1317352721
- Sigstore integration time:
-
Permalink:
blancoGDPD/blanco-smart-home-api-client@b581e190fc223e86158f3a36651500257d969fd2 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/blancoGDPD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b581e190fc223e86158f3a36651500257d969fd2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file blanco_smart_home_api_client-1.0.1-py3-none-any.whl.
File metadata
- Download URL: blanco_smart_home_api_client-1.0.1-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb1ecbbf40a689626476be6418f46809f9d944cf1d1a1d486f08ced0d7be7804
|
|
| MD5 |
ddea6d048b3a05e98389db53357bafe6
|
|
| BLAKE2b-256 |
33372e15f5a62fcc8317ec7c9e17aa0e763d9b08b506bdbd93cfaec6824af675
|
Provenance
The following attestation bundles were made for blanco_smart_home_api_client-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on blancoGDPD/blanco-smart-home-api-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blanco_smart_home_api_client-1.0.1-py3-none-any.whl -
Subject digest:
fb1ecbbf40a689626476be6418f46809f9d944cf1d1a1d486f08ced0d7be7804 - Sigstore transparency entry: 1317352744
- Sigstore integration time:
-
Permalink:
blancoGDPD/blanco-smart-home-api-client@b581e190fc223e86158f3a36651500257d969fd2 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/blancoGDPD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b581e190fc223e86158f3a36651500257d969fd2 -
Trigger Event:
release
-
Statement type: