thomasgermain / pymultiMATIC

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

put-Requests not working #108

Closed WulfgarW closed 1 year ago

WulfgarW commented 1 year ago

I'm happy, that I found pymultiMATIC. I was searching for programm code to control my hvac from my pc or raspberry pi.

Using the pymultiMATIC code get requests work fine on my system, delete quick veto too. But put requests produce errors or show no effect:

Example 1: Request-Data: mode: put url: https://smart.vaillant.com/mobile/api/v4/facilities/SERIAL/systemcontrol/tli/v1/zones/Control_ZO2/configuration/quick_veto payload: {'temperature_setpoint': 20.5} response: null (no effect)

Example 2: Request-Data: mode: put url: https://smart.vaillant.com/mobile/api/v4/facilities/SERIAL/systemcontrol/tli/v1/zones/Control_ZO2/heating/configuration/setpoint_temperature payload: {'temperature_setpoint': 20.5} response: HTTP Status 404

My gateway is a VR921.

Is the code not fully compatible with VR921? Or are the url or the payload incorrect?

thomasgermain commented 1 year ago

Hello,

For the first url, what is the HTTP status in the response ? Could you try to add a "duration" to the json ? (Duration is in hour). Also, quick veto might not be applied is you already have a quick mode running.

For the second url, everything sounds correct.

The lib should be compatible with VR921.

I guess you are using the ApiConnector ? Maybe you can have a try with SystemManager (while SystemManager is using ApiConnector behind the hood).

WulfgarW commented 1 year ago

Thanks for your response.

I added a duration in the payload for quick veto. I had tried it before, but I thought the duration unit was minutes and took values like 60 or 90. Now I tried 1.0 and it works. (http status is 200.)

The second example still produces http error 404. I tried it with SystemManager (reponse = await manager.set_zone_heating_setpoint_temperature('Control_ZO2', 18.0)) and with code based on dump.py: .... urlName="zone_heating_setpoint_temperature" params= {"serial": serial} params.update( {"id": "Control_ZO2"}) url = getattr(url_class, urlName) payloadName = "zone_temperature_setpoint" payloadParams= {"temperature": 19.5} payload_class = payload_class_map.get(system_control, payloads) payload = getattr(payload_class, payloadName) req= connector.put(url(params), payload(payloadParams))

thomasgermain commented 1 year ago

@xaviergriffon May I ask you to check if you can change the target high temperature for a zone using the SystemManager ? It sounds it doesn't work (or is yet another API :sweat_smile: ?)

@WulfgarW How are you creating the systemManager, you can specify an application parameter, by default it is multimatic, but in your case, I think it should be defaults.SENSO

xaviergriffon commented 1 year ago

I confirm, I did reproduce the problem.

I have created a PR with corrections for the Senso APIs. Here is an extract of the tests I did:

# switch to manual mode with a temperature of 20
await manager.set_zone_heating_operating_mode(zone_id, OperatingModes.MANUAL)
await manager.set_zone_heating_setpoint_temperature(zone_id, 20.0)
# switch to Auto mode with a reduced temperature of 19
await manager.set_zone_heating_operating_mode(zone_id, OperatingModes.TIME_CONTROLLED)
await manager.set_zone_heating_setback_temperature(zone_id, 19.0)
thomasgermain commented 1 year ago

I have pretty much the same comment as in the PR, how would you set the target high temperature to 22 when "TIMED_CONTROLLED" mode is activated ?

WulfgarW commented 1 year ago

Now it works with the fixes, that Xavier provided for urls_senso.py und payloads_senso.py.

It's also possible to change the manual_mode_temperature_setpoint while the operation_mode of the zone is not MANUAL. (Not surprisingly, the active target temperature is driven by the time program.)