Skip to content

Commit 4f7fa2e

Browse files
authored
Add support for Powerful time (#38)
Co-authored-by: swolix<[email protected]>
1 parent 84442aa commit 4f7fa2e

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

aioaquarea/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
Tank,
1919
UpdateOperationMode,
2020
HolidayTimer,
21+
PowerfulTime,
2122
)
2223
from .errors import (
2324
ApiError,
@@ -53,4 +54,5 @@
5354
"DeviceModeStatus",
5455
"ForceHeater",
5556
"HolidayTimer",
57+
"PowerfulTime",
5658
)

aioaquarea/core.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
HolidayTimer,
3333
OperationMode,
3434
OperationStatus,
35+
PowerfulTime,
3536
QuietMode,
3637
SensorMode,
3738
Tank,
@@ -346,6 +347,7 @@ async def get_device_status(self, long_id: str) -> DeviceStatus:
346347
force_dhw=ForceDHW(device.get("forceDHW", 0)),
347348
force_heater=ForceHeater(device.get("forceHeater", 0)),
348349
holiday_timer=HolidayTimer(device.get("holidayTimer", 0)),
350+
powerful_time=PowerfulTime(device.get("powerful", 0)),
349351
)
350352

351353
return device_status
@@ -604,6 +606,28 @@ async def post_device_request_defrost(self, long_id: str) -> None:
604606
json=data,
605607
)
606608

609+
@auth_required
610+
async def post_device_set_powerful_time(
611+
self, long_id: str, powerful_time: PowerfulTime
612+
) -> None:
613+
"""Post powerful time."""
614+
data = {
615+
"status": [
616+
{
617+
"deviceGuid": long_id,
618+
"powerfulRequest": powerful_time.value,
619+
}
620+
]
621+
}
622+
623+
response = await self.request(
624+
"POST",
625+
f"{AQUAREA_SERVICE_DEVICES}/{long_id}",
626+
referer=AQUAREA_SERVICE_A2W_STATUS_DISPLAY,
627+
content_type="application/json",
628+
json=data,
629+
)
630+
607631
async def get_device_consumption(
608632
self, long_id: str, aggregation: DateType, date_input: str
609633
) -> Consumption:
@@ -819,9 +843,19 @@ async def request_defrost(self) -> None:
819843
await self._client.post_device_request_defrost(self.long_id)
820844

821845
async def set_holiday_timer(self, holiday_timer: HolidayTimer) -> None:
822-
"""Enables or disables the holiday timer mode.
846+
"""Enable or disable the holiday timer mode.
823847
824848
:param holiday_timer: The holiday timer option
825849
"""
826850
if self.holiday_timer is not holiday_timer:
827851
await self._client.post_device_holiday_timer(self.long_id, holiday_timer)
852+
853+
async def set_powerful_time(self, powerful_time: PowerfulTime) -> None:
854+
"""Set the powerful time.
855+
856+
:param powerful_time: Time to enable powerful mode
857+
"""
858+
if self.powerful_time is not powerful_time:
859+
await self._client.post_device_set_powerful_time(
860+
self.long_id, powerful_time
861+
)

aioaquarea/data.py

+22
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ class DeviceModeStatus(IntEnum):
121121
DEFROST = 1
122122

123123

124+
class PowerfulTime(IntEnum):
125+
"""Powerful time"""
126+
127+
OFF = 0
128+
ON_30MIN = 1
129+
ON_60MIN = 2
130+
ON_90MIN = 3
131+
132+
124133
@dataclass
125134
class TankStatus:
126135
"""Tank status"""
@@ -197,6 +206,7 @@ class DeviceStatus:
197206
force_dhw: ForceDHW
198207
force_heater: ForceHeater
199208
holiday_timer: HolidayTimer
209+
powerful_time: PowerfulTime
200210

201211

202212
@dataclass
@@ -531,6 +541,11 @@ def holiday_timer(self) -> HolidayTimer:
531541
"""Specifies if the holiday timer is enabled"""
532542
return self._status.holiday_timer
533543

544+
@property
545+
def powerful_time(self) -> PowerfulTime:
546+
"""Specifies if the powerful time is enabled and for how long"""
547+
return self._status.powerful_time
548+
534549
def support_cooling(self, zone_id: int = 1) -> bool:
535550
"""True if the device supports cooling in the given zone"""
536551
zone = self.zones.get(zone_id, None)
@@ -620,3 +635,10 @@ async def set_holiday_timer(self, holiday_timer: HolidayTimer) -> None:
620635
621636
:param holiday_timer: The holiday timer option
622637
"""
638+
639+
@abstractmethod
640+
async def set_powerful_time(self, powerful_time: PowerfulTime) -> None:
641+
"""Set the powerful time.
642+
643+
:param powerful_time: Time to enable powerful mode
644+
"""

0 commit comments

Comments
 (0)