Client¶
The main entry point for interacting with BSB-LAN devices.
BSBLAN¶
bsblan.BSBLAN
dataclass
¶
BSBLAN(
config: BSBLANConfig,
session: ClientSession | None = None,
_close_session: bool = False,
_firmware_version: str | None = None,
_api_version: str | None = None,
_api_data: APIConfig | None = None,
_initialized: bool = False,
_temperature_unit: str = "°C",
_circuit_temp_ranges: dict[
int, dict[str, float | None]
] = dict(),
_circuit_temp_initialized: set[int] = set(),
_hot_water_param_cache: dict[str, str] = dict(),
_validated_hot_water_groups: set[str] = set(),
_section_locks: dict[str, Lock] = dict(),
_hot_water_group_locks: dict[str, Lock] = dict(),
)
Main class for handling connections with BSBLAN.
initialize
async
¶
Initialize the BSBLAN client.
This performs minimal initialization for fast startup. Section validation is deferred until actually needed (lazy loading).
Source code in src/bsblan/bsblan.py
get_available_circuits
async
¶
Detect which heating circuits are available on the device.
Uses a two-step probe for each circuit (1, 2):
1. Query the operating mode parameter — the response must be
non-empty and contain actual data.
2. Query the status parameter (8000/8001) — an inactive
circuit returns value="0" with desc="---".
A circuit is only considered available when both checks pass.
This is useful for integration setup flows (e.g., Home Assistant config flow) to discover how many circuits the user's controller supports.
Returns:
| Type | Description |
|---|---|
list[int]
|
list[int]: Sorted list of available circuit numbers (e.g., [1, 2]). |
Example
async with BSBLAN(config) as client: circuits = await client.get_available_circuits() # circuits == [1, 2] for a dual-circuit controller
Source code in src/bsblan/bsblan.py
state
async
¶
Get the current state from BSBLAN device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all state parameters. Valid names include: hvac_mode, target_temperature, hvac_action, hvac_mode_changeover, current_temperature, room1_temp_setpoint_boost. |
None
|
circuit
|
int
|
The heating circuit number (1 or 2). Defaults to 1. Circuit 2 uses separate parameter IDs but returns the same State model with the same field names. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
The current state of the BSBLAN device. |
Note
The hvac_mode.value is returned as a raw integer from the device: 0=off, 1=auto, 2=eco, 3=heat.
Example
Fetch only hvac_mode and current_temperature¶
state = await client.state(include=["hvac_mode", "current_temperature"])
Fetch state for heating circuit 2¶
state_hc2 = await client.state(circuit=2)
Source code in src/bsblan/bsblan.py
sensor
async
¶
Get the sensor information from BSBLAN device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all sensor parameters. Valid names include: outside_temperature, current_temperature. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Sensor |
Sensor
|
The sensor information from the BSBLAN device. |
Example
Fetch only outside_temperature¶
sensor = await client.sensor(include=["outside_temperature"])
Source code in src/bsblan/bsblan.py
static_values
async
¶
Get the static information from BSBLAN device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all static parameters. Valid names include: min_temp, max_temp. |
None
|
circuit
|
int
|
The heating circuit number (1 or 2). Defaults to 1. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
StaticState |
StaticState
|
The static information from the BSBLAN device. |
Example
Fetch only min_temp¶
static = await client.static_values(include=["min_temp"])
Fetch static values for heating circuit 2¶
static_hc2 = await client.static_values(circuit=2)
Source code in src/bsblan/bsblan.py
device
async
¶
info
async
¶
Get information about the current heating system config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all info parameters. Valid names include: device_identification, controller_family, controller_variant. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Info |
Info
|
The information about the current heating system config. |
Example
Fetch only device_identification¶
info = await client.info(include=["device_identification"])
Source code in src/bsblan/bsblan.py
time
async
¶
Get the current time from the BSB-LAN device.
Returns:
| Name | Type | Description |
|---|---|---|
DeviceTime |
DeviceTime
|
The current time information from the BSB-LAN device. |
Source code in src/bsblan/bsblan.py
set_time
async
¶
Set the time on the BSB-LAN device.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_value
|
str
|
The time value to set in format "DD.MM.YYYY HH:MM:SS" (e.g., "13.08.2025 10:25:55"). |
required |
Raises:
| Type | Description |
|---|---|
BSBLANInvalidParameterError
|
If the time format is invalid. |
Source code in src/bsblan/bsblan.py
thermostat
async
¶
thermostat(
target_temperature: str | None = None,
hvac_mode: int | None = None,
circuit: int = 1,
) -> None
Change the state of the thermostat through BSB-Lan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_temperature
|
str | None
|
The target temperature to set. |
None
|
hvac_mode
|
int | None
|
The HVAC mode to set as raw integer value. Valid values: 0=off, 1=auto, 2=eco, 3=heat. |
None
|
circuit
|
int
|
The heating circuit number (1 or 2). Defaults to 1. |
1
|
Example
Set HC1 temperature¶
await client.thermostat(target_temperature="21.0")
Set HC2 mode¶
await client.thermostat(hvac_mode=1, circuit=2)
Source code in src/bsblan/bsblan.py
hot_water_state
async
¶
Get essential hot water state for frequent polling.
This method returns only the most important hot water parameters that are typically checked frequently for monitoring purposes. This reduces API calls and improves performance for regular polling.
Uses granular lazy loading - only validates the 5 essential params, not all 29 hot water parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all essential hot water parameters. Valid names include: operating_mode, nominal_setpoint, release, dhw_actual_value_top_temperature, state_dhw_pump. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
HotWaterState |
HotWaterState
|
Essential hot water state information. |
Example
Fetch only operating_mode and nominal_setpoint¶
state = await client.hot_water_state( include=["operating_mode", "nominal_setpoint"] )
Source code in src/bsblan/bsblan.py
hot_water_config
async
¶
Get hot water configuration and advanced settings.
This method returns configuration parameters that are typically set once and checked less frequently.
Uses granular lazy loading - only validates the 16 config params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all config hot water parameters. Valid names include: eco_mode_selection, nominal_setpoint_max, reduced_setpoint, dhw_charging_priority, operating_mode_changeover, legionella_function, legionella_function_setpoint, legionella_function_periodicity, legionella_function_day, legionella_function_time, legionella_function_dwelling_time, legionella_circulation_pump, legionella_circulation_temp_diff, dhw_circulation_pump_release, dhw_circulation_pump_cycling, dhw_circulation_setpoint. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
HotWaterConfig |
HotWaterConfig
|
Hot water configuration information. |
Example
Fetch only legionella settings¶
config = await client.hot_water_config( include=["legionella_function", "legionella_function_setpoint"] )
Source code in src/bsblan/bsblan.py
hot_water_schedule
async
¶
Get hot water time program schedules.
This method returns time program settings that are typically configured once and rarely changed.
Uses granular lazy loading - only validates the 8 schedule params.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
list[str] | None
|
Optional list of parameter names to fetch. If None, fetches all schedule parameters. Valid names include: dhw_time_program_monday, dhw_time_program_tuesday, dhw_time_program_wednesday, dhw_time_program_thursday, dhw_time_program_friday, dhw_time_program_saturday, dhw_time_program_sunday, dhw_time_program_standard_values. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
HotWaterSchedule |
HotWaterSchedule
|
Hot water schedule information. |
Example
Fetch only Monday's schedule¶
schedule = await client.hot_water_schedule( include=["dhw_time_program_monday"] )
Source code in src/bsblan/bsblan.py
set_hot_water
async
¶
Change the state of the hot water system through BSB-Lan.
Only one parameter should be set at a time (BSB-LAN API limitation).
Example
params = SetHotWaterParam(nominal_setpoint=55.0) await client.set_hot_water(params)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SetHotWaterParam
|
SetHotWaterParam object containing the parameter to set. |
required |
Raises:
| Type | Description |
|---|---|
BSBLANError
|
If multiple parameters are set or no parameter is set. |
Source code in src/bsblan/bsblan.py
set_hot_water_schedule
async
¶
Set hot water time program schedules.
This method allows setting weekly DHW schedules using a type-safe interface with TimeSlot and DaySchedule objects.
Example
schedule = DHWSchedule( monday=DaySchedule(slots=[ TimeSlot(time(6, 0), time(8, 0)), TimeSlot(time(17, 0), time(21, 0)), ]), tuesday=DaySchedule(slots=[ TimeSlot(time(6, 0), time(8, 0)), ]) ) await client.set_hot_water_schedule(schedule)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schedule
|
DHWSchedule
|
DHWSchedule object containing the weekly schedule. |
required |
Raises:
| Type | Description |
|---|---|
BSBLANError
|
If no schedule is provided. |
Source code in src/bsblan/bsblan.py
BSBLANConfig¶
bsblan.BSBLANConfig
dataclass
¶
BSBLANConfig(
host: str,
username: str | None = None,
password: str | None = None,
passkey: str | None = None,
port: int = 80,
request_timeout: int = 10,
)
Configuration for BSBLAN.