Help with Node Red POST request with Venstar API

How may I properly configure the change node to POST to my Venstar thermostat via an http request node?

Here is what the Venstar API calls for:

request.post({
  url:'http://192.168.1.104/control',
  form:{
  mode:3, //setting mode to AUTO
  fan:0, //fan to AUTO
  heattemp: 75,
  cooltemp: 78
}, (e,r, body) => {
  console.log(body);
});

And here is my code working with the RadioThermostat (nodes attached)

{
“mode” : $flowContext(“tmodeUpstairsSet”),
“cooltemp” : $flowContext(“TCoolUpstairs”),
“heattemp” : $flowContext(“THeatUpstairs”)
}

4140ed236f7fbccb818edf7bc358ad01090a4e68

nodes.txt (1.6 KB)

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?

I’ll add a similar post to this one that I made for for a Radio Thermostat once I have this Node Red flow working for the Venstar.

I’ll look into Postman… I don’t know if fan is required… The API notes are nill.

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;

Here’s the API Guide.
vennstar-api.pdf (76.2 KB)

And to keep this an OH topic, here’s the flow for OH integration

Really? thats pretty thin considering we have a Venstar binding. This seems really off topic for this forum.

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.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.