# Heating flow . contrib heater controller

**URL:** https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781
**Category:** General
**Created:** [28 March 2020 10:52 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781 "2020-03-28T10:52:34Z")
**Posts on this page:** 9
**Page:** 2

<div class="post-metadata">

### Author: ![oddmn](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@oddmn](https://discourse.nodered.org/u/oddmn)
#### Post date: [29 March 2020 12:16 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/21 "2020-03-29T12:16:05Z")

</div>

Simple flow. injekt node .

```auto
[{"id":"69751f01.91307","type":"inject","z":"5922d4fd.cf699c","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"32","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":180,"wires":[["4acab7dd.826e88","aa571a2e.8f0fd8"]]}]

```

3/29/2020, 2:15:39 PM[node: aa571a2e.8f0fd8](http://192.168.1.206:1880/#)msg.payload : boolean

true

---

<div class="post-metadata">

### Author: ![oddmn](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@oddmn](https://discourse.nodered.org/u/oddmn)
#### Post date: [29 March 2020 12:43 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/22 "2020-03-29T12:43:13Z")

</div>

Injektion node true and false.

```auto
[{"id":"4acab7dd.826e88","type":"fibaroActor","z":"5922d4fd.cf699c","name":"Heating Wallplug 1 (Stue)","deviceID":"245","server":"9b6ee9de.5e5998","events":true,"outputs":2,"x":310,"y":220,"wires":[["aa571a2e.8f0fd8"],[]]},{"id":"9b6ee9de.5e5998","type":"fibaro-server","z":"","name":"omnhc2","ipaddress":"192.168.1.11"}]

```

3/29/2020, 2:42:11 PM[node: aa571a2e.8f0fd8](http://192.168.1.206:1880/#)245 : msg.payload : boolean

true

3/29/2020, 2:42:13 PM[node: aa571a2e.8f0fd8](http://192.168.1.206:1880/#)245 : msg.payload : boolean

false

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [29 March 2020 12:48 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/23 "2020-03-29T12:48:16Z")

</div>

You have only exported one node.  
I was expecting a flow with inject nodes that controls the plug on/off

---

<div class="post-metadata">

### Author: ![oddmn](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@oddmn](https://discourse.nodered.org/u/oddmn)
#### Post date: [29 March 2020 13:06 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/24 "2020-03-29T13:06:28Z")

</div>

```auto
[{"id":"5922d4fd.cf699c","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"4acab7dd.826e88","type":"fibaroActor","z":"5922d4fd.cf699c","name":"Heating Wallplug 1 (Stue)","deviceID":"245","server":"9b6ee9de.5e5998","events":true,"outputs":2,"x":310,"y":220,"wires":[["aa571a2e.8f0fd8"],[]]},{"id":"69751f01.91307","type":"inject","z":"5922d4fd.cf699c","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":180,"wires":[["4acab7dd.826e88"]]},{"id":"aa571a2e.8f0fd8","type":"debug","z":"5922d4fd.cf699c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":580,"y":200,"wires":[]},{"id":"e75e0a0.f16c6f8","type":"inject","z":"5922d4fd.cf699c","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":260,"wires":[["4acab7dd.826e88"]]},{"id":"9b6ee9de.5e5998","type":"fibaro-server","z":"","name":"omnhc2","ipaddress":"192.168.1.11"}]

```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [29 March 2020 13:20 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/25 "2020-03-29T13:20:27Z")

</div>

Ok, so on the assumption that does work then you do just need to get true or false into msg.payload.  
So the next question is what property in the message coming from the heater node do you want to convert to true/false?

---

<div class="post-metadata">

### Author: ![oddmn](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@oddmn](https://discourse.nodered.org/u/oddmn)
#### Post date: [29 March 2020 14:01 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/26 "2020-03-29T14:01:01Z")

</div>

If i am thinking and looking right it will be currentHeaterStatus.  
Se that it goes on/off if i change set temp in heater node

3/29/2020, 3:56:14 PM[node: heater](http://192.168.1.206:1880/)msg.payload : Object

_object_

currentTemp: 23.4

targetValue: 19

isUserCustom: false

currentSchedule: _object_

temp: 19

day: "Sunday"

time: "10:00"

nextSchedule: _object_

temp: 19

day: "Sunday"

time: "18:45"

currentHeaterStatus: "off"

3/29/2020, 3:56:52 PM[node: heater](http://192.168.1.206:1880/)msg.payload : Object

_object_

currentTemp: 23.4

targetValue: 30

isUserCustom: false

currentSchedule: _object_

temp: 30

day: "Sunday"

time: "10:00"

nextSchedule: _object_

temp: 19

day: "Sunday"

time: "18:45"

currentHeaterStatus: "on"

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [29 March 2020 14:09 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/28 "2020-03-29T14:09:42Z")

</div>

OK, so you want to test that and set the output accordingly. There are several ways of doing it but in a function node you just need something like

```auto
if (msg.payload.currentHeaterStatus === "0n") {
  msg.payload = true
} else {
  msg.payload = false
}
return msg

```

or you can write that in one line but a bit less clearly using

```auto
msg.payload = (msg.payload.currentHeaterStatus === "on")
return msg

```

or you do it in a Change node using a JSONata expression.

---

<div class="post-metadata">

### Author: ![oddmn](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@oddmn](https://discourse.nodered.org/u/oddmn)
#### Post date: [29 March 2020 16:07 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/29 "2020-03-29T16:07:25Z")

</div>

Thanks alot. I have been struggling with this a long time.  
sonthing is easy in node red and some is very hard to to. spes when it comes to put in string and tings like that in node. starting to get thing on place now so next is to get it look nice in a dashbord. Again tanks or the help.

this was working  
msg.payload = (msg.payload.currentHeaterStatus === "on")  
return msg

---

<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: [12 April 2020 16:07 UTC](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781/30 "2020-04-12T16:07:30Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/heating-flow-contrib-heater-controller/23781.md?page=1)
