node-red-contrib-tado-client icon indicating copy to clipboard operation
node-red-contrib-tado-client copied to clipboard

AxiosError: Request failed with status code 422

Open MrAlfabet opened this issue 3 years ago • 17 comments

Since a few days I've been getting the following error when trying to set a zone's overlay:

AxiosError: Request failed with status code 422

Has something changed?

MrAlfabet avatar Nov 22 '22 23:11 MrAlfabet

Hi @MrAlfabet, Yes there were some changes made over the weekend to upgrade the underlying library that this node uses. I thought I'd tested all of the integration points but clearly missed something. Do you have an example of the overlay that you're sending? This may help me test.

I'll push a change now to downgrade the library and get things working again - then we can try to the upgrade again once setOverlay is working again. Apologies for the problems

mattdavis90 avatar Nov 23 '22 19:11 mattdavis90

I'm trying to set heating off as the overlay.

On the plus side: the house is nice and warm now. On the down side: gas prices....

On Wed, Nov 23, 2022, 20:50 Matt Davis @.***> wrote:

Hi @MrAlfabet https://github.com/MrAlfabet, Yes there were some changes made over the weekend to upgrade the underlying library that this node uses. I thought I'd tested all of the integration points but clearly missed something. Do you have an example of the overlay that you're sending? This may help me test.

I'll push a change now to downgrade the library and get things working again - then we can try to the upgrade again once setOverlay is working again.

— Reply to this email directly, view it on GitHub https://github.com/mattdavis90/node-red-contrib-tado-client/issues/47#issuecomment-1325581315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYMS7AGROPQ6TXXEQO7BL3WJZYPDANCNFSM6AAAAAASIMABQE . You are receiving this because you were mentioned.Message ID: @.***>

MrAlfabet avatar Nov 24 '22 01:11 MrAlfabet

Hi, I've pushed a version to npm that uses an older version of the library. If you have a flow JSON that is broken and you're happy to send it to me that would help so much - I don't need your login details just how the nodes are configured or what options you're using. This seems to work on my setup so curious what broke.

mattdavis90 avatar Nov 24 '22 08:11 mattdavis90

[
    {
        "id": "512f9271ad769b56",
        "type": "tado",
        "z": "83b78f0b26ffa154",
        "configName": "86bbe474.0008e8",
        "apiCall": "setZoneOverlay",
        "homeId": "111111",
        "deviceId": "",
        "zoneId": "8",
        "power": "on",
        "temperature": "5",
        "terminationType": "manual",
        "terminationTimeout": 900,
        "name": "Kippenhok off",
        "reportDate": "",
        "presence": "HOME",
        "geoTracking": true,
        "temperatureOffset": 0,
        "windowDetection": true,
        "windowDetectionTimeout": 900,
        "openWindowMode": true,
        "timetableId": "",
        "x": 500,
        "y": 140,
        "wires": [
            [
                "0a94cbf31a6d3f49"
            ]
        ]
    },
    {
        "id": "7b740b2b3dbece3e",
        "type": "inject",
        "z": "83b78f0b26ffa154",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 260,
        "y": 140,
        "wires": [
            [
                "512f9271ad769b56"
            ]
        ]
    },
    {
        "id": "0a94cbf31a6d3f49",
        "type": "debug",
        "z": "83b78f0b26ffa154",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 140,
        "wires": []
    },
    {
        "id": "86bbe474.0008e8",
        "type": "tado-config",
        "name": "My Name"
    }
]

MrAlfabet avatar Nov 24 '22 09:11 MrAlfabet

It's still not working on the latest version by the way.

MrAlfabet avatar Nov 24 '22 09:11 MrAlfabet

Hi, I've just been doing some testing with the latest version and it looks as though the lowest temperature that I can set on an overlay is 5℃ - I can't change to 3 like your flow is trying to - this isn't a change that I've made in the library and is likely something that Tado have done on their end.

mattdavis90 avatar Nov 24 '22 18:11 mattdavis90

Is it trying to set to 3? In the gui I have the settings 'set overlay' > heating off.

Would a screen shot help?

On Thu, Nov 24, 2022, 19:43 Matt Davis @.***> wrote:

Hi, I've just been doing some testing with the latest version and it looks as though the lowest temperature that I can set on an overlay is 5℃ - I can't change to 3 like your flow is trying to - this isn't a change that I've made in the library and is likely something that Tado have done on their end.

— Reply to this email directly, view it on GitHub https://github.com/mattdavis90/node-red-contrib-tado-client/issues/47#issuecomment-1326768965, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYMS7FEBHQ4LVNIUY3B7I3WJ6ZONANCNFSM6AAAAAASIMABQE . You are receiving this because you were mentioned.Message ID: @.***>

