Given this is a question asking how to use NodeRed to interact with another device/service that is not openHAB it’s off topic for this forum. You should ask on a NodeRed forum.
If I were in your position I would start off leveraging Postman and ensure their example works or at least see the outcome. Postman even has an option to output what you are working on to various tools curl, powershell, etc.
I would also not throw vars into my flows until static values returned the desired results. Also their example always has the fan setting too, is it required to be defined when sending a POST?
Postman assisted me when I recently figured out how to control Mopidy over JSON-RPC (which was maddening to obtain the correct syntax on boolean values), but now I can control bedtime brown noise (to replace old dying white noise machines) over snapcast and then stop the Mopidy when its time to get up.
From their example page I would use the single line examples and then have postman change it for you, just loaded it up and can confirm NodeJs - Request is in the drop down. To find this its on the right hand side as an icon </> when you click on the icon, it will expand.
FYI there is a venstar binding for OH which uses the local device api. In this case you could just use openHAB REST api and not have to talk to the thermostat directly.
Solved… After some digging on github along with some other forums, I found an API guide (attached). Mode, fan, heattemp, cooltemp must always be posted together. Additionally pin if passcode is set. Command is submitted via an HTTP POST and is URL encoded instead of JSON.
Here’s the function for Control
var mode=flow.get('TmodeUpstairs');
var fan=flow.get('FmodeUpstairs');
var heat=flow.get('THeatUpstairs');
var cool=flow.get('TCoolUpstairs');
msg.headers={
'Content-Type': 'application/x-www-form-urlencoded'
};
//msg.payload = {};
msg.payload={
'mode':mode,
'fan':fan,
'heattemp':heat,
'cooltemp':cool
};
return msg;
Calls for Venstar Alerts, Runtimes, and Sensors are missing from the OH binding. This flow gives someone the option to pull this information into OH if they wish.