Help with POST request with Venstar API

Hello,

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")
}

image

nodes.txt (1.6 KB)

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)

Here's an integration guide along with the flow.

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