Skip to content
Closed
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
19 changes: 18 additions & 1 deletion ariston/bsb_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
"""Is zone mode options contains off mode"""
return BsbZoneMode.OFF.value in self.get_zone_mode_options(zone)

@property
def is_hp_on_value(self) -> bool:
"""Get is heating_pump on value"""
return self.data.get(BsbDeviceProperties.HP_ON, False)

@property
def is_flame_on_value(self) -> bool:
"""Get is flame on value"""
Expand Down Expand Up @@ -263,7 +268,7 @@

def get_measured_temp_value(self, zone: int) -> int:
"""Get zone measured temp value"""
return self.get_zone(zone).get(BsbZoneProperties.ROOM_TEMP, 0)
return self.get_zone(self.zone_numbers[0]).get(BsbZoneProperties.ROOM_TEMP, 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please keep the requested zone in both getters (including get_desired_room_temp_value, at line 283). Reading self.zone_numbers[0] ignores the caller's zone, and with empty data it raises IndexError; the existing test_zone_metadata_defaults_and_empty_state_setter_fallbacks expects get_measured_temp_value(8) to return 0. Use get_zone(zone) and cover an unknown zone and a second populated zone.


def get_measured_temp_decimals(self, _) -> int:
"""Get zone measured temp decimals"""
Expand All @@ -273,6 +278,18 @@
"""Get zone measured temp unit"""
return "°C"

def get_desired_room_temp_value(self, zone: int) -> int:

Check warning on line 281 in ariston/bsb_device.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "zone".

See more on https://sonarcloud.io/project/issues?id=fustom_python-ariston-api&issues=AaHR-IvI8Q56ipTD7m1L&open=AaHR-IvI8Q56ipTD7m1L&pullRequest=176
"""Get desired room temp value"""
return self.get_zone(self.zone_numbers[0]).get(BsbZoneProperties.DESIRED_ROOM_TEMP, 0)

def get_desired_room_temp_decimals(self, _) -> int:
"""Get zone measured temp decimals"""
return 1

def get_desired_room_temp_unit(self, _) -> str:
"""Get zone measured temp unit"""
return "°C"

def set_water_heater_temperature(self, temperature: float):
"""Set water heater temperature"""
if len(self.data) == 0:
Expand Down
3 changes: 2 additions & 1 deletion ariston/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,10 @@ class BsbDeviceProperties:
DHW_STORAGE_TEMP_ERROR: Final[str] = "dhwStorageTempError"
DHW_TEMP: Final[str] = "dhwTemp"
FLAME: Final[str] = "flame"
HP_ON: Final[str] = "hpOn"
GW: Final[str] = "gw"
HAS_DHW_TEMP: Final[str] = "hasDhwTemp"
HAS_OUT_TEMP: Final[str] = "hasOutTemp"
HP_ON: Final[str] = "hpOn"
OUTSIDE_TEMP_ERROR: Final[str] = "outsideTempError"
OUT_TEMP: Final[str] = "outTemp"
ZONES: Final[str] = "zones"
Expand Down Expand Up @@ -552,6 +552,7 @@ class DeviceProperties(ExtendedStrEnum):

PLANT_MODE = "PlantMode"
IS_FLAME_ON = "IsFlameOn"
IS_HP_ON = "IsHpOn"
IS_HEATING_PUMP_ON = "IsHeatingPumpOn"
HOLIDAY = "Holiday"
OUTSIDE_TEMP = "OutsideTemp"
Expand Down
Loading