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,
_json_api_version: str | None = None,
_supports_full_config: bool | None = None,
_api_data: APIConfig | None = None,
_device: Device | None = None,
_initialized: bool = False,
_available_circuits: set[int] | None = None,
)
Main class for handling connections with BSBLAN.
device_info
property
¶
Return cached device metadata from the last /JI response.
supports_time_sync
property
¶
Return cached support for the normal BSB/LPB time sync command.
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.
Reads the heating circuits check number first: when it is usable, the circuits it reports as configured are returned. Otherwise the operating mode probe parameters from CircuitConfig.PROBE_PARAMS are used as the discovery signal. Status parameters are not queried during discovery to keep setup lightweight and avoid excluding valid circuits when status data is unavailable.
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, current_setpoint, 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
For BSB/LPB devices, hvac_mode.value is returned as a raw integer: 0=off, 1=auto, 2=eco, 3=heat. PPS devices normalize their raw operating modes to the same library values, but do not support eco.
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. |
Raises:
| Type | Description |
|---|---|
BSBLANUnsupportedFeatureError
|
If validation leaves no supported sensor parameters on a PPS device. |
BSBLANError
|
If the sensor request fails or the requested parameter names are invalid. |
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: temp_reduced_setpoint, heating_protective_setpoint, comfort_setpoint_max, cooling_comfort_setpoint_min, cooling_reduced_setpoint, and min_temp, max_temp on PPS. |
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 the reduced setpoint¶
static = await client.static_values(include=["temp_reduced_setpoint"])
Fetch static values for heating circuit 2¶
static_hc2 = await client.static_values(circuit=2)
Source code in src/bsblan/bsblan.py
device
async
¶
Get BSBLAN device info.
Returns:
| Name | Type | Description |
|---|---|---|
Device |
Device
|
The BSBLAN device information. |
Source code in src/bsblan/bsblan.py
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 |
|---|---|---|---|
value
|
datetime
|
The local time of the heating system. Its date and time are written as they are, without timezone conversion. |
required |
Raises:
| Type | Description |
|---|---|
BSBLANInvalidParameterError
|
If the year is out of range. |
BSBLANError
|
If the device does not accept the new time. |
Source code in src/bsblan/bsblan.py
thermostat
async
¶
thermostat(
target_temperature: str | None = None,
hvac_mode: int | None = None,
circuit: int = 1,
target_temperature_high: str | float | None = None,
*,
cooling_operating_mode: int | None = None,
temp_reduced_setpoint: str | float | None = None,
temporary_mode: int | None = None
) -> 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. For BSB/LPB, valid values are 0=off, 1=auto, 2=eco, 3=heat. For PPS, valid values are 0=off, 1=auto, and 3=heat/manual; they are translated to PPS raw values before posting. |
None
|
circuit
|
int
|
The heating circuit number (1 or 2). Defaults to 1. |
1
|
target_temperature_high
|
str | float | None
|
The cooling comfort setpoint to set. |
None
|
cooling_operating_mode
|
int | None
|
The cooling circuit operating mode to set as raw integer value: 0=Protection, 1=Automatic, 2=Reduced, 3=Comfort. Not supported on PPS devices. |
None
|
temp_reduced_setpoint
|
str | float | None
|
The reduced (eco) room setpoint to set. Not supported on PPS devices. |
None
|
temporary_mode
|
int | None
|
Temporary operating mode override, active until the next time program switch point. Raw integer value: 0=No override, 1=Reduced, 2=Comfort. Only has an effect in automatic mode. Not supported on PPS devices. |
None
|
Example
Set HC1 temperature¶
await client.thermostat(target_temperature="21.0")
Set HC1 cooling comfort setpoint¶
await client.thermostat(target_temperature_high="24.0")
Set HC1 cooling operating mode¶
await client.thermostat(cooling_operating_mode=1)
Set HC1 reduced setpoint¶
await client.thermostat(temp_reduced_setpoint="18.0")
Switch HC1 to comfort until the next time program switch point¶
await client.thermostat(temporary_mode=2)
Set HC2 mode¶
await client.thermostat(hvac_mode=1, circuit=2)
Source code in src/bsblan/bsblan.py
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
discover_schedules
async
¶
Return independent HC1, HC2 and DHW availability without writes.
Explicit mappings win; successful automatic mappings are reused in memory. Set refresh=True to discard cached trust and run fresh compatibility probes. Connection/auth/malformed errors propagate; retry discovery rather than creating a wrong-mapping repair. HA can defer this call until startup traffic settles; no discovery runs during ordinary initialization.
Source code in src/bsblan/bsblan.py
invalidate_schedule_profiles
¶
Discard automatic mapping trust without I/O, e.g. after reconnect.
Manual overrides are unchanged. Existing clients retain their captured profile/table configuration; recreate the client to change that evidence.
Source code in src/bsblan/bsblan.py
probe_schedule_candidate
async
¶
Diagnose a named candidate read-only, without enabling schedule groups.
Currently accepts only "issue_1668_dhw": the seven exact DHW IDs reported in issue #1668. Compatibility is not proof of weekday meaning or the active table. The result always requires independent confirmation. This method is opt-in; discovery failures never trigger fallback scans.
Source code in src/bsblan/bsblan.py
heating_schedule
async
¶
Read seven fresh observations for heating circuit 1 or 2.
Explicit mappings override automatic evidence-backed profile resolution.
A returned snapshot may be incomplete; use its day outcomes and retry_required property rather than treating object presence as success.
Source code in src/bsblan/bsblan.py
set_heating_schedule
async
¶
Write populated days using the same mapping as heating_schedule().
Validate the complete update before the first write. Each populated day requires a separate acknowledgement; failures report partial progress. Clear operations are rejected until their wire encoding is verified. The caller owns readback, publication, and handling partial failures.
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 6 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, dhw_current_setpoint, 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
¶
Read seven fresh DHW observations using an override or verified profile.
Missing/inactive values and unsupported intervals remain explicit day outcomes. Without an override, reuse a validated profile or lazily match and probe one. Schedule values are never reused from an earlier operation. No factory reset or default schedule parameter is requested.
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
¶
Write populated DHW days using the client-configured schedule mapping.
None leaves a day unchanged. Unsupported clear intent fails before any writes. Acknowledgements are not readback proof; the caller owns refresh even when BSBLANScheduleWriteError reports a partial or uncertain result.
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,
schedule_mappings: ScheduleMappings = ScheduleMappings(),
schedule_profiles: tuple[
ScheduleProfile, ...
] = STANDARD_SCHEDULE_PROFILES,
schedule_table: str | None = None,
)
Configuration for BSBLAN.
Shared schedule API¶
Read and write methods share the immutable manual overrides in
BSBLANConfig.schedule_mappings. Heating mappings are configured under
heating={1: profile_1, 2: profile_2} and selected by the same circuit identifier
used by the read/write methods. Missing groups attempt evidence-backed automatic
resolution using schedule_profiles, matching declared table_parameters or an
asserted active schedule_table. The built-in RVS21 profile covers only the
verified controller/build/bus/destination and integer-weekday layout. Unknown
installations never receive guessed fallback IDs; schedule_profiles=() opts out.
discover_schedules(refresh=False) performs no writes and returns HC1, HC2 and
DHW ScheduleAvailability outcomes independently. Manual overrides take precedence.
Successful automatic mappings are reused in memory, never their schedule values.
Use refresh=True for fresh discovery or synchronous
invalidate_schedule_profiles() to discard trust without I/O. HA controls when
to discover, so it can defer work until initial polling settles. Initialization
never starts discovery, and the library does not impose a startup sleep.
Automatic groups require exact identity and seven compatible TIMEPROG parameters;
unknown/incompatible groups need a repair/override, while incomplete probes need
retries. Network/authentication/malformed exceptions propagate unchanged.
Readers/setters use the same resolution lazily and raise
BSBLANScheduleProbeError for inconclusive probes, not a mapping error. Reads
fetch fresh values using cached mappings; automatic writes always refresh identity
and compatibility first. Connection failures and observed metadata changes discard
automatic trust; explicit refresh/invalidation handles known remote changes.
Schedule setters validate and encode the entire update before discovery I/O.
Fresh layout/value permission denials are both retained, and target/proof guards
run before every actual schedule request attempt, including transport retries.
probe_schedule_candidate("issue_1668_dhw") performs an explicit read-only probe
of the issue's seven decimal DHW IDs. Its immutable ScheduleCandidateProbe
result is never enabled and always requires confirmation of weekday meaning.
It does not populate the automatic mapping cache or run as a fallback on failure.
See evidence-backed profiles for identity provenance,
current limitations and consumer retry/repair guidance.
See structured schedules and the
breaking API migration guide.
BSB/LPB gateway buswritable=0 is a default indicator, not an absolute write veto.
Schedule setters can proceed with explicit individual readwrite=0 evidence,
checking fresh /JC structures for the populated IDs when needed. Explicit
read-only/write-only flags remain denied; see
parameter permissions.
The shared models describe mappings, snapshots, intervals, and partial updates. Schedule exceptions expose absent mappings and acknowledged/uncertain partial-write progress.