MrAlfabet avatar Nov 24 '22 19:11 MrAlfabet

You're totally correct, it says 5℃ in your flow... not sure where I saw the 3... but the flow you sent has heating power set to on - I'm not sure why that isn't matching the settings you have in the GUI. If you have a screenshot that would be handy

"zoneId": "8",
"power": "on",
"temperature": "5",
"terminationType": "manual",

mattdavis90 avatar Nov 24 '22 19:11 mattdavis90

My bad, I've been playing around with it trying to see what would work. This is the flow for turning the heating off. Neither this, nor the setting it to 5C works.

[
    {
        "id": "7e9de366ca0659ca",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7c2e29da387fd0f2",
        "type": "tado",
        "z": "7e9de366ca0659ca",
        "configName": "86bbe474.0008e8",
        "apiCall": "setZoneOverlay",
        "homeId": "419521",
        "deviceId": "",
        "zoneId": "8",
        "power": "off",
        "temperature": "5",
        "terminationType": "manual",
        "terminationTimeout": 900,
        "name": "Kippenhok off",
        "reportDate": "",
        "presence": "HOME",
        "geoTracking": true,
        "temperatureOffset": 0,
        "windowDetection": true,
        "windowDetectionTimeout": 900,
        "openWindowMode": true,
        "timetableId": "",
        "x": 520,
        "y": 220,
        "wires": [
            [
                "c99390f767219d44"
            ]
        ]
    },
    {
        "id": "59d681d6cf7c3ce7",
        "type": "inject",
        "z": "7e9de366ca0659ca",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 220,
        "wires": [
            [
                "7c2e29da387fd0f2"
            ]
        ]
    },
    {
        "id": "c99390f767219d44",
        "type": "debug",
        "z": "7e9de366ca0659ca",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 780,
        "y": 220,
        "wires": []
    },
    {
        "id": "86bbe474.0008e8",
        "type": "tado-config",
        "name": "Marijn Blom"
    }
]

MrAlfabet avatar Nov 24 '22 19:11 MrAlfabet

Now that I'm trying a bit more, it seems that I cannot set any overlay. No temperatures work with heating on, heating off doesn't work either. 'ClearZoneOverlay' does seem to work though.

getOverlay returns an empty message. It something more is going on here... I am able to set the water heater temperature, so it's not the connection to the tado service.

MrAlfabet avatar Nov 24 '22 19:11 MrAlfabet

That's interesting. I'm struggling to replicate this. I've updated my install to the latest v0.10.1 version of the plugin and can set overlays with and without heating at home. Just to double check this was working before the weekend and all of a sudden stopped working? Did you upgrade to v0.10.0 of the plugin when it stopped working? I'm just trying to work out what things may have changed. Also, would you mind trying to set and clear overlays on the mobile or web app and just double check there's nothing wrong with Tado. Thanks

mattdavis90 avatar Nov 24 '22 19:11 mattdavis90

I've just noticed that your flow JSON doesn't contain the following

"fanSpeed": "AUTO",
"acMode": "AUTO",

These were added in v0.9.8 of the library which was released in June 2021 - could you check that you're running a recent version? Thanks

mattdavis90 avatar Nov 24 '22 19:11 mattdavis90

I updated yesterday from 10.0 to 10.1 I think. Would I have to recreate the nodes?

On Thu, Nov 24, 2022, 20:29 Matt Davis @.***> wrote:

I've just noticed that your flow JSON doesn't contain the following

"fanSpeed": "AUTO","acMode": "AUTO",

These were added in v0.9.8 of the library which was released in June 2021

  • could you check that you're running a recent version? Thanks

— Reply to this email directly, view it on GitHub https://github.com/mattdavis90/node-red-contrib-tado-client/issues/47#issuecomment-1326792603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYMS7BM4EGRDBT3FSCDG4TWJ66YPANCNFSM6AAAAAASIMABQE . You are receiving this because you were mentioned.Message ID: @.***>

MrAlfabet avatar Nov 24 '22 20:11 MrAlfabet

You shouldn't have to recreate the nodes, it does that when you restart NodeRed after the update. I'll keep playing around on this side and see if there's anything I can do to recreate the 422 error that you're seeing

mattdavis90 avatar Nov 24 '22 23:11 mattdavis90

My sincere apologies, apparently the update yesterday didn't go through. I've just upgraded from 10.0 to 10.1 and everything is working again.

MrAlfabet avatar Nov 24 '22 23:11 MrAlfabet

Great news. Now I just need to work out what went wrong with the updates over the weekend with the underlying library.

mattdavis90 avatar Nov 24 '22 23:11 mattdavis90

Please let me know if I can help test anything. You've been great!

