Heating flow . contrib heater controller

Simple flow. injekt node .

[{"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 PMnode: aa571a2e.8f0fd8msg.payload : boolean

true

Injektion node true and false.

[{"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 PMnode: aa571a2e.8f0fd8245 : msg.payload : boolean

true

3/29/2020, 2:42:13 PMnode: aa571a2e.8f0fd8245 : msg.payload : boolean

false

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

[{"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"}]

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?

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 PMnode: heatermsg.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 PMnode: heatermsg.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"

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

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

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

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

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

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