Open R0b0tRob opened 4 years ago
Yes, i've the same problem.
There is a bug in the Javascript for the the two functions that you talk about. I have corrected both and will push out an update shortly.
This is now available as v0.9.2
Great!!!
Thank You!
Not sure how long it will take for node-red to make the update available. Mine still isn't showing it but I did a manual npm update and verified the fixes. Apologies for the inconvenience. I'll close the ticket but feel free to reopen if the issue persists
could it be that this is not working in 0.9.4 ? I'm not able to set the device to open window mode :/
Hi , I've just been testing this both using node.js and the node-red integration and everything looks to be working for me now. If you have details on your setup and a flow that you're happy to share then I'm happy to take a closer look. Thanks
I try to set all tado thermostates in a zone into the "window is open" mode triggering the "Set open window mode" with having "active" configured.
looks somewhat like this: [{"id":"7846cb96.92a574","type":"tab","label":"Tado Test Flow","disabled":false,"info":""},{"id":"a4b04ebc.aeae6","type":"tado","z":"7846cb96.92a574","configName":"e016b9fe.b65d48","apiCall":"setOpenWindowMode","homeId":"123456","deviceId":"VA12345678","zoneId":"2","power":"on","temperature":"25","terminationType":"auto","terminationTimeout":900,"name":"Tado_HeizungAutoMode","reportDate":"","presence":"HOME","geoTracking":true,"temperatureOffset":0,"windowDetection":true,"windowDetectionTimeout":900,"openWindowMode":"true","timetableId":"","x":490,"y":165,"wires":[["a818aa72.4b7a18"]]},{"id":"345165d2.1acbea","type":"inject","z":"7846cb96.92a574","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":165,"wires":[["a4b04ebc.aeae6"]]},{"id":"a818aa72.4b7a18","type":"debug","z":"7846cb96.92a574","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":745,"y":165,"wires":[]},{"id":"e016b9fe.b65d48","type":"tado-config","name":"Name"}]
I've just had a play around with the node-red version of the code, the underlying node.js library and playing around with CURL and it looks as though Tado have changed their API slightly and you're correct the "Set open window mode" functionality is now longer working when the mode is "Activate" - cancels do seem to still work.
I have tried repeatedly with various JSON payloads and slight variations on the URL and can't quite find the right combination to get the functionality to work. I'm going to reopen the issue and pin it so that others will find it. Apologies for the inconvenience but it looks like this one might be out of my hands,
Thank you @mattdavis90, maybe tado can communicate their changes here.
Hi, what does the "setOpenWindowMode" do? When i set it do activate its nothing happend, also when i set it do cancel.. The Other API "Configure Window Detection" is to enable / disable the "Window detection". I like to simulate an opened Window.
@mitch85 please see the above comments. The function should simulate an open window but it stopped working a few months ago. I've left the functionality available in case it starts working again but for now it isn't. You can, however, cancel and open window using the API, you just can't force the system into an open window state
Hi, I found something on the internet... for open window to work first an open window must be detected by Tado. And POST API call is https://my.tado.com/api/v2/homes/
Hi @kissmancz, thanks for getting in touch. That's the same call the library currently makes which doesn't work unfortunately. It previously did but not anymore. It can be seen in the underlying library here https://github.com/mattdavis90/node-tado-client/blob/afd02559850f7b5f62a0d42acfce8891d22e3988/index.js#L271
Update: workaround/solution below.
Hi there, I've been playing with the openWindow/activate call for like 2 hours now and I cannot really understand what is the reason for the call to fail with 400 Bad Request.
The call looks nearly the same in Edge inspector as it does when I try to replicate it in cURL. See below the Chrome request:
"_priority": "High",
"_resourceType": "xhr",
"cache": {},
"pageref": "page_1",
"request": {
"method": "POST",
"url": "https://my.tado.com/api/v2/homes/<HOME NUMBER REDACTED>/zones/1/state/openWindow/activate",
"httpVersion": "http/2.0",
"headers": [
{
"name": "sec-ch-ua",
"value": "\"Chromium\";v=\"94\", \"Microsoft Edge\";v=\"94\", \";Not A Brand\";v=\"99\""
},
{
"name": "DNT",
"value": "1"
},
{
"name": "sec-ch-ua-mobile",
"value": "?0"
},
{
"name": "Authorization",
"value": "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZDhlM2E1NzVmMTUwMzAwMGIyNTlmNjkiLCJ0YWRvX2hvbWVzIjpbeyJpZCI6MzY2NzA5fV0sImlzcyI6InRhZG8iLCJsb2NhbGUiOiJlbl9jeiIsImF1ZCI6WyJwYXJ0bmVyIl0sIm5iZiI6MTYzNDMxNDU4MywidGFkb19zY29wZSI6WyJob21lLnVzZXIiXSwidGFkb191c2VybmFtZSI6ImdybWVsYUBnbWFpbC5jb20iLCJuYW1lIjoiSmFuIEdybWVsYSIsImV4cCI6MTYzNDMxNTE4MywiaWF0IjoxNjM0MzE0NTgzLCJ0YWRvX2NsaWVudF9pZCI6InRhZG8td2ViLWFwcCIsImp0aSI6IjhiZmQxNzU4LTQ1NGQtNDIzZS1hY2E0LTQ2MTFlYmQ3MDI1NiIsImVtYWlsIjoiZ3JtZWxhQGdtYWlsLmNvbSJ9.a4r7ywAq_EKsx5dT2wz93eA2Wxza5ab_PE4refTA-HTNd_TtRPoMMdq76f9lEOH1APwTpU2oh6ibXu4CR4b_3SLvJGnpqLXDh6i67F1t8DbLAknkFUFHmGmWnw2IuzYkzip9QAIvvD2iNZ61M-niP8DdJW6arIcwF5VEZbekJHwct9d8csSOWwEV1QBc28fJOcQdQlLRVYHhQrkGzVLKfCqw0uBVG86odqh2orxfskX-c1v2sFxAI9WBU3_ijK5rFZb1rxLo2tWmwgSI35TTol2kNuOAopfFq3PZGYIXl1EiIk40JXlvwW1eL3fsVko439uqWRn01aWMbg1saCY21w"
},
{
"name": "Accept",
"value": "application/json, text/plain, */*"
},
{
"name": "Referer",
"value": "https://app.tado.com/"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31"
},
{
"name": "sec-ch-ua-platform",
"value": "\"macOS\""
}
],
"queryString": [],
"cookies": [],
"headersSize": -1,
"bodySize": 0
},
"response": {
"status": 204,
"statusText": "",
"httpVersion": "http/2.0",
"headers": [
{
"name": "content-security-policy",
"value": "frame-ancestors 'none'"
},
{
"name": "x-content-type-options",
"value": "nosniff"
},
{
"name": "date",
"value": "Fri, 15 Oct 2021 16:20:28 GMT"
},
{
"name": "x-frame-options",
"value": "DENY"
},
{
"name": "access-control-allow-origin",
"value": "https://app.tado.com"
},
{
"name": "access-control-allow-credentials",
"value": "true"
},
{
"name": "strict-transport-security",
"value": "max-age=31536000"
},
{
"name": "vary",
"value": "Origin"
},
{
"name": "x-application-context",
"value": "application:production"
}
],
"cookies": [],
"content": {
"size": 0,
"mimeType": "x-unknown",
"text": ""
},
"redirectURL": "",
"headersSize": -1,
"bodySize": -1,
"_transferSize": 0,
"_error": null
}
And this is the same call in cURL. The only difference is HTTP/1.1 instead of 2 since my cURL version doesn't seem to support it. I don't think that might be the cause as not every browser supports it so tado shouldn't force it:
{
["url"]=>
string(73) "https://my.tado.com/api/v2/homes/<HOME NUMBER REDACTED>/zones/1/state/openWindow/activate",
["request_header"]=>
string(1665) "POST /api/v2/homes/<HOME NUMBER REDACTED>/zones/1/state/openWindow/activate HTTP/1.1
Host: my.tado.com
Cookie: AWSALBCORS=vq8OYo5L2pDuoiBUt20J6jY/XIrRzn6WXC4GQxTT0BjOf7FIUvRWOlNu73EhwhDjafwLIboqRJXjTIHYQq3AU6I0shaxtSugZG7gvH3+JBLyb8nTw20WEymfAiod; AWSALB=vq8OYo5L2pDuoiBUt20J6jY/XIrRzn6WXC4GQxTT0BjOf7FIUvRWOlNu73EhwhDjafwLIboqRJXjTIHYQq3AU6I0shaxtSugZG7gvH3+JBLyb8nTw20WEymfAiod
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZDhlM2E1NzVmMTUwMzAwMGIyNTlmNjkiLCJ0YWRvX2hvbWVzIjpbeyJpZCI6MzY2NzA5fV0sImlzcyI6InRhZG8iLCJsb2NhbGUiOiJlbl9jeiIsImF1ZCI6InBhcnRuZXIiLCJuYmYiOjE2MzQzMjA2MDQsInRhZG9fc2NvcGUiOlsiaG9tZS51c2VyIl0sInRhZG9fdXNlcm5hbWUiOiJncm1lbGFAZ21haWwuY29tIiwibmFtZSI6IkphbiBHcm1lbGEiLCJleHAiOjE2MzQzMjEyMDQsImlhdCI6MTYzNDMyMDYwNCwidGFkb19jbGllbnRfaWQiOiJ0YWRvLXdlYi1hcHAiLCJqdGkiOiIzZTcxYTVhMS0yMDU5LTQ0MGQtYjM5My1hZmM4MzMxYWM5NzgiLCJlbWFpbCI6ImdybWVsYUBnbWFpbC5jb20ifQ.AYmPrxhSXWiyQt9ayd32dMZ8FQIckqETAdSTsKLH86m8yP4lLsTgOOgRrkYm1P2knP3OYxRchIVC3lOc1IV_y-nLSD2dQF7-AFha4BEm4AtvRWQwoRFn4fxgH-A2VyoTdnV2SzLUZcfziEvVDQYnBS_TGZvFhoJ6QFB7wG4_zg03AMBJyJ1EBVlHNrqhcNVgWGlvfTCLCpugvStKoauqzl2JukOYSUpbtps7J4dXJMHcQfSeIgteQEDAwdfOXeEeUa3BKIDatVT-G5uczIxodRbU6x4RllA0VTIsHj5YNuUSnWw3dJx8NzjXVgKsxEHhSxgtpWnwflmFTrJeaywJ9w
Referer: https://app.tado.com/
sec-ch-ua: "Chromium";v="94", "Microsoft Edge";v="94", ";Not A Brand";v="99"
sec-ua-mobile: ?0
sec-ua-platform: "macOS"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36 Edg/94.0.992.31
DNT: 1
Accept: application/json, text/plain, */*
Content-Type: application/json
Content-Length: -1
Expect: 100-continue
"
}
As you can see, those requests are nearly identical (Bearer is, of course, correct in this case).
Update: After some trial and error, I've found out the reason for this not to work is apparently the cURL version. I'm testing my code in PHP (not this project or node related at all) but the underlying library is cURL. The version I've available is 7.29.0 which is apparently pretty ancient.
For some reason unclear to me, the cURL call fails with HTTP error 400 each time, no matter how I modify the parameters. However, when I've switched to the file_get_contents()
with the exactly same parameters, the call succeeded with code 204 even with HTTP/1.1. So I suggest, if possible, to either update the cURL version or switch to a different library, even if just for this particular call.
Hi @grmelacz, thanks for looking into this. This library doesn't use cURL under the hood, it uses another project I wrote which in turn uses the node.js library axios. I've had a play around and still can't get the call to work. How are you activating window mode from your browser? I can't find the button in the web app to see the API call. Thanks
Hey @mattdavis90, I must have misunderstood the conversation above. Anyway, I'll simply open the window each time I want to test whether it works correctly so I get the appropriate openWindowDetected
attribute present. At the same moment, I'm able to track it in the web app with inspector. Once the window is detected as open in the web app, I run the script to test whether it's able to set the activate
attribute which makes the open window button to hide.
The calls are in main-es2015.<hash>.js
(after formatting line 66612-66617):
activateOpenWindow(e) {
return this.httpClient.post(this.apiMeta.buildHomeUrl(`/zones/${e}/state/openWindow/activate`), null).pipe(this.errorModalService.httpErrorModal())
}
cancelOpenWindow(e) {
return this.httpClient.delete(this.apiMeta.buildHomeUrl(`/zones/${e}/state/openWindow`)).pipe(this.errorModalService.httpErrorModal())
}
The weird thing is I couldn't find any difference among the calls I'm using (I have another script to set the AWAY mode once we leave the house). Only this particular seems to fail for whatever reason.
Hi is there a solution for the window open statement?
Hi @Topper89, Not that I'm aware of. I personally don't use the feature and the code within this library is functionally identical to the code grmelacz posted last year. I've tried a few different calls; switching to PUT, trying to send a body with the POST, a couple URL tweaks. Every change gave back a 403 error whereas the current API gives back a 200, it just doesn't seem to do anything.
My reading of this is that Set Open Window Mode just activates the tado Open window detection on the zone. It does not set the zone to open window. tado still needs detect the open window which relies on it detecting a drop in the temperature.
You need to set a zone overlay to turn off the heating and clear it when the window/door shuts.
If I set The API Call for "Configure window detection for a zone" to "Disable", I manage to disable the window detection for the zone, but if I set to "Enable" , the detection remains to Disable.
If I set The API Call for "Set open window mode to "Activate", the zone heating remains on, but if the zone window mode is manually activate, if i set "Cancel" to the api call it cancel the windows mode and the heating turns on.
Thank you to anyone could help!