From e46b0542bb026cc5b38ad3ad8da387e8e91efd58 Mon Sep 17 00:00:00 2001 From: fustom Date: Fri, 23 Feb 2024 13:55:55 +0100 Subject: [PATCH] Feat: LydosHybrid: add night mode (#136) --- ariston/lydos_hybrid_device.py | 101 +++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/ariston/lydos_hybrid_device.py b/ariston/lydos_hybrid_device.py index 12bd5ac..8c71128 100644 --- a/ariston/lydos_hybrid_device.py +++ b/ariston/lydos_hybrid_device.py @@ -91,6 +91,41 @@ def anti_cooling_temperature_minimum(self) -> int: """Get anti cooling temperature minimum""" return self.plant_settings.get(SeDeviceSettings.SE_ANTI_COOLING_TEMPERATURE_MIN, 0) + @property + def night_mode_value(self) -> int: + """Get night mode value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_MODE_ON_OFF, 0) + + @property + def night_mode_begin_as_minutes_value(self) -> int: + """Get night mode begin as minutes value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_BEGIN_AS_MINUTES, 0) + + @property + def night_mode_begin_max_as_minutes_value(self) -> int: + """Get night mode begin max as minutes value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_BEGIN_MAX_AS_MINUTES, 0) + + @property + def night_mode_begin_min_as_minutes_value(self) -> int: + """Get night mode begin min as minutes value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_BEGIN_MIN_AS_MINUTES, 0) + + @property + def night_mode_end_as_minutes_value(self) -> int: + """Get night mode end as minutes value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_END_AS_MINUTES, 0) + + @property + def night_mode_end_max_as_minutes_value(self) -> int: + """Get night mode end max as minutes value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_END_MAX_AS_MINUTES, 0) + + @property + def night_mode_end_min_as_minutes_value(self) -> int: + """Get night mode end min as minutes value""" + return self.plant_settings.get(SeDeviceSettings.SE_NIGHT_END_MIN_AS_MINUTES, 0) + def set_water_heater_operation_mode(self, operation_mode: str): """Set water heater operation mode""" self.api.set_lydos_mode(self.gw, LydosPlantMode[operation_mode]) @@ -176,3 +211,69 @@ async def async_set_cooling_temperature_value(self, temperature: float) -> None: self.anti_cooling_temperature_value, ) self.plant_settings[SeDeviceSettings.SE_ANTI_COOLING_TEMPERATURE] = temperature + + def set_night_mode_value(self, night_mode: float) -> None: + """Set night mode value""" + self.api.set_velis_plant_setting( + self.plant_data, + self.gw, + SeDeviceSettings.SE_NIGHT_MODE_ON_OFF, + 1.0 if night_mode else 0.0, + 1.0 if self.night_mode_value else 0.0, + ) + self.plant_settings[SeDeviceSettings.SE_NIGHT_MODE_ON_OFF] = night_mode + + async def async_set_night_mode_value(self, night_mode: float) -> None: + """Async set night mode value""" + await self.api.async_set_velis_plant_setting( + self.plant_data, + self.gw, + SeDeviceSettings.SE_NIGHT_MODE_ON_OFF, + 1.0 if night_mode else 0.0, + 1.0 if self.night_mode_value else 0.0, + ) + self.plant_settings[SeDeviceSettings.SE_NIGHT_MODE_ON_OFF] = night_mode + + def set_night_mode_begin_as_minutes_value(self, night_mode_begin_as_minutes: int) -> None: + """Set night mode begin as minutes value""" + self.api.set_velis_plant_setting( + self.plant_data, + self.gw, + SeDeviceSettings.SE_NIGHT_BEGIN_AS_MINUTES, + night_mode_begin_as_minutes, + self.night_mode_begin_as_minutes_value, + ) + self.plant_settings[SeDeviceSettings.SE_NIGHT_BEGIN_AS_MINUTES] = night_mode_begin_as_minutes + + async def async_set_night_mode_begin_as_minutes_value(self, night_mode_begin_as_minutes: int) -> None: + """Async set night mode begin as minutes value""" + await self.api.async_set_velis_plant_setting( + self.plant_data, + self.gw, + SeDeviceSettings.SE_NIGHT_BEGIN_AS_MINUTES, + night_mode_begin_as_minutes, + self.night_mode_begin_as_minutes_value, + ) + self.plant_settings[SeDeviceSettings.SE_NIGHT_BEGIN_AS_MINUTES] = night_mode_begin_as_minutes + + def set_night_mode_end_as_minutes_value(self, night_mode_end_as_minutes: int) -> None: + """Set night mode end as minutes value""" + self.api.set_velis_plant_setting( + self.plant_data, + self.gw, + SeDeviceSettings.SE_NIGHT_END_AS_MINUTES, + night_mode_end_as_minutes, + self.night_mode_end_as_minutes_value, + ) + self.plant_settings[SeDeviceSettings.SE_NIGHT_END_AS_MINUTES] = night_mode_end_as_minutes + + async def async_set_night_mode_end_as_minutes_value(self, night_mode_end_as_minutes: int) -> None: + """Async set night mode end as minutes value""" + await self.api.async_set_velis_plant_setting( + self.plant_data, + self.gw, + SeDeviceSettings.SE_NIGHT_END_AS_MINUTES, + night_mode_end_as_minutes, + self.night_mode_end_as_minutes_value, + ) + self.plant_settings[SeDeviceSettings.SE_NIGHT_END_AS_MINUTES] = night_mode_end_as_minutes