MrAlfabet avatar Nov 24 '22 23:11 MrAlfabet

Any ETA on the fix ? I'm also suffer from the same Issue and cannot "override" any SetZoneOverlay property. Whatever set on the GUI node works once triggered but doesn't matter how/what message I send in payload cannot override the property ( example) power On/Off.

xHUNx avatar Dec 09 '22 20:12 xHUNx

The update that broke setZoneOverlay was reverted two weeks ago. Although the issue isn't really fixed because I'd like to be able to reapply the update it should be in a working state.

The issue you're facing sounds different to the one this issue is tracking. Could you open a new issue with an example flow? and double check that you're running v0.10.1 of the library. Thanks

mattdavis90 avatar Dec 09 '22 20:12 mattdavis90

I am now (or perhaps also before and didn't notice) also getting the same error when trying to turn off the water heater.

[{"id":"9da623335b83404b","type":"tado","z":"397af457.1b217c","configName":"86bbe474.0008e8","apiCall":"setZoneOverlay","homeId":"1111111","deviceId":"","zoneId":"0","power":"off","temperature":"18","terminationType":"manual","terminationTimeout":900,"name":"Warm Water Off","reportDate":"","presence":"HOME","geoTracking":true,"temperatureOffset":0,"windowDetection":true,"windowDetectionTimeout":900,"openWindowMode":true,"timetableId":"","x":360,"y":1420,"wires":[["7299f7bc68dfabae"]]},{"id":"86bbe474.0008e8","type":"tado-config","name":"Marijn Blom"}]

MrAlfabet avatar Dec 20 '22 17:12 MrAlfabet

Also, some more functions wrt the hot water heater don't seem to work, like the temporary temperature overlay

MrAlfabet avatar Dec 20 '22 18:12 MrAlfabet

Hi, that's interesting. Hot water is something I'm unable to test - my boiler doesn't have an input for it - central heating is actually the only Tado product I have (though I'm hopefully getting some TRVs soon). The 422 error on the Tado API seems to cover quite a few circumstances so it may be that the API arguments are slightly different for a hot water zone. In Google Chrome or Mozilla Firefox are you able to go to app.tado.com and open DevTools. When you perform the actions in the web app you should see the API calls in the Network tab - this is what my library replicates. This may shine a light on whether there are any changes to the API needed for hot water. Thanks

mattdavis90 avatar Dec 20 '22 22:12 mattdavis90

The request URL when changing the water temperature is https://my.tado.com/api/v2/homes/111111/zones/0/overlay?ngsw-bypass=true where I replaced my home ID with 11111. Is that what you're looking for?

MrAlfabet avatar Dec 22 '22 22:12 MrAlfabet

Yes, that's great. Do you see the payload? This is the same API call I already implement with a PUT method. It would be good to know if the payload is different for hit water compared to heating. Thanks

mattdavis90 avatar Dec 22 '22 22:12 mattdavis90

{"termination":{"typeSkillBasedApp":"TIMER","durationInSeconds":3600,"remainingTimeInSeconds":3600,"projectedExpiry":"Thu, 22 Dec 2022 23:54:53 GMT"},"setting":{"type":"HOT_WATER","power":"ON","temperature":{"celsius":44,"fahrenheit":111.2}}}

Overlay with timer termination

MrAlfabet avatar Dec 22 '22 22:12 MrAlfabet

{"setting":{"type":"HOT_WATER","power":"ON","temperature":{"celsius":44,"fahrenheit":111.2}},"termination":{"typeSkillBasedApp":"MANUAL"}}

Overlay until manual override

MrAlfabet avatar Dec 22 '22 22:12 MrAlfabet

{"termination":{"typeSkillBasedApp":"MANUAL"},"setting":{"type":"HOT_WATER","power":"OFF"}}

Turn hot water off

MrAlfabet avatar Dec 22 '22 22:12 MrAlfabet

{"setting":{"type":"HOT_WATER","power":"OFF","temperature":null},"termination":{"typeSkillBasedApp":"TIMER","durationInSeconds":3600}}

Hot water off for duration

MrAlfabet avatar Dec 22 '22 22:12 MrAlfabet

Not sure what other use cases I missed, but I gather you can probably distill a pattern from this of what needs to be changed/updated?

MrAlfabet avatar Dec 22 '22 22:12 MrAlfabet

That's really helpful. Thanks. I think the issue is that my library only currently caters for HEATING and AIR_CONDITIONING in the type field. Using your example I should be able to put something together. I'm struggling to commit too much time at the minute due to family commitments (replying is ok but getting the laptop out and writing code seems like a stretch) but I'll see if I can fit it in over the holidays

mattdavis90 avatar Dec 22 '22 23:12 mattdavis90