Skip to content

Commit

Permalink
Support whe type 7 (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
fustom committed Aug 26, 2023
1 parent ed6bfb6 commit 640eb79
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ariston/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import logging
from typing import Any, Optional

from ariston.bsb_device import AristonBsbDevice

from .ariston_api import AristonAPI, ConnectionException
from .const import (
DeviceAttribute,
SystemType,
VelisDeviceAttribute,
WheType,
)
from .bsb_device import AristonBsbDevice
from .lux_device import AristonLuxDevice
from .lux2_device import AristonLux2Device
from .evo_device import AristonEvoDevice
from .galevo_device import AristonGalevoDevice
from .lydos_hybrid_device import AristonLydosHybridDevice
Expand Down Expand Up @@ -110,6 +110,11 @@ def _get_device(
api,
device,
)
if whe_type == WheType.Lux2.value:
return AristonLux2Device(
api,
device,
)
_LOGGER.exception("Unsupported whe type %s", whe_type)
return None

Expand Down
14 changes: 14 additions & 0 deletions ariston/ariston_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ def set_evo_eco_mode(self, gw_id: str, eco_mode: bool) -> None:
eco_mode,
)

def set_lux_power_option(self, gw_id: str, power_option: bool) -> None:
"""Set Velis Lux2 power option"""
self._post(
f"{ARISTON_API_URL}{ARISTON_VELIS}/{PlantData.Med.value}/{gw_id}/switchPowerOption",
power_option,
)

def set_velis_power(self, plant_data: PlantData, gw_id: str, power: bool) -> None:
"""Set Velis power"""
self._post(
Expand Down Expand Up @@ -736,6 +743,13 @@ async def async_set_evo_eco_mode(self, gw_id: str, eco_mode: bool) -> None:
eco_mode,
)

async def async_set_lux_power_option(self, gw_id: str, power_option: bool) -> None:
"""Set Velis Lux2 power option"""
await self._async_post(
f"{ARISTON_API_URL}{ARISTON_VELIS}/{PlantData.Med.value}/{gw_id}/switchPowerOption",
power_option,
)

async def async_set_velis_power(
self, plant_data: PlantData, gw_id: str, power: bool
) -> None:
Expand Down
1 change: 1 addition & 0 deletions ariston/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class WheType(Enum):
NuosSplit = 4
Andris2 = 5
Evo2 = 6
Lux2 = 7
Lux = 8


Expand Down
22 changes: 22 additions & 0 deletions ariston/lux2_device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Lux2 device class for Ariston module."""
from __future__ import annotations

import logging

from .const import EvoDeviceProperties
from .evo_device import AristonEvoDevice

_LOGGER = logging.getLogger(__name__)

class AristonLux2Device(AristonEvoDevice):
"""Class representing a physical device, it's state and properties."""

def set_water_heater_power_option(self, power_option: bool):
"""Set water heater power option"""
self.api.set_lux_power_option(self.gw, power_option)
self.data[EvoDeviceProperties.PWR_OPT] = power_option

async def async_set_water_heater_power_option(self, power_option: bool):
"""Async set water heater power option"""
await self.api.async_set_lux_power_option(self.gw, power_option)
self.data[EvoDeviceProperties.PWR_OPT] = power_option

0 comments on commit 640eb79

Please sign in to comment.