# Help with POST request with Venstar API

**URL:** <https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347>\
**Category:** General\
**Created:** [27 May 2021 14:34 UTC](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347 "2021-05-27T14:34:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NRdiscrs9393](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nrdiscrs9393/32/726_2.png) [@NRdiscrs9393](https://discourse.nodered.org/u/NRdiscrs9393)\
**Post date:** [27 May 2021 14:34 UTC](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347/1 "2021-05-27T14:34:40Z")

</div>

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](https://developer.venstar.com/) calls for:

```auto
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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/4140ed236f7fbccb818edf7bc358ad01090a4e68.png)

[nodes.txt](https://discourse.nodered.org/uploads/short-url/gXgwjXkDyEJd1jaScYNMMd07wKO.txt) (1.6 KB)

---

<div class="post-metadata">

**Author:** ![NRdiscrs9393](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nrdiscrs9393/32/726_2.png) [@NRdiscrs9393](https://discourse.nodered.org/u/NRdiscrs9393)\
**Post date:** [28 May 2021 18:15 UTC](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347/2 "2021-05-28T18:15:00Z")

</div>

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

```auto
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](https://discourse.nodered.org/uploads/short-url/fM9rkaS81F122kicWprLcNHFacQ.pdf) (76.2 KB)

Here's an integration guide along with the flow.

> [@Get the most of your Venstar Thermostat with this Node Red flow and MQTT](https://discourse.nodered.org/t/get-the-most-of-your-venstar-thermostat-with-this-node-red-flow-and-mqtt/46417):
>
> Here's the Flow [T3700.txt](https://discourse.nodered.org/uploads/short-url/al7n7URpauamGzp2MdO0dzRjOQB.txt) (69.5 KB) Here's what I did. There are multiple ways to achieve this. While in OpenHAB Paper UI, create a new "Generic MQTT Thing" named HVAC. Then create a "Number" Channel with MQTT state topic set to "HVAC/Upstairs/Temp" and MQTT command topic set to "HVAC/Upstairs/SetTemp". Repeat for whatever else you want to add to OH. Notes: I use a flow named "Injection Master" that handles all my communications in and out of Node Red. i.e. MQTT, email, and other APIs. The…

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 July 2021 18:15 UTC](https://discourse.nodered.org/t/help-with-post-request-with-venstar-api/46347/3 "2021-07-27T18:15:10Z")

</div>

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