Skip to content

Fix decode_reservation_hex docstring: param is half-°C, not 20°F offset - #115

Merged
eman merged 2 commits into
mainfrom
fix/113-reservation-param-docstring
Jul 23, 2026
Merged

Fix decode_reservation_hex docstring: param is half-°C, not 20°F offset#115
eman merged 2 commits into
mainfrom
fix/113-reservation-param-docstring

Conversation

@eman

@eman eman commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • The decode_reservation_hex docstring in src/nwp500/encoding.py said byte 5 (param) was "temperature offset by 20°F", which is stale/incorrect.
  • Everywhere else in the codebase param is documented and treated as half-degrees Celsius (°C = param/2): models/schedule.py, models/_converters.py (reservation_param_to_preferredHalfCelsius(param)), and the protocol docs.
  • Updated the docstring to match: "param (target temperature, half-degrees Celsius; °C = param/2)".

Fixes #113

Test plan

  • Doc-only change; no behavior affected.
  • Confirmed no other "offset by 20" references exist in encoding.py.

…fset

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the decode_reservation_hex documentation in src/nwp500/encoding.py to correctly describe the reservation param byte as a half-degrees Celsius value (°C = param/2), aligning the docstring with the rest of the schedule/model/protocol documentation and avoiding misleading “20°F offset” guidance.

Changes:

  • Corrected the decode_reservation_hex docstring to describe param as half-degrees Celsius (°C = param/2).

Comment thread src/nwp500/encoding.py
Comment on lines 344 to +348
- Byte 1: week bitfield (days of week)
- 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)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7c4e7c7 — the example now shows 'min' instead of 'minute', matching the actual dict key.

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.
@eman
eman merged commit b065536 into main Jul 23, 2026
7 checks passed
@eman
eman deleted the fix/113-reservation-param-docstring branch July 23, 2026 15:45
eman added a commit that referenced this pull request Jul 23, 2026
Resolves conflicts with #115 (docstring fix) and #116 (freeze
protection validation), both merged to main after this branch was cut.
Conflicts were purely additive: dr_setting_use and
freeze_protection_use both added to _CAPABILITY_MAP, and their
respective test classes both added to test_protocol_correctness.py /
test_device_capabilities.py. Combined capability count is now 10.
eman added a commit that referenced this pull request Jul 23, 2026
Documents the four merged PRs (#115-#118): confirmed reservation/TOU
write helpers with canonical schedule comparison (#111), freeze
protection temperature validation (#112), the decode_reservation_hex
docstring fix (#113), and demand response capability gating (#114).
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.

DOC: decode_reservation_hex docstring says param is 'offset by 20F' but it's half-degrees Celsius

2 participants