From ddedbc142219a5af0f48ddf563f94609345e179b Mon Sep 17 00:00:00 2001 From: Emmanuel Levijarvi Date: Wed, 22 Jul 2026 22:55:23 -0700 Subject: [PATCH 1/2] =?UTF-8?q?Fix=20decode=5Freservation=5Fhex=20docstrin?= =?UTF-8?q?g:=20param=20is=20half-=C2=B0C,=20not=20a=2020=C2=B0F=20offset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docstring claimed byte 5 was "temperature offset by 20°F", which contradicts the half-degree-Celsius encoding used consistently elsewhere (models/schedule.py, models/_converters.py reservation_param_to_preferred). Fixes #113 --- src/nwp500/encoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nwp500/encoding.py b/src/nwp500/encoding.py index c7f75165..2dabb14e 100644 --- a/src/nwp500/encoding.py +++ b/src/nwp500/encoding.py @@ -345,7 +345,7 @@ def decode_reservation_hex(hex_string: str) -> list[dict[str, int]]: - Byte 2: hour (0-23) - Byte 3: minute (0-59) - Byte 4: mode (operation mode ID) - - Byte 5: param (temperature offset by 20°F) + - Byte 5: param (target temperature, half-degrees Celsius; °C = param/2) Args: hex_string: Hexadecimal string representing reservation data From 7c4e7c72d85c219e4d80b705a361b7c0d8815cf0 Mon Sep 17 00:00:00 2001 From: Emmanuel Levijarvi Date: Thu, 23 Jul 2026 08:17:57 -0700 Subject: [PATCH 2/2] Fix 'minute' vs 'min' key mismatch in decode_reservation_hex example Review feedback on #115: the Examples section still showed the decoded dict using a 'minute' key, but the function actually returns 'min' (see the dict construction below and every schedule model). Corrected the doctest-style example to match the real return value. --- src/nwp500/encoding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nwp500/encoding.py b/src/nwp500/encoding.py index 2dabb14e..d8ac2f1e 100644 --- a/src/nwp500/encoding.py +++ b/src/nwp500/encoding.py @@ -355,7 +355,7 @@ def decode_reservation_hex(hex_string: str) -> list[dict[str, int]]: Examples: >>> decode_reservation_hex("013e061e0478") - [{'enable': 1, 'week': 62, 'hour': 6, 'minute': 30, 'mode': 4, 'param': + [{'enable': 1, 'week': 62, 'hour': 6, 'min': 30, 'mode': 4, 'param': 120}] """ data = bytes.fromhex(hex_string)