Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: LydosHybrid: add night mode #136

Merged
merged 1 commit into from
Feb 23, 2024
Merged
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
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
Loading