Home Connect Async
raw JSON → 0.8.5 verified Mon Apr 27 auth: no python
Async Python SDK for the BSH Home Connect API, providing access to home appliances like ovens, dishwashers, and washing machines. Current version 0.8.5, active development, monthly releases.
pip install home-connect-async Common errors
error AttributeError: module 'home_connect_api' has no attribute 'HomeConnectAPI' ↓
cause Incorrect import path: using 'home_connect_api' as module but not importing class correctly.
fix
Use: from home_connect_api import HomeConnectAPI
error TypeError: object HomeConnectAPI can't be used in 'await' expression ↓
cause Trying to await the class constructor or non-async method.
fix
Ensure methods like get_appliances() are awaited: await api.get_appliances()
error aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized' ↓
cause Expired or invalid OAuth token, or missing client credentials.
fix
Re-authenticate: provide valid client_id and client_secret, and refresh the token.
Warnings
deprecated The `settings` property on HomeAppliance may be deprecated; use `get_settings()` method instead. ↓
fix Replace `appliance.settings` with `await appliance.get_settings()`.
gotcha SSE events must be processed in an async loop; failing to start the event loop will cause no events to be received. ↓
fix Ensure you call `api.start_events()` and run the loop with asyncio.run() or similar.
gotcha OAuth tokens expire and are not auto-refreshed. You must handle token refresh yourself. ↓
fix Implement token refresh logic using the `refresh_token` property and `refresh_access_token()` method.
breaking In version 0.8.0, health monitoring was refactored; `HealthMonitor` now requires explicit instance creation. ↓
fix If you used `api.health_monitor`, instantiate `HealthMonitor(api)` instead.
Imports
- HomeConnectAPI wrong
from homeconnect import HomeConnectAPIcorrectfrom home_connect_api import HomeConnectAPI
Quickstart
import asyncio
import os
from home_connect_api import HomeConnectAPI
async def main():
api = HomeConnectAPI(
client_id=os.environ.get('HC_CLIENT_ID', ''),
client_secret=os.environ.get('HC_CLIENT_SECRET', '')
)
appliances = await api.get_appliances()
for appliance in appliances:
print(f"Appliance: {appliance.name}")
if __name__ == "__main__":
asyncio.run(main())