Skip to content

Commit

Permalink
Feat: LydosHybrid: add night mode (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
fustom authored Feb 23, 2024
1 parent e4552d7 commit e46b054
Showing 1 changed file with 101 additions and 0 deletions.
101 changes: 101 additions & 0 deletions ariston/lydos_hybrid_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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

0 comments on commit e46b054

Please sign in to comment.