Async Python client for the Daikin Onecta cloud API
Actively maintained. Last release 6 days ago, commits in 6 of the last 26 weeks. A safe choice.
pip install daikin-onectadaikin-onecta
Async Python client for the Daikin Onecta cloud API.
This library contains the Daikin-specific API layer used by the Home Assistant Daikin Onecta integration. It deliberately has no dependency on Home Assistant.
Usage
import aiohttp
from daikin_onecta import OnectaClient
async def token_provider() -> str:
return "access-token"
async with aiohttp.ClientSession() as session:
client = OnectaClient(session, token_provider)
devices = await client.get_gateway_devices()
Authentication is supplied by an asynchronous token callback so applications remain responsible for their own OAuth flow and token refresh.
Errors
Requests raise typed exceptions instead of returning error sentinel values:
OnectaAuthenticationErrorfor HTTP 401 and 403 responses;OnectaRateLimitErrorfor HTTP 429 responses;OnectaApiErrorfor other unsuccessful HTTP responses;OnectaResponseErrorwhen a successful response has an invalid body;OnectaConnectionErrorfor transport failures.
All request errors provide their HTTP method and relative API path.
OnectaRateLimitError.rate_limit contains the immutable rate-limit snapshot
returned with the rejected response, including retry_after.
Status
The API is currently alpha. The first release intentionally exposes gateway devices as raw dictionaries while the stable typed device model is developed.