Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@
Changelog
=========

Version 6.0.5 (2025-11-21)
==========================

Fixed
-----

- **CRITICAL Temperature Conversion Bug**: Corrected temperature conversion formula for 8 sensor fields that were displaying values ~100°F higher than expected. The v6.0.4 change incorrectly used division by 5 (pentacelsius) instead of division by 10 (decicelsius) for these fields:

- ``tank_upper_temperature`` - Water tank upper sensor
- ``tank_lower_temperature`` - Water tank lower sensor
- ``discharge_temperature`` - Compressor discharge temperature (refrigerant)
- ``suction_temperature`` - Compressor suction temperature (refrigerant)
- ``evaporator_temperature`` - Evaporator coil temperature (refrigerant)
- ``ambient_temperature`` - Ambient air temperature at heat pump
- ``target_super_heat`` - Target superheat setpoint
- ``current_super_heat`` - Measured superheat value

**Impact**: These fields now correctly display temperatures in expected ranges:

- Tank temperatures: ~120°F (close to DHW temperature, not ~220°F)
- Discharge temperature: 120-180°F (not 220-280°F)
- Suction, evaporator, ambient: Now showing physically realistic values

**Technical details**: Changed from ``PentaCelsiusToF`` (÷5) back to ``DeciCelsiusToF`` (÷10). The correct formula is ``(raw_value / 10.0) * 9/5 + 32``.

Changed
-------

- **Documentation**: Updated ``data_conversions.rst`` and ``device_status.rst`` to reflect correct ``DeciCelsiusToF`` conversion for refrigerant circuit and tank temperature sensors

Version 6.0.4 (2025-11-21)
==========================

Expand Down
26 changes: 13 additions & 13 deletions docs/protocol/data_conversions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ The device uses several encoding schemes to minimize transmission overhead:
- Purpose: Converts raw values, which are in half-degrees Celsius, to Fahrenheit.
- Example: Raw 122 -> (122 / 2) * 9/5 + 32 = 141.8°F

2. **Scaled Celsius to Fahrenheit** (PentaCelsiusToF)
- Applied to refrigerant and evaporator temperatures.
- Formula: ``displayed_value = (raw_value / 5.0) * 9/5 + 32``
- Purpose: Converts raw values, which are scaled by a factor of 5, to Fahrenheit.
- Example: Raw 250 -> (250 / 5) * 9/5 + 32 = 122°F
2. **Decicelsius to Fahrenheit** (DeciCelsiusToF)
- Applied to refrigerant circuit and tank temperature sensors.
- Formula: ``displayed_value = (raw_value / 10.0) * 9/5 + 32``
- Purpose: Converts raw values, which are in tenths of degrees Celsius, to Fahrenheit.
- Example: Raw 489 -> (489 / 10) * 9/5 + 32 = 120.0°F

3. **Tenths Encoding** (div_10)
- Applied to decimal precision values
Expand Down Expand Up @@ -97,11 +97,11 @@ Tank Temperature Sensors
- Display Unit
- Description
* - ``tankUpperTemperature``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Upper tank sensor temperature**. Indicates stratification - hot water at top for quick delivery. Typically hottest point in tank.
* - ``tankLowerTemperature``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Lower tank sensor temperature**. Indicates bulk tank temperature and heating progress. Typically cooler than upper sensor.

Expand All @@ -121,27 +121,27 @@ These temperatures monitor the heat pump refrigerant circuit health and performa
- Display Unit
- Description
* - ``dischargeTemperature``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Compressor discharge temperature**. Temperature of refrigerant exiting the compressor. Typically 120-180°F. High values indicate high system pressure; low values indicate efficiency issues.
* - ``suctionTemperature``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Compressor suction temperature**. Temperature of refrigerant entering the compressor. Typically 40-60°F. Affects superheat calculation.
* - ``evaporatorTemperature``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Evaporator coil temperature**. Where heat is extracted from ambient air. Typically 20-50°F. Lower outdoor air temperature reduces evaporator efficiency.
* - ``ambientTemperature``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Ambient air temperature** measured at heat pump inlet. Directly affects system performance. At freezing (32°F), heat pump efficiency drops significantly.
* - ``targetSuperHeat``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Target superheat setpoint**. Desired temperature difference between suction and evaporator ensuring complete refrigerant vaporization. Typically 10-20°F.
* - ``currentSuperHeat``
- PentaCelsiusToF
- DeciCelsiusToF
- °F
- **Measured superheat value**. Actual temperature difference. Deviation from target indicates EEV (Electronic Expansion Valve) control issues.

Expand Down
16 changes: 8 additions & 8 deletions docs/protocol/device_status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,37 +122,37 @@ This document lists the fields found in the ``status`` object of device status m
- integer
- °F
- Temperature of the upper part of the tank.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``tankLowerTemperature``
- integer
- °F
- Temperature of the lower part of the tank.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``dischargeTemperature``
- integer
- °F
- Compressor discharge temperature - temperature of refrigerant leaving the compressor.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``suctionTemperature``
- integer
- °F
- Compressor suction temperature - temperature of refrigerant entering the compressor.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``evaporatorTemperature``
- integer
- °F
- Evaporator temperature - temperature where heat is absorbed from ambient air.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``ambientTemperature``
- integer
- °F
- Ambient air temperature measured at the heat pump air intake.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``targetSuperHeat``
- integer
- °F
- Target superheat value - the desired temperature difference ensuring complete refrigerant vaporization.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``compUse``
- bool
- None
Expand Down Expand Up @@ -307,7 +307,7 @@ This document lists the fields found in the ``status`` object of device status m
- integer
- °F
- Current superheat value - actual temperature difference between suction and evaporator temperatures.
- PentaCelsiusToF
- DeciCelsiusToF
* - ``heatUpperUse``
- bool
- None
Expand Down
28 changes: 13 additions & 15 deletions src/nwp500/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def _half_celsius_to_fahrenheit(v: Any) -> float:
return float(v)


def _penta_celsius_to_fahrenheit(v: Any) -> float:
"""Convert value scaled by 5 to Fahrenheit."""
def _deci_celsius_to_fahrenheit(v: Any) -> float:
"""Convert decicelsius (tenths of Celsius) to Fahrenheit."""
if isinstance(v, (int, float)):
celsius = float(v) / 5.0
celsius = float(v) / 10.0
return (celsius * 9 / 5) + 32
return float(v)

Expand All @@ -53,9 +53,7 @@ def _penta_celsius_to_fahrenheit(v: Any) -> float:
DeviceBool = Annotated[bool, BeforeValidator(_device_bool_validator)]
Div10 = Annotated[float, BeforeValidator(_div_10_validator)]
HalfCelsiusToF = Annotated[float, BeforeValidator(_half_celsius_to_fahrenheit)]
PentaCelsiusToF = Annotated[
float, BeforeValidator(_penta_celsius_to_fahrenheit)
]
DeciCelsiusToF = Annotated[float, BeforeValidator(_deci_celsius_to_fahrenheit)]


class NavienBaseModel(BaseModel):
Expand Down Expand Up @@ -289,15 +287,15 @@ class DeviceStatus(NavienBaseModel):
he_lower_off_diff_temp_setting: Div10
recirc_dhw_flow_rate: Div10

# Temperature fields with 1/5 scaling
tank_upper_temperature: PentaCelsiusToF
tank_lower_temperature: PentaCelsiusToF
discharge_temperature: PentaCelsiusToF
suction_temperature: PentaCelsiusToF
evaporator_temperature: PentaCelsiusToF
ambient_temperature: PentaCelsiusToF
target_super_heat: PentaCelsiusToF
current_super_heat: PentaCelsiusToF
# Temperature fields with decicelsius (÷10) to Fahrenheit conversion
tank_upper_temperature: DeciCelsiusToF
tank_lower_temperature: DeciCelsiusToF
discharge_temperature: DeciCelsiusToF
suction_temperature: DeciCelsiusToF
evaporator_temperature: DeciCelsiusToF
ambient_temperature: DeciCelsiusToF
target_super_heat: DeciCelsiusToF
current_super_heat: DeciCelsiusToF

# Enum fields
operation_mode: CurrentOperationMode = Field(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def test_device_status_half_celsius_to_fahrenheit(default_status_data):
assert status.dhw_temperature == pytest.approx(141.8)


def test_device_status_penta_celsius_to_fahrenheit(default_status_data):
"""Test PentaCelsiusToF conversion."""
default_status_data["tankUpperTemperature"] = 250
def test_device_status_deci_celsius_to_fahrenheit(default_status_data):
"""Test DeciCelsiusToF conversion."""
default_status_data["tankUpperTemperature"] = 489
status = DeviceStatus.model_validate(default_status_data)
assert status.tank_upper_temperature == pytest.approx(122.0)
assert status.tank_upper_temperature == pytest.approx(120.0, abs=0.1)


def test_device_status_div10(default_status_data):
Expand Down