Skip to content

Commit

Permalink
feat: add humidity management (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 authored Feb 23, 2024
1 parent 9c73d5c commit 1f7b9a9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/aiocomelit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ async def _translate_device_status(self, dev_type: str, dev_status: int) -> str:

return "on" if dev_status == STATE_ON else "off"

async def set_clima_status(self, index: int, action: str, temp: float = 0) -> bool:
"""Set clima status.
async def _set_thermo_humi_status(
self, index: int, mode: str, action: str, value: float = 0
) -> bool:
"""Set clima or humidity status.
action:
auto, man, on, off, set
Expand All @@ -257,12 +258,22 @@ async def set_clima_status(self, index: int, action: str, temp: float = 0) -> bo
await self._sleep_between_call(delta_seconds)

reply_status = await self._get_page_result(
f"/user/action.cgi?clima={index}&thermo={action}&val={int(temp*10)}", False
f"/user/action.cgi?clima={index}&{mode}={action}&val={int(value*10)}", False
)
self._last_clima_command = datetime.now()
self._semaphore.release()
return reply_status == 200

async def set_clima_status(self, index: int, action: str, temp: float = 0) -> bool:
"""Set clima status."""
return await self._set_thermo_humi_status(index, "thermo", action, temp)

async def set_humidity_status(
self, index: int, action: str, humidity: float = 0
) -> bool:
"""Set humidity status."""
return await self._set_thermo_humi_status(index, "humi", action, humidity)

async def set_device_status(
self, device_type: str, index: int, action: int
) -> bool:
Expand Down

0 comments on commit 1f7b9a9

Please # to comment.