Skip to content

Constants

Enumerations and mappings used by the library.

Enumerations

HeatingCircuitStatus

bsblan.HeatingCircuitStatus

Bases: IntEnum

BSB-LAN Parameter 8000 status codes for heating circuit 1.

These are the vendor-specific status codes returned by BSB-LAN devices. Each status code has a descriptive name based on BSB-LAN documentation (LANG_DE_LEGACY.h / LANG_EN.h).

Usage

status = HeatingCircuitStatus(state.hvac_action.value) print(status.name) # e.g., "HEATING_COMFORT" category = status.category # e.g., HVACActionCategory.HEATING

category property

category: HVACActionCategory

Get the HVAC action category for this status code.

Returns:

Name Type Description
HVACActionCategory HVACActionCategory

The category this status belongs to.

from_value classmethod

from_value(value: int) -> HeatingCircuitStatus | None

Create a HeatingCircuitStatus from a raw value.

Parameters:

Name Type Description Default
value int

The raw status code from BSB-LAN parameter 8000.

required

Returns:

Type Description
HeatingCircuitStatus | None

HeatingCircuitStatus if the value is known, None otherwise.

Source code in src/bsblan/constants.py
@classmethod
def from_value(cls, value: int) -> HeatingCircuitStatus | None:
    """Create a HeatingCircuitStatus from a raw value.

    Args:
        value: The raw status code from BSB-LAN parameter 8000.

    Returns:
        HeatingCircuitStatus if the value is known, None otherwise.

    """
    try:
        return cls(value)
    except ValueError:
        return None

HVACActionCategory

bsblan.HVACActionCategory

Bases: IntEnum

Categories for HVAC action states.

These represent the simplified action states that can be used by home automation systems like Home Assistant.

Helper functions

get_hvac_action_category

bsblan.get_hvac_action_category

get_hvac_action_category(
    status_code: int,
) -> HVACActionCategory

Get the HVAC action category for a given status code.

This is a convenience function for getting the category of any status code, including unknown ones (which return IDLE).

Parameters:

Name Type Description Default
status_code int

The raw status code from BSB-LAN parameter 8000.

required

Returns:

Name Type Description
HVACActionCategory HVACActionCategory

The category for this status code.

Example

category = get_hvac_action_category(0x72) print(category) # HVACActionCategory.HEATING print(category.name) # "HEATING"

Source code in src/bsblan/constants.py
def get_hvac_action_category(status_code: int) -> HVACActionCategory:
    """Get the HVAC action category for a given status code.

    This is a convenience function for getting the category of any status code,
    including unknown ones (which return IDLE).

    Args:
        status_code: The raw status code from BSB-LAN parameter 8000.

    Returns:
        HVACActionCategory: The category for this status code.

    Example:
        >>> category = get_hvac_action_category(0x72)
        >>> print(category)  # HVACActionCategory.HEATING
        >>> print(category.name)  # "HEATING"

    """
    status = HeatingCircuitStatus.from_value(status_code)
    if status is None:
        return HVACActionCategory.IDLE
    return status.category

Unit mappings

UNIT_DEVICE_CLASS_MAP

bsblan.UNIT_DEVICE_CLASS_MAP module-attribute

UNIT_DEVICE_CLASS_MAP: Final[dict[str, str]] = {
    "°C": "temperature",
    "°F": "temperature",
    "°C": "temperature",
    "°F": "temperature",
    "°C": "temperature",
    "°F": "temperature",
    "kWh": "energy",
    "MWh": "energy",
    "Wh": "energy",
    "kW": "power",
    "W": "power",
    "bar": "pressure",
    "Pa": "pressure",
    "hPa": "pressure",
    "V": "voltage",
    "A": "current",
    "mA": "current",
    "Hz": "frequency",
    "l/min": "volume_flow_rate",
    "l/h": "volume_flow_rate",
    "h": "duration",
    "min": "duration",
    "s": "duration",
    "%": "power_factor",
}

UNIT_STATE_CLASS_MAP

bsblan.UNIT_STATE_CLASS_MAP module-attribute

UNIT_STATE_CLASS_MAP: Final[dict[str, str]] = {
    "kWh": "total_increasing",
    "MWh": "total_increasing",
    "Wh": "total_increasing",
    "°C": "measurement",
    "°F": "measurement",
    "°C": "measurement",
    "°F": "measurement",
    "°C": "measurement",
    "°F": "measurement",
    "kW": "measurement",
    "W": "measurement",
    "bar": "measurement",
    "Pa": "measurement",
    "hPa": "measurement",
    "V": "measurement",
    "A": "measurement",
    "mA": "measurement",
    "Hz": "measurement",
    "l/min": "measurement",
    "l/h": "measurement",
    "%": "measurement",
    "h": "measurement",
    "min": "measurement",
    "s": "measurement",
}