Bosch Smart Home Controller Python Library
raw JSON → 0.2.111 verified Fri May 01 auth: no python
A Python library to interact with the Bosch Smart Home Controller (SHC) API. Version 0.2.111. Development seems active on GitHub with regular updates.
pip install boschshcpy Common errors
error ModuleNotFoundError: No module named 'boschshcpy' ↓
cause Library not installed or installed in wrong environment.
fix
Run
pip install boschshcpy in your Python environment. error boschshcpy.exceptions.ShcConnectionException: Connection to Bosch SHC failed ↓
cause Host address or password is incorrect, or the SHC is not reachable.
fix
Verify the IP/hostname and password. Ensure the SHC is on the same network and TLS is not blocked.
error ImportError: cannot import name 'BoschShcClient' from 'boschshcpy' ↓
cause Older version of the library where the class was named differently or not exported.
fix
Upgrade to latest:
pip install --upgrade boschshcpy Warnings
gotcha The library uses async/await throughout. Synchronous calls will block the event loop. Ensure you run all methods within an async context. ↓
fix Use asyncio.run() or an async framework like aiohttp.
deprecated The method `get_scenarios()` was deprecated in v0.2.100 and replaced by `get_scenes()`. ↓
fix Use `client.get_scenes()` instead.
broken In older versions (<0.2.80), the import path for device classes was inside `boschshcpy.device`. This was changed to `boschshcpy` directly. ↓
fix Update to latest version and import from `boschshcpy`.
Imports
- BoschShcClient wrong
from boschshcpy.client import BoschShcClientcorrectfrom boschshcpy import BoschShcClient - BoschShcSession
from boschshcpy import BoschShcSession
Quickstart
import asyncio
import os
from boschshcpy import BoschShcClient, BoschShcSession
async def main():
# Use environment variables for credentials
host = os.environ.get('BOSCH_SHC_HOST', '192.168.1.100')
password = os.environ.get('BOSCH_SHC_PASSWORD', '')
# For first-time setup, you need to register a client
# This example assumes you have already registered and have credentials
session = BoschShcSession(host, password)
client = BoschShcClient(session)
# Connect and retrieve devices
await client.initialize()
devices = await client.get_devices()
for device in devices:
print(f"{device.name}: {device.device_model}")
await client.close()
asyncio.run(main())