Getting Started¶
Installation¶
Configuration¶
Create a BSBLANConfig object with your device connection details:
from bsblan import BSBLAN, BSBLANConfig
config = BSBLANConfig(
host="192.168.1.100",
passkey=None, # Set if your device uses passkey auth
username=None, # Set for username/password auth
password=None,
)
Security
Never hard-code credentials in your source code. Use environment variables or a secrets manager instead.
Basic usage¶
import asyncio
from bsblan import BSBLAN, BSBLANConfig
async def main() -> None:
config = BSBLANConfig(host="192.168.1.100")
async with BSBLAN(config) as client:
# Read current heating state
state = await client.state()
print(f"HVAC Mode: {state.hvac_mode.desc}")
print(f"Current Temp: {state.current_temperature.value}")
# Read sensor data
sensor = await client.sensor()
print(f"Outside Temp: {sensor.outside_temperature.value}")
# Set thermostat
await client.thermostat(target_temperature="21.5")
# Get device info
device = await client.device()
print(f"Device: {device.name} v{device.version}")
asyncio.run(main())
Hot water control¶
from bsblan import SetHotWaterParam
async with BSBLAN(config) as client:
# Read hot water state
hw_state = await client.hot_water_state()
print(f"DHW Mode: {hw_state.operating_mode.desc}")
# Read hot water configuration
hw_config = await client.hot_water_config()
# Set hot water temperature
await client.set_hot_water(SetHotWaterParam(nominal_setpoint=55.0))