Closed neonsp closed 1 year ago
That looks like the sort of API call the library is making. Do you know what version of the plugin you're using? Do you have an example flow that you can share? I don't own an AC to test so the code for ACs is purely based on contributions.
Updated with version, 118.5 and capabilities.
Thanks for the quick answer btw
No problem. Do you know which version of this library you're using?
0.10.4
How adept are you with JavaScript? The underlying library should give you a better sense of what's going wrong and give you a point to debug the outgoing messages. I'm wondering if some of the logic that determines whether to use fanSpeed
or fanLevel
is failing. Not having an AC unit has made this quite tricky to debug in the past.
Where is that library so I can check? And how to debug it?
Sorry, I should have included that.
https://github.com/mattdavis90/node-tado-client
Probably in this function https://github.com/mattdavis90/node-tado-client/blob/c944bf9be23ca2f3620c0c4cb19ad79f27ed18f7/src/index.ts#L494
Maybe start with adding a console.log(config);
just before this API call
https://github.com/mattdavis90/node-tado-client/blob/c944bf9be23ca2f3620c0c4cb19ad79f27ed18f7/src/index.ts#L591
Sorry I'm having to ask you fix the problem.
Could you share a simple html file with the client imported and working?
The library runs using Node.js rather than in browser. Something like this should do what you want.
import { Tado } from './build/index.js';
async function run() {
try {
const tado = new Tado('email_address', 'password');
const me = await tado.getMe();
const home_id = me.homes[0].id;
await tado.setZoneOverlays(home_id, [
{
power: 'ON',
temperature: { celsius: 25 },
mode: 'HEAT',
fanLevel: 'LEVEL1',
zone_id: 2
}
]);
} catch (err) {
console.warn(err);
}
}
run()
Do you use telegram?
No, sorry. Did you run an npm i
in the repo to install dependencies?
config.overlays[0].overlay.setting= { type: 'AIR_CONDITIONING', power: 'ON', mode: 'HEAT', temperature: { celsius: 25 }, fanSpeed: 'LEVEL1' }
fanSpeed 😢
Ok, I'll have a dig around and see if I can work out why that's happening
Is it possible that you have to check on the capabilities that there is fanLevel and not fanSpeed?
zone_capabilities.AUTO = { verticalSwing: [ 'ON', 'OFF' ], horizontalSwing: [ 'ON', 'OFF' ], light: [ 'OFF', 'ON' ] }
The auto doesn't contain the fanLevel, but as you can see in the screenshot, in all the other methods, there is the fanLevel
Yeh, the library attempts to check. Good to know that AUTO doesn't contain either type. I should be able to throw together a fix when I'm back on my laptop
This should now be fixed in the underlying library. I have another PR to merge then I'll update this library with the changes
I've just published v0.10.5
I just tested it, now it turns on, but the fan level is always medium.
If I try to setZoneOverlay without turning it off, I see in node red the following error:
"Invalid value for property setting.fanLevel"
On top of that, not there is a red triangle above each tado node, and when I put the mouse over it, "Invalid properties: Invalid number"
Using the website app.tado.com the fanLevel parameter for the request selecting the slow is 'LEVEL1':
{"termination":{"typeSkillBasedApp":"MANUAL"},"setting":{"temperature":{"celsius":23,"fahrenheit":73.4},"fanLevel":"LEVEL1","verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON","mode":"HEAT","type":"AIR_CONDITIONING","power":"ON"}}
I'm not sure what the little triangles are; they're not something my code does. The "Invalid value" error message isn't one of mine either I don't think. I'm wondering if the NodeRed app tries to sanity check something and errors.
I'll do some digging to see what that might be.
LEVEL1 should be an option in the dropdown.
Looks like the values in the dropdown are AUTO, LOW, MIDDLE and HIGH, perhaps that's the issue
Probably. Sounds like I missed that when Tado switched from fanSpeed to fanLevel. I'll be able to get the change out tomorrow.
Perfect, thank you!
I've added the option and released v0.10.6 which hopefully fixes your issue.
Sadly its not working. In node red I get this error:
I'm checking now with the method "setZoneOverlay", and the issue in that method is that "zone_state.setting['fanLevel']" doesn't exists as zone_state.setting = { type: 'AIR_CONDITIONING', power: 'OFF' } with no other information. Forcing it to put fanLevel instead of fanSpeed it works.
About the "setZoneOverlays" I don't know, this is part of the request:
url: 'https://my.tado.com/api/v2/homes/589180/overlay', method: 'post', data: '{"overlays":[{"overlay":{"setting":{"type":"AIR_CONDITIONING","power":"ON","mode":"HEAT","temperature":{"celsius":25},"fanLevel":"LEVEL1"},"termination":{"typeSkillBasedApp":"MANUAL"}},"room":6}]}',
Edit to add: Looks like in node red the method "setZoneOverlay" is the one used, and not "setZoneOverlays", so there are 2 issues
I've just published v0.13.6 of the underlying library whereby setZoneOverlay
should now use the Zone Capabilities call. Are you able to test with that version before I update NodeRed?
Sorry that you're having these issues. I don't use the zone overlay calls or own an AC unit.
You didn't updated the build/index.js, so I replicated your changes and now "setZoneOverlay" works!
Ah. I'm working off my phone so couldn't rebuild. Thanks for testing. I'll rebuild the JS later and also publish a NodeRed build
This should be included in v0.10.7 now
https://flows.nodered.org/node/node-red-contrib-tado-client
I can't update, it shows latest version 0.10.6
I've forced the NodeRed server to check for updates. Hopefully it will pull through soon
Updated. Now it works perfectly! Thank you so much for keeping this updated!
About the "setZoneOverlays", do you know what can be the issue, or can I help you in any way to debug that one? I don't really need it, but I think It would be great to get that one also working.
One last question, any plans on supporting the horizontal and vertical swing control? Should I create a new issue describing options, parameters and request?
No problem.
SetZoneOverlays should work if you call it directly and pass in a list of objects. That call should already support horizontal and vertical swing (and light I think).
Exposing the call in NodeRed was mostly an issue of time. The GUI elements are a pain because you need to build up the list of zones, which depends on each zone's capabilities. I found an example I could use but could never quite get it working. Issues #39 and #44 are sort of tracking this. You're welcome to contribute if you have the time. My availability is limited; I'm on annual leave this week so have a little more time than usual.
Hi @neonsp, Are you happy for me to close this issue?
Hi @mattdavis90 , yes you can close it.
Thank you again
No problem. Glad it's working for you now
Trying to set the fan level doesn't work.
Firmware: v118.5
Via app.tado.com it works. Following json with the developers request: PUT Request to URL: https://my.tado.com/api/v2/homes/</zones/</overlay?ngsw-bypass=true
{"termination":{"typeSkillBasedApp":"MANUAL"},"setting":{"type":"AIR_CONDITIONING","power":"ON","mode":"HEAT","temperature":{"celsius":25,"fahrenheit":77},"fanLevel":"LEVEL1","verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON"}}
zone capabilities:
{"_msgid":"9132a6608f40b3e6","payload":{"type":"AIR_CONDITIONING","FAN":{"fanLevel":["LEVEL2","LEVEL3","AUTO","LEVEL1"],"verticalSwing":["ON","OFF"],"horizontalSwing":["OFF","ON"],"light":["OFF","ON"]},"HEAT":{"temperatures":{"celsius":{"min":16,"max":30,"step":1},"fahrenheit":{"min":61,"max":86,"step":1}},"fanLevel":["LEVEL2","LEVEL3","AUTO","LEVEL1"],"verticalSwing":["ON","OFF"],"horizontalSwing":["OFF","ON"],"light":["OFF","ON"]},"COOL":{"temperatures":{"celsius":{"min":18,"max":30,"step":1},"fahrenheit":{"min":64,"max":86,"step":1}},"fanLevel":["LEVEL2","LEVEL3","AUTO","LEVEL1"],"verticalSwing":["ON","OFF"],"horizontalSwing":["OFF","ON"],"light":["OFF","ON"]},"DRY":{"fanLevel":["LEVEL2","LEVEL3","AUTO","LEVEL1"],"verticalSwing":["ON","OFF"],"horizontalSwing":["OFF","ON"],"light":["OFF","ON"]},"AUTO":{"verticalSwing":["ON","OFF"],"horizontalSwing":["OFF","ON"],"light":["OFF","ON"]},"initialStates":{"mode":"COOL","modes":{"COOL":{"temperature":{"celsius":24,"fahrenheit":75},"fanLevel":"LEVEL2","verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON"},"HEAT":{"temperature":{"celsius":23,"fahrenheit":74},"fanLevel":"LEVEL2","verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON"},"DRY":{"fanLevel":"LEVEL2","verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON"},"FAN":{"fanLevel":"LEVEL2","verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON"},"AUTO":{"verticalSwing":"OFF","horizontalSwing":"OFF","light":"ON"}}}},"topic":"getZoneCapabilities"}