Skip to content

Commit

Permalink
Add support for setting quiet mode (#21)
Browse files Browse the repository at this point in the history
* Add support for setting quiet mode
  • Loading branch information
swolix authored Nov 7, 2023
1 parent 6170371 commit bec65f7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
27 changes: 27 additions & 0 deletions aioaquarea/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,28 @@ async def _post_device_zone_temperature(
json=data,
)

@auth_required
async def post_set_quiet_mode(
self, long_id: str, mode: QuietMode
) -> None:
"""Post quiet mode"""
data = {
"status": [
{
"deviceGuid": long_id,
"quietMode": mode.value
}
]
}

response = await self.request(
"POST",
f"{AQUAREA_SERVICE_DEVICES}/{long_id}",
referer=AQUAREA_SERVICE_A2W_STATUS_DISPLAY,
content_type="application/json",
json=data,
)


class TankImpl(Tank):
"""Tank implementation"""
Expand Down Expand Up @@ -598,3 +620,8 @@ async def set_temperature(
await self._client.post_device_zone_heat_temperature(
self.long_id, zone_id, temperature
)

async def set_quiet_mode(
self, mode: QuietMode
) -> None:
await self._client.post_set_quiet_mode(self.long_id, mode)
17 changes: 17 additions & 0 deletions aioaquarea/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ class DeviceDirection(IntEnum):
WATER = 2


class QuietMode(IntEnum):
"""Quiet mode level"""

OFF = 0
LEVEL1 = 1
LEVEL2 = 2
LEVEL3 = 3


@dataclass
class TankStatus:
"""Tank status"""
Expand Down Expand Up @@ -506,3 +515,11 @@ async def set_temperature(
:param temperature: The temperature to set
:param zone_id: The zone id to set the temperature for
"""

@abstractmethod
async def set_quiet_mode(
self, mode: QuietMode
) -> None:
"""Set the quiet mode.
:param mode: Quiet mode to set
"""

0 comments on commit bec65f7

Please sign in to comment.