Während der Woche der Wärmepumpe haben Sie bundesweit die Möglichkeit, die innovative Wärmepumpentechnologie näher kennenzulernen. Mit über 50 Informationsveranstaltungen beteiligt sich Viessmann Climate Solutions an der Aktionswoche und lädt Sie herzlich ein – vor Ort oder online – dabei zu sein.
Mehr erfahren →Hi everyone,
first of all thanks a lot for the documentation on the API, which makes it possible even for beginners like me to work/play with it.
I went over the documentation and managed (of course after many tries and mistakes) to complete the getting started part and also the authentication. Everything works fine.
I can also read out actual values of my system.
E.g.
curl -X GET https://api.viessmann.com/iot/v2/features/installations/{{Installation_ID}}/gateways/{{gateway_ID}}/devices/{{device_ID}}/features/heating.dhw.temperature.main --header "Authorization: Bearer {Access_Token}"
As stated, that works like a charm.
But I cannot figure out how to set a new target value.
I have tried it as it is shown in the documentation:
curl -X POST https://api.viessmann.com/iot/v2/features/installations/{{installationID}}/gateways/{{gatewaySerial}}/devices/{{deviceId}}/features/heating.dhw.temperature.main/commands/setTargetTemperature --header 'Content-Type: application/json' --data '{"temperature": 55}'
Of course that does not work, because I need to handover my access-token as well. (my understanding)
So I receive:
{"viErrorId":"req-3873e289641245f7b2283b16f52260ab","statusCode":401,"errorType":"UNAUTHORIZED","message":"Authorization failed while trying to perform this action"}
But when add my access token to that, I think I am messing something up with the syntax, because I keep getting error messages.
I tried for example
curl -X POST https://api.viessmann.com/iot/v2/features/installations/{{installationID}}/gateways/{{gatewaySerial}}/devices/{{deviceId}}/features/heating.dhw.temperature.main/commands/setTargetTemperature --header 'Content-Type: application/json' --data '{"temperature": 55}' --header 'Authorization: Bearer {{Access_Token}}'
Or
curl -X POST https://api.viessmann.com/iot/v2/features/installations/{{installationID}}/gateways/{{gatewaySerial}}/devices/{{deviceId}}/features/heating.dhw.temperature.main/commands/setTargetTemperature --header 'Authorization: Bearer {Access_Token}' --header 'Content-Type: application/json' --data '{"temperature": 55}' --header 'Authorization: Bearer {Access_Token}'
And many many more. But no luck.
Usually the return message ist:
{"viErrorId":"req-22da678479e54f0faac6ddeddd2a61db","statusCode":401,"errorType":"UNAUTHORIZED","message":"Authorization failed while trying to perform this action"}curl: (6) Could not resolve host: Bearer
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: application
curl: (3) unmatched close brace/bracket in URL position 3:
44}'
Could someone help me to find the right syntax for setting a target value?
Thanks a lot in advance and please excuse any lack of knowledge here. I am just getting started 🙂
Kind regards
Gelöst! Gehe zu Lösung.
Hi @rbeintausend , happy to support you on your issue!
Here is a request for setting a value, that is working for me (setting the target temperature of the comfort program to 20 degrees):
curl -X POST 'https://api.viessmann.com/iot/v2/features/installations/{{installationID}}/gateways/{{gatewaySerial}...' --header 'Content-Type: application/json' --header 'Authorization: Bearer {{Access_Token}}' --data '{"targetTemperature": 20}'
This is the response:
{
"data": {
"success": true,
"message": null,
"reason": "COMMAND_EXECUTION_SUCCESS"
}
}
The request does not really differ from what you are attempting to do. So I am not sure yet what could be the issue for you. Normally, the error message you get shows that there is no access token provided in the request.
Did you also try using Postman for this API request? In our Postman example collection, you also find a command for setting the DHW temperature. You can also let Postman show you the corresponding cURL request by clicking on the </> icon on the right hand side of Postman.
I hope this helps.
Regards,
Michael
Hi again,
anyone able to help me out here? I am really stuck 😞
Thank you for any possible help
Hi @rbeintausend , happy to support you on your issue!
Here is a request for setting a value, that is working for me (setting the target temperature of the comfort program to 20 degrees):
curl -X POST 'https://api.viessmann.com/iot/v2/features/installations/{{installationID}}/gateways/{{gatewaySerial}...' --header 'Content-Type: application/json' --header 'Authorization: Bearer {{Access_Token}}' --data '{"targetTemperature": 20}'
This is the response:
{
"data": {
"success": true,
"message": null,
"reason": "COMMAND_EXECUTION_SUCCESS"
}
}
The request does not really differ from what you are attempting to do. So I am not sure yet what could be the issue for you. Normally, the error message you get shows that there is no access token provided in the request.
Did you also try using Postman for this API request? In our Postman example collection, you also find a command for setting the DHW temperature. You can also let Postman show you the corresponding cURL request by clicking on the </> icon on the right hand side of Postman.
I hope this helps.
Regards,
Michael
Hi @MichaelHanna ,
first of all thanks a lot for your help.
Unfortunately I tried the syntax you posted and it does not help. I am getting the following return message:
{"viErrorId":"req-dd86ffe0155f41e392b483896d2a8e01","statusCode":401,"errorType":"UNAUTHORIZED","message":"Authorization failed while trying to perform this action"}curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: application
curl: (3) URL using bad/illegal format or missing URL
curl: (6) Could not resolve host: Bearer
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched brace in URL position 2:
'{targetTemperature:
^
The access token is not the issue, I tested it with several GET commands and the returns are always fine. The issue seems to comes up, when I try to pass more than one header. (For the GET commands I do not need that, I just hand over the access token)
I am using the windows command prompt, so maybe the issue lies there.
Next step for me is trying it with Postman.
I will let you know, if that solves the issue.
Kind regards
Robert
Hi again @MichaelHanna ,
so it works with Postman.
If I copy the cURL request from Postman to the command prompt, it does not work anymore. So the problem was there I think.
Thanks again and kind regards
Robert