thomasgermain / pymultiMATIC

Python interface with Vaillant multiMATIC
MIT License
56 stars 11 forks source link

set_zone_heating_operating_mode without any effect #51

Closed lightfield1 closed 3 years ago

lightfield1 commented 3 years ago

Hello @thomasgermain ,

coming from here with a (perhaps stupid) technical question ;-)

i'am using your code

`#!/usr/bin/env python3

import asyncio import sys

import aiohttp

from pymultimatic.systemmanager import SystemManager from pymultimatic.model import System, quick_mode

async def main(user, passw): print('Trying to connect with user ' + user)

async with aiohttp.ClientSession() as session: manager = SystemManager(user, passw, session) system = await manager.set_zone_heating_operating_mode('Control_ZO1','OperatingModes.NIGHT') print(system)

if name == "main": if not len(sys.argv) == 3: print('Usage: python3 dump.py user pass') sys.exit(0) user = sys.argv[1] passw = sys.argv[2]

asyncio.get_event_loop().run_until_complete(main(user, passw))`

but this seems to have no effect since system = await manager.get_zone("Control_ZO1") ist still showing operating_mode=OperatingMode(name='AUTO'):

Trying to connect with user [xxx] Zone(id='Control_ZO1', name='Wohnzimmer', temperature=21.9, quick_veto=None, active_function=<ActiveFunction.HEATING: 'HEATING'>, rbr=False, heating=ZoneHeating(time_program=TimeProgram(days={'monday': ... setting=SettingMode(name='DAY'), hour=0, minute=30, absolute_minutes=30)]), 'sunday': TimeProgramDay(settings=[TimePeriodSetting(start_time='00:00', target_temperature=None, setting=SettingMode(name='NIGHT'), hour=0, minute=0, absolute_minutes=0), TimePeriodSetting(start_time='00:30', target_temperature=None, setting=SettingMode(name='DAY'), hour=0, minute=30, absolute_minutes=30)])}), operating_mode=OperatingMode(name='AUTO'), target_high=22.0, target_low=20.5), cooling=None, enabled=True) I hope you (or enyone else) can help me best regards

thomasgermain commented 3 years ago

you should use OperatingModes.NIGHT (from pymultimatic.model), not 'OperatingModes.NIGHT'

lightfield1 commented 3 years ago

OK, didn't thougth that I'm souch a newbie, but i don't get it: changing the line in your example to system = await manager.set_zone_heating_operating_mode('Control_ZO1',OperatingModes.NIGHT) (without quotes) shows following error: Traceback (most recent call last): File "set_multimatic2.py", line 30, in <module> asyncio.get_event_loop().run_until_complete(main(user, passw)) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "set_multimatic2.py", line 18, in main system = await manager.set_zone_heating_operating_mode('Control_ZO1',OperatingModes.NIGHT) NameError: name 'OperatingModes' is not defined

could you give the "complete" example?

Thank u very mutch for your patience

thomasgermain commented 3 years ago

You're doing it right, you are just missing the import: check here from pymultimatic.model import System, quick_mode, you should add OperatingModes. You have to tell python where it has to find OperatingModes

lightfield1 commented 3 years ago

Thank you so much! It Works!!