Release v7.3.4 - Fix Temperature Delta Conversions#68
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect Fahrenheit conversions for temperature delta (differential) settings in heat pump and heater element controls. The changes introduce a new DeciCelsiusDelta class that correctly applies the 9/5 scale factor without the +32 offset (since deltas represent differences, not absolute temperatures), updates the affected model fields to use this new type, and adds these differential settings to the CLI output. Documentation is also updated to reflect unit-agnostic temperature handling.
Changes:
- Created
DeciCelsiusDeltaclass for temperature delta conversions (scale factor only, no offset) - Updated 8 model fields (heat pump and heater element differential settings) to use
Div10CelsiusDeltaToPreferredtype - Enhanced CLI output to display differential temperature settings
- Updated documentation and examples to use unit-agnostic temperature handling
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/nwp500/temperature.py | Added DeciCelsiusDelta class for delta temperature conversions without offset |
| src/nwp500/models.py | Updated differential temperature field types from Div10CelsiusToPreferred to Div10CelsiusDeltaToPreferred |
| src/nwp500/converters.py | Added div_10_celsius_delta_to_preferred converter using DeciCelsiusDelta |
| src/nwp500/cli/output_formatters.py | Added display of 8 differential temperature settings in CLI output |
| examples/*/*.py | Updated temperature display to use get_field_unit() instead of hardcoded "°F" |
| docs/*.rst | Updated documentation to reflect unit-agnostic temperature handling |
| CHANGELOG.rst | Added v7.3.4 release notes |
src/nwp500/temperature.py
Outdated
| Temperature delta in Fahrenheit. | ||
| """ | ||
| celsius = self.to_celsius() | ||
| return round(celsius * 9 / 5, 1) |
There was a problem hiding this comment.
The to_fahrenheit() method in DeciCelsiusDelta rounds to 1 decimal place, but the parent DeciCelsius.to_fahrenheit() method does not round. Consider removing the round() call for consistency, or explicitly document why delta conversions need rounding while absolute temperature conversions don't.
| return round(celsius * 9 / 5, 1) | |
| return celsius * 9 / 5 |
Address PR review comment: DeciCelsiusDelta.to_fahrenheit() now matches the parent DeciCelsius.to_fahrenheit() by not applying rounding. This ensures consistency across temperature conversion methods.
Summary
DeciCelsiusDeltaclass for temperature deltas that apply scale factor (9/5) but NOT the +32 offsetDeciCelsiusDeltainstead ofDeciCelsius