mattdavis90 / node-red-contrib-tado-client

Tado web API client node for Node Red
MIT License
23 stars 16 forks source link

terminationType Auto doesn't work #48

Closed janves closed 2 years ago

janves commented 2 years ago

Hi,

first of all thank you for the great work you did here! I really like the project. Let's talk about my Problem: I am trying to use a window contact sensor to control the tado thermostat. When somebody opens the window it should turn the thermostat off and when it gets closed again the terminationType should be auto. Sadly the part where it sets the thermostat to open again doesn't work for me. I use the following function as input for your node:

if(msg.payload.ContactSensorState){
    msg.topic = "setZoneOverlay"
    msg.apiCall = "setZoneOverlay"
    msg.homeid = "homeid"
    msg.zoneId = "10"
    msg.power = "OFF"
}else{
    msg.topic = "setZoneOverlay"
    msg.apiCall = "setZoneOverlay"
    msg.homeid = "homeid"
    msg.zoneId = "10"
    msg.deviceid = "7"
    msg.terminationType = "auto"
}

return msg;

Instead of turning the device to the schedule, it just sets the target temperature to 18 degrees. Is this a bug or am I doing something wrong? Thanks a lot for your help already!

mattdavis90 commented 2 years ago

Hi,

I'm glad the library is helping you out.

I tested out your code snippet and noticed that your homeid has a lower-case i, this should be homeId although this doesn't appear to actually affect your issue.

Testing out the API calls on the Tado web app it looks as though Tado have switched from using the setOverlay call to using the deleteOverlay call for clearing overlays. If you tweak your code to something like

if(msg.payload.ContactSensorState){
    msg.apiCall = "setZoneOverlay"
    msg.homeId = 12345
    msg.zoneId = 1
    msg.power = "off"
}else{
    msg.apiCall = "clearZoneOverlay"
    msg.homeId = 12345
    msg.zoneId = 1
}

return msg;

Does that work as expected? Thanks

janves commented 2 years ago

It seems to work now, thanks a lot!

Brewj commented 2 years ago

Matt just a massive thank you for your development with this, top work sir thank you!

mattdavis90 commented 2 years ago

You're very welcome