# Setting HA Generic Thermostat temperature from Node Red Function Node

**URL:** <https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [11 June 2023 11:07 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109 "2023-06-11T11:07:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![d\_tech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d_tech/32/48546_2.png) [@d\_tech](https://discourse.nodered.org/u/d_tech)\
**Post date:** [11 June 2023 11:07 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/1 "2023-06-11T11:07:41Z")

</div>

Hi,  
Im trying to set the temperature of the Home Assistant Generic Thermostat from a node red function node.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c00a63a1f735be56ed85240cef39d31c298e416.png)

The attribute in node red is as follows

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d2e52242ecfa7d8b1a44383336a9b46509a0ddfc.png)

Have tried something like this.  
`global.set("homeassistant.homeAssistant.states['climate.central_heating'].new_state.attributes.temperature", temp);`

Does anyone have any ideas on how to do this

Thanks Danny

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [11 June 2023 11:28 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/2 "2023-06-11T11:28:40Z")

</div>

Just to be sure. Do you run NR in HA?  
And you want to modify the HA temperature entity from an NR flow?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 June 2023 11:28 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/3 "2023-06-11T11:28:54Z")

</div>

Only a few HA users on this forum, you may be better of asking on HA forum

Is this thermostat setpoint entity value part of a service, if so you may get what you need using the [call service](https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/call-service.html) node (i am not a HA user so this is my best guess)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 June 2023 11:46 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/4 "2023-06-11T11:46:13Z")

</div>

Like many/most others here I don't use Home Assistant so this is just a wild guess:

Use a change node to set the value of msg.data.new\_state.temperature.

---

<div class="post-metadata">

**Author:** ![d\_tech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d_tech/32/48546_2.png) [@d\_tech](https://discourse.nodered.org/u/d_tech)\
**Post date:** [11 June 2023 12:26 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/5 "2023-06-11T12:26:04Z")

</div>

Yes running Node red in HA. Yes I have created a scheduler in node red function node and want this to update the time setting in the intity for the generic thermostat in HA which has a thermostat card in the HA dashboard, which will inturn switch the heating on or off based on the current temperature.  
Thanks Danny

---

<div class="post-metadata">

**Author:** ![d\_tech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d_tech/32/48546_2.png) [@d\_tech](https://discourse.nodered.org/u/d_tech)\
**Post date:** [11 June 2023 12:28 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/6 "2023-06-11T12:28:23Z")

</div>

Thanks. I have posted there too, but no responses yet.  
Basically the thermostat is and entity which has a card on the HA Dashnoard.  
Thanks for your response

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [11 June 2023 16:57 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/7 "2023-06-11T16:57:17Z")

</div>

Here's a demo of turning a switch on and off from NR inside HA.  
I don't know if this will help you.

 ![Capture4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2d8b22123a9d0c484d13816846096a8a0b49f4cf.png)

![Capture2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0ef48fdc48d97b75929a7f5885fe827949f8dbd7.png)

![Capture3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/88dd488b841cdedceb74d7696d166e59b39ef6e8.png)

---

<div class="post-metadata">

**Author:** ![d\_tech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d_tech/32/48546_2.png) [@d\_tech](https://discourse.nodered.org/u/d_tech)\
**Post date:** [12 June 2023 03:25 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/8 "2023-06-12T03:25:53Z")

</div>

Thanks Jean,  
Im am trying to set an attribute within the entity. Im not quite sure how the generic thermostat works in HA, but it has several attributes as well as can swtich the output. I am trying to set the attribute (temperarture setting) which will inturn switch the heater on an off, basically simulating switching up the temperature setting dial.

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [12 June 2023 07:09 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/9 "2023-06-12T07:09:02Z")

</div>

I think with this it should be possible

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/6/f655b200a1353c8df27c5c814f3cbfcaf7f99348.png)  
or by setting the mode and target temperature  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/6/e67b3b4e3c3366656b68d0986f11e38306fe3eef.png)

---

<div class="post-metadata">

**Author:** ![d\_tech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d_tech/32/48546_2.png) [@d\_tech](https://discourse.nodered.org/u/d_tech)\
**Post date:** [12 June 2023 07:26 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/10 "2023-06-12T07:26:18Z")

</div>

That works and changes the temperature, however only lets you set a fixed temp when running the service  
Could this be done from node red with a variable from a function node to set the temperature

---

<div class="post-metadata">

**Author:** ![d\_tech](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d_tech/32/48546_2.png) [@d\_tech](https://discourse.nodered.org/u/d_tech)\
**Post date:** [12 June 2023 08:26 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/11 "2023-06-12T08:26:44Z")

</div>

worked it out. Thanks Jean, you got me on the right track.

basically used a call service node with the following  
The temp variable is determined from my function node that sets the temp based on the period of the day (Mon -Fri, Sat, and Sun)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/51023264818af0cb58439c6adc9867c2d7687ae1.png)

---

<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:** [11 August 2023 08:27 UTC](https://discourse.nodered.org/t/setting-ha-generic-thermostat-temperature-from-node-red-function-node/79109/12 "2023-08-11T08:27:12Z")

</div>

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