Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Adds direct parameter access API for reading individual BSB-LAN parameters by ID or name, enabling custom sensor implementations.

Changes

New methods:

  • read_parameter(parameter_id: str) -> EntityInfo | None - reads single parameter by BSB-LAN ID
  • read_parameter_by_name(parameter_name: str) -> EntityInfo | None - reads single parameter by name with automatic ID resolution

Type handling:

  • Returns EntityInfo with automatic type conversion based on dataType field
  • Returns None for missing/invalid parameters (graceful degradation)
  • Leverages existing read_parameters() infrastructure

Constants:

  • Added PARAMETER_ID_EMPTY_ERROR_MSG and PARAMETER_NAME_EMPTY_ERROR_MSG for validation

Usage

async with BSBLAN(config) as client:
    await client.initialize()
    
    # Direct parameter access by ID
    temp = await client.read_parameter("8740")
    if temp:
        print(f"{temp.value} {temp.unit}")  # 21.5 °C
    
    # Access by parameter name
    mode = await client.read_parameter_by_name("hvac_mode")
    if mode:
        print(f"{mode.desc}")  # "Automatic"

Enables use cases like Home Assistant custom sensors without requiring pre-defined accessor methods for every parameter.

Original prompt

This section details on the original issue you should resolve

<issue_title>Custom sensors</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.

An api for getting a specific parameter from bsblan. Retrieve the data and return the sensor with correct type and format

Describe the solution you'd like

The parameters return on abject with the needed info. We can create from this the correct data class.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 1, 2026 10:07
Co-authored-by: liudger <4112111+liudger@users.noreply.github.com>
Co-authored-by: liudger <4112111+liudger@users.noreply.github.com>
Co-authored-by: liudger <4112111+liudger@users.noreply.github.com>
Copilot AI changed the title [WIP] Add API for retrieving custom sensor parameters Add single parameter read methods for custom sensor support Feb 1, 2026
Copilot AI requested a review from liudger February 1, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom sensors

2 participants