Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ The client automatically detects the device's capabilities during
`initialize()` and selects a matching configuration based on the BSB-LAN
JSON-API version reported by the `/JV` endpoint:

- **Full support (`v3`)** — JSON-API version 2.0 or newer. All features are
- **Full configuration** — JSON-API version 2.0 or newer. All features are
available: multiple heating circuits, hot water control, schedules, sensors,
and cooling setpoints.
- **Basic support (`v2`)** — JSON-API version 1.x. A reduced, single-circuit
- **Basic configuration** — JSON-API version 1.x. A reduced, single-circuit
configuration covering essential heating, hot water, and sensor parameters.

The JSON-API version is the documented, firmware-independent compatibility
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ On the first request the client lazily runs `initialize()`, which detects the
device's capabilities and selects a matching configuration based on the BSB-LAN
JSON-API version reported by the `/JV` endpoint:

- **Full support (`v3`)** — JSON-API version 2.0 or newer. All features are
- **Full configuration** — JSON-API version 2.0 or newer. All features are
available, including multiple heating circuits, hot water control, schedules,
sensors, and cooling setpoints.
- **Basic support (`v2`)** — JSON-API version 1.x. A reduced, single-circuit
- **Basic configuration** — JSON-API version 1.x. A reduced, single-circuit
configuration covering essential heating, hot water, and sensor parameters.

The JSON-API version is the documented, firmware-independent compatibility
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Asynchronous Python client for [BSB-LAN](https://github.com/fredlcore/bsb_lan) d
- Control thermostat settings and hot water parameters
- Detect optional cooling setpoints for heat/cool range controls
- Fully typed with PEP 561 support
- API v3 parameter support, plus basic support for JSON-API 1.x devices
- Automatic version detection via the BSB-LAN JSON-API (`/JV`)
- Full parameter support, plus basic support for JSON-API 1.x devices
- Automatic capability detection via the BSB-LAN JSON-API (`/JV`)
- Lazy loading with per-section validation

## Quick example
Expand Down
5 changes: 0 additions & 5 deletions examples/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,20 @@ def print_device_time(device_time: DeviceTime) -> None:
def print_device_info(
device: Device,
info: Info,
api_version: str | None = None,
json_api_version: str | None = None,
) -> None:
"""Print device and general information.

Args:
device (Device): The device information from the BSBLan device.
info (Info): The general information from the BSBLan device.
api_version (str | None): The resolved API configuration version
(``"v2"`` or ``"v3"``).
json_api_version (str | None): The BSB-LAN JSON-API version reported by
the ``/JV`` endpoint, if available.
Comment on lines 182 to 185

"""
attributes = {
"Device Name": device.name or "N/A",
"Version": device.version or "N/A",
"API Version (config)": format_optional(api_version),
"JSON-API Version (/JV)": format_optional(json_api_version),
"Device Identification": get_attribute(info.device_identification),
"Bus Type": format_optional(device.bus),
Expand Down Expand Up @@ -353,7 +349,6 @@ async def main() -> None:
print_device_info(
device,
info,
api_version=bsblan.api_version,
json_api_version=bsblan.json_api_version,
)

Expand Down
15 changes: 3 additions & 12 deletions src/bsblan/bsblan.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,22 +377,13 @@ def device_info(self) -> Device | None:
"""Return cached device metadata from the last /JI response."""
return self._device

@property
def api_version(self) -> str | None:
"""Return the resolved API configuration version (``"v2"`` or ``"v3"``).

The value is populated during initialization. ``"v3"`` indicates full
support and ``"v2"`` the basic single-circuit configuration.
"""
return self._api_version

@property
def json_api_version(self) -> str | None:
"""Return the BSB-LAN JSON-API version reported by ``/JV``.

This is the firmware-independent JSON-API version (e.g. ``"2.0"``).
Returns ``None`` when the device does not expose the ``/JV`` endpoint,
in which case the firmware version is used to resolve ``api_version``.
This is the firmware-independent JSON-API version (e.g. ``"2.0"``) and
the signal used to select the device configuration. Returns ``None``
until ``/JV`` has been queried during initialization.
Comment on lines +384 to +386
"""
return self._json_api_version

Expand Down
12 changes: 0 additions & 12 deletions tests/test_version_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,6 @@ async def test_json_api_version_used_regardless_of_firmware() -> None:
assert bsblan._api_version == "v3"


@pytest.mark.asyncio
async def test_api_version_property() -> None:
"""Test the public api_version property reflects the resolved version."""
config = BSBLANConfig(host="example.com")
bsblan = BSBLAN(config)

bsblan._json_api_version = "2.0"
bsblan._set_api_version()

assert bsblan.api_version == "v3"


@pytest.mark.asyncio
async def test_json_api_version_property() -> None:
"""Test the public json_api_version property exposes the /JV version."""
Expand Down