Skip to content

docs: correct temperature conversion documentation#44

Merged
eman merged 1 commit intomainfrom
fix/temperature-conversion-docs
Dec 3, 2025
Merged

docs: correct temperature conversion documentation#44
eman merged 1 commit intomainfrom
fix/temperature-conversion-docs

Conversation

@eman
Copy link
Copy Markdown
Owner

@eman eman commented Dec 3, 2025

Summary

The documentation incorrectly stated that temperature values use a simple +20 offset (e.g., raw + 20, param + 20). The actual encoding is half-degrees Celsius.

What was wrong

Documentation claimed:

  • displayed_value = raw_value + 20
  • Examples like param=100 for 120°F (implying 100 + 20 = 120)

What is correct

Temperature values are encoded in half-degrees Celsius:

  • Formula: fahrenheit = (raw_value / 2.0) * 9/5 + 32
  • Inverse: param = (fahrenheit - 32) * 5/9 * 2

Examples:

  • 95°F → param = 70 (35°C × 2)
  • 120°F → param = 98 (48.9°C × 2)
  • 140°F → param = 120 (60°C × 2)
  • 150°F → param = 132 (65.6°C × 2)

Files Updated

  • docs/guides/reservations.rst - Updated temperature parameter documentation and code examples
  • docs/guides/scheduling_features.rst - Fixed temperature encoding documentation
  • docs/guides/advanced_features_explained.rst - Replaced "Formula Confirmation" section with correct conversion reference
  • docs/protocol/device_features.rst - Updated conversion column references
  • docs/protocol/firmware_tracking.rst - Updated conversion examples
  • docs/protocol/mqtt_protocol.rst - Fixed temperature encoding notes
  • docs/python_api/constants.rst - Updated example conversion
  • src/nwp500/models.py - Fixed misleading comment

Validation

  • ✅ Linting: All checks passed
  • ✅ Type checking: No errors
  • ✅ Tests: 126 passed

The documentation incorrectly stated that temperature values use a simple
+20 offset (e.g., raw + 20). The actual encoding is half-degrees Celsius.

Correct formula: fahrenheit = (raw_value / 2.0) * 9/5 + 32

Updated files:
- docs/guides/reservations.rst
- docs/guides/scheduling_features.rst
- docs/guides/advanced_features_explained.rst
- docs/protocol/device_features.rst
- docs/protocol/firmware_tracking.rst
- docs/protocol/mqtt_protocol.rst
- docs/python_api/constants.rst
- src/nwp500/models.py (comment fix)
@eman eman requested a review from Copilot December 3, 2025 07:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 corrects widespread documentation errors regarding temperature encoding in the NWP500 protocol. The documentation incorrectly stated that temperatures use a simple +20 offset, when they actually use half-degrees Celsius encoding with the formula fahrenheit = (raw_value / 2.0) * 9/5 + 32.

Key changes:

  • Replaced all raw + 20 references with proper HalfCelsiusToF conversion formula
  • Updated temperature examples across all documentation files (e.g., 120°F is param=98, not param=100)
  • Fixed code comment in models.py to accurately describe the encoding scheme

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/nwp500/models.py Corrected misleading comment from "offset (raw + 20)" to "encoded in half-degrees Celsius"
docs/python_api/constants.rst Changed conversion field from "raw + 20" to "HalfCelsiusToF"
docs/protocol/mqtt_protocol.rst Updated temperature encoding documentation with correct formula and examples
docs/protocol/firmware_tracking.rst Replaced raw + 20 conversion references with HalfCelsiusToF
docs/protocol/device_features.rst Updated conversion column entries and added formula reference
docs/guides/scheduling_features.rst Fixed temperature parameter encoding section with correct formulas and examples
docs/guides/reservations.rst Comprehensively updated all temperature-related documentation and code examples
docs/guides/advanced_features_explained.rst Replaced "Formula Confirmation" section with detailed temperature conversion reference

@eman eman merged commit c634c31 into main Dec 3, 2025
10 checks passed
@eman eman deleted the fix/temperature-conversion-docs branch December 3, 2025 07:27
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.

2 participants