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
7 changes: 6 additions & 1 deletion ariston/galevo_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

_LOGGER = logging.getLogger(__name__)
_MENU_ITEM_UNAVAILABLE_VALUES = frozenset({3276.0, 3276.7, -3276.8, -3277.0})
_CH_RETURN_TEMP_UNAVAILABLE_VALUES = _MENU_ITEM_UNAVAILABLE_VALUES | {0.0}


class AristonGalevoDevice(AristonDevice):
Expand Down Expand Up @@ -816,7 +817,11 @@ def _is_menu_item_available(item: Optional[dict[str, Any]]) -> bool:
if value is None:
return False
try:
if float(value) in _MENU_ITEM_UNAVAILABLE_VALUES:
numeric_value = float(value)
unavailable_values = _MENU_ITEM_UNAVAILABLE_VALUES
if item.get("id") == MenuItemNames.CH_RETURN_TEMP.value:
unavailable_values = _CH_RETURN_TEMP_UNAVAILABLE_VALUES
if numeric_value in unavailable_values:
return False
except (TypeError, ValueError):
pass
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies = [
]
requires-python = ">=3.11"
license = { file = "LICENSE" }
version = "0.19.16"
version = "0.19.17"
dynamic = ['description']

[project.urls]
Expand Down
18 changes: 18 additions & 0 deletions tests/test_galevo_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,24 @@ def test_heat_pump_menu_items_availability_getters_and_error_handling(self):
device.menu_items = []
self.assertIsNone(device.hp_mode_value)

def test_zero_ch_return_temperature_is_unavailable_but_other_zero_values_are_valid(self):
device = self.make_device()
device.menu_items = [
{
"id": MenuItemNames.CH_RETURN_TEMP.value,
PropertyType.VALUE: 0.0,
PropertyType.UNIT: "°C",
},
{
"id": MenuItemNames.HP_OUTSIDE_AIR_TEMP.value,
PropertyType.VALUE: 0.0,
PropertyType.UNIT: "°C",
},
]

self.assertIsNone(device.ch_return_temp_value)
self.assertEqual(device.hp_outside_air_temp_value, 0.0)


if __name__ == "__main__":
unittest.main()