Created
July 5, 2024 20:16
-
-
Save ALERTua/58d49db5b467bb3f14949d0b4684a13c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import datetime | |
from pyoverkiz.const import SUPPORTED_SERVERS | |
from pyoverkiz.client import OverkizClient | |
from pyoverkiz.enums import Server, OverkizState | |
from pyoverkiz.models import Command | |
from pyoverkiz.enums.command import OverkizCommandParam | |
USERNAME = "COZYTOUCH_USERNAME" | |
PASSWORD = "COZYTOUCH_PASSWORD" | |
async def main() -> None: | |
async with OverkizClient(USERNAME, PASSWORD, server=SUPPORTED_SERVERS[Server.ATLANTIC_COZYTOUCH]) as client: | |
try: | |
await client.login() | |
except Exception as exception: | |
print(exception) | |
return | |
# setup = await client.get_setup() | |
devices = await client.get_devices() | |
modbus = [_ for _ in devices if 'modbuslink://' in _.device_url][0] | |
device_url = modbus.device_url | |
commands = list(modbus.definition.commands) | |
commands.sort(key=lambda _: _.command_name) | |
state = await client.get_state(device_url) | |
state.sort(key=lambda _: _.name) | |
# cmd1 = Command('setExpectedNumberOfShower', [5]) | |
# result1 = await client.execute_command(device_url, cmd1) | |
# cmd2 = Command('setTargetDHWTemperature', [64.9]) | |
# result2 = await client.execute_command(device_url, cmd2) | |
# cmd3 = Command('setDHWMode', ['autoMode']) | |
# cmd3 = Command('setDHWMode', ['manualEcoInactive']) | |
now = datetime.datetime.now() | |
future = now + datetime.timedelta(weeks=4) | |
cmd2 = Command('setAbsenceEndDate', [{'month': now.month, 'hour': now.hour, 'year': now.year, 'weekday': now.weekday(), 'day': now.day, 'minute': now.minute, 'second': now.second}]) | |
result2 = await client.execute_command(device_url, cmd2) | |
cmd4 = Command('setAbsenceMode', ['off']) | |
result4 = await client.execute_command(device_url, cmd4) | |
cmd1 = Command('setAbsenceStartDate', [{'month': now.month, 'hour': now.hour, 'year': now.year, 'weekday': now.weekday(), 'day': now.day, 'minute': now.minute, 'second': now.second}]) | |
result1 = await client.execute_command(device_url, cmd1) | |
cmd2 = Command('setAbsenceEndDate', [{'month': future.month, 'hour': future.hour, 'year': future.year, 'weekday': future.weekday(), 'day': future.day, 'minute': future.minute, 'second': future.second}]) | |
result2 = await client.execute_command(device_url, cmd2) | |
cmd3 = Command('setAbsenceMode', ['prog']) | |
result3 = await client.execute_command(device_url, cmd3) | |
cmd4 = Command('setAbsenceMode', ['off']) | |
result4 = await client.execute_command(device_url, cmd4) | |
pass | |
if __name__ == '__main__': | |
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment