From 229827fb654896981500ce6d5b0c96e0db703386 Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 16 Nov 2026 17:16:27 +0100 Subject: [PATCH] Fix type code of radiation inputs TA's interface spec encodes radiation inputs as V110 TTTT TTTT TTTT, type bits 0x6000, not 0x4000. The value was decoded correctly anyway since radiation falls through to the default conversion, but the input type was reported as None instead of radiation, so fetch() gave it no unit. pyblnet-async uses 0x6000 as well. --- pyblnet/blnet_parser.py | 3 ++- tests/test_parser.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pyblnet/blnet_parser.py b/pyblnet/blnet_parser.py index bca17d4..3612cc6 100644 --- a/pyblnet/blnet_parser.py +++ b/pyblnet/blnet_parser.py @@ -27,7 +27,8 @@ TYPE_DIGITAL = 0x1000 TYPE_TEMP = 0x2000 TYPE_VOLUME = 0x3000 -TYPE_RADIATION = 0x4000 +# V110 TTTT TTTT TTTT in TA's interface spec, in W/m² +TYPE_RADIATION = 0x6000 TYPE_RAS = 0x7000 RAS_POSITIVE_MASK = 0x01FF # Temperature input without sensor (or with a broken wire): all value bits set, 409.5 °C diff --git a/tests/test_parser.py b/tests/test_parser.py index c90e12a..3be66a6 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -44,13 +44,14 @@ def test_parser_disconnected_temperature_sensor_is_none(self): assert parsed_values['analog'][2] == 409.4 def test_parser_input_types(self): - # temperature, volume flow, radiation, digital, unused, room sensor, undocumented type 101 - inputs = [0x2000, 0x3000, 0x4000, 0x1000, 0x0000, 0x7000, 0x5000] + [0x2000] * 9 + # temperature, volume flow, radiation (110), digital, unused, room sensor, + # undocumented types 101 and 100 + inputs = [0x2000, 0x3000, 0x6000, 0x1000, 0x0000, 0x7000, 0x5000, 0x4000] + [0x2000] * 8 data = struct.pack('<16H', *inputs) + bytes(55 - 32) parsed_values = BLNETParser(data).to_dict() - expected_types = {1: 'temperature', 2: 'volume_flow', 3: 'radiation', 4: 'digital', 5: None, 6: 'temperature', 7: None} - expected_types.update({channel: 'temperature' for channel in range(8, 17)}) + expected_types = {1: 'temperature', 2: 'volume_flow', 3: 'radiation', 4: 'digital', 5: None, 6: 'temperature', 7: None, 8: None} + expected_types.update({channel: 'temperature' for channel in range(9, 17)}) assert parsed_values['analog_types'] == expected_types def test_parser_heat_meter_1_active(self):