I amd trying to control a pump in the central heating system, based on the input of 2 thermostats.
The pump needs to run when the living room temp is lower than the living room set temp.
The living room thermostat is the only thermostat that is able to control the central heating, but when the bedroom thermostat requests heat, I need to do that by controlling the set temp and the pump. I am trying to create a flow, that is able to temporary raise the set temp, but without activating the pump (technically, no hot water flows towards the living room.
I've been playing around with function nodes but my js knowledge did not get me very far so now I am trying to use the nodes to control the pump.
Where I'm stuck is after the change nodes. I get boolean values based on the condition, heating yes or no (simply deducting the room temp from the set temp, if <= then there is no heat required in that room). But then, do I need to join the 2 outputs to feed the logic AND? The logic AND does not really produce an AND, but it looks like the AND results in a pass when true?
Are there better ways to achieve the result in the right debug nodes? If not, how do I configure the join/logic AND nodes... tried all kinds of thing in the rules part of the nodes, but it doesn't seem produce the expected result in the debug nodes.
[{"id":"19b9fb23.993845","type":"tab","label":"Test","disabled":false,"info":""},{"id":"edf57538.f5e0d8","type":"function","z":"19b9fb23.993845","name":"Heating","func":"var BEDROOMHEATT = msg.payload.bedroom.temperature - msg.payload.bedroom.settemp;\nvar LIVINGHEATT = msg.payload.living.temperature - msg.payload.living.settemp;\nvar BEDROOMHEAT = BEDROOMHEATT.toFixed(1);\nvar LIVINGHEAT = LIVINGHEATT.toFixed(1);\nmsg.payload.heating = {\"living\":LIVINGHEAT,\"bedroom\":BEDROOMHEAT};\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":80,"y":240,"wires":[["90ee849f.f8de08","859f4da7.0737"]]},{"id":"90ee849f.f8de08","type":"change","z":"19b9fb23.993845","name":"","rules":[{"t":"delete","p":"payload.bedroom","pt":"msg"},{"t":"delete","p":"payload.living","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":240,"wires":[["d5edd152.164ee","b1cdabe9.ebeb78","c0c8b17a.78a5e"]]},{"id":"d5edd152.164ee","type":"switch","z":"19b9fb23.993845","name":"Living","property":"payload.heating.living","propertyType":"msg","rules":[{"t":"lte","v":"0","vt":"num"},{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":197,"wires":[["c169a17d.bf5df","e2169af9.7ef8e8"],["49260c.cf79f9f4","4b8caf89.efd67"]]},{"id":"b1cdabe9.ebeb78","type":"switch","z":"19b9fb23.993845","name":"Bedroom","property":"payload.heating.bedroom","propertyType":"msg","rules":[{"t":"lte","v":"0","vt":"num"},{"t":"gt","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":277,"wires":[["7fe0db69.4635e4","f3795c35.014aa"],["7a4e1e3d.625f5","60d9ab41.a3e984"]]},{"id":"7a4e1e3d.625f5","type":"change","z":"19b9fb23.993845","name":"Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bedroom","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"bedroom","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":297,"wires":[["b9f2c6bd.a8aa48","4567425c.e3424c","7287225c.c96b5c"]]},{"id":"7fe0db69.4635e4","type":"change","z":"19b9fb23.993845","name":"On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bedroom","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"bedroom","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":257,"wires":[["5d64da42.5629a4","2af0246a.b961cc","a9b75353.08534"]]},{"id":"49260c.cf79f9f4","type":"change","z":"19b9fb23.993845","name":"Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.living","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"living","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":217,"wires":[["a5ef9a7d.6d28d8","a9b75353.08534","4567425c.e3424c"]]},{"id":"c169a17d.bf5df","type":"change","z":"19b9fb23.993845","name":"On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.living","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"living","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":649,"y":177,"wires":[["710b5f7d.94104","2af0246a.b961cc","7287225c.c96b5c"]]},{"id":"66e4df3.15c1c2","type":"and-gate","z":"19b9fb23.993845","name":"L off, Bed on","rules":[{"t":"false","propertyType":"msg","property":"payload.living","topic":"living"},{"t":"true","propertyType":"msg","property":"payload.bedroom","topic":"bedroom"}],"outputTopic":"heating","gateType":"and","emitOnlyIfTrue":false,"x":1050,"y":280,"wires":[["574fd3fc.6a4e1c"]]},{"id":"a03cb70d.c792c8","type":"and-gate","z":"19b9fb23.993845","name":"L on B on","rules":[{"t":"true","propertyType":"msg","property":"payload.living","topic":"living"},{"t":"true","propertyType":"msg","property":"payload.bedroom","topic":"bedroom"}],"outputTopic":"heating","gateType":"and","emitOnlyIfTrue":false,"x":1040,"y":200,"wires":[["5243f61f.eda488"]]},{"id":"a93ff5a.7819408","type":"and-gate","z":"19b9fb23.993845","name":"L on B off","rules":[{"t":"true","propertyType":"msg","property":"payload.living","topic":"living"},{"t":"false","propertyType":"msg","property":"payload.bedroom","topic":"bedroom"}],"outputTopic":"heating","gateType":"and","emitOnlyIfTrue":false,"x":1040,"y":120,"wires":[["4e377e97.287c4"]]},{"id":"574fd3fc.6a4e1c","type":"debug","z":"19b9fb23.993845","name":"L off bed on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":280,"wires":[]},{"id":"5243f61f.eda488","type":"debug","z":"19b9fb23.993845","name":"Both on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":1220,"y":200,"wires":[]},{"id":"4e377e97.287c4","type":"debug","z":"19b9fb23.993845","name":"L on bed off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":120,"wires":[]},{"id":"f0994f81.d0042","type":"inject","z":"19b9fb23.993845","name":"L on B off","props":[{"p":"payload.living.temperature","v":"1","vt":"num"},{"p":"payload.living.settemp","v":"2","vt":"num"},{"p":"payload.bedroom.temperature","v":"2","vt":"num"},{"p":"payload.bedroom.settemp","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":80,"y":100,"wires":[["edf57538.f5e0d8"]]},{"id":"859f4da7.0737","type":"debug","z":"19b9fb23.993845","name":"Test Heating","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":320,"y":360,"wires":[]},{"id":"c0c8b17a.78a5e","type":"debug","z":"19b9fb23.993845","name":"Test change","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":360,"wires":[]},{"id":"e2169af9.7ef8e8","type":"debug","z":"19b9fb23.993845","name":"living on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":80,"wires":[]},{"id":"4b8caf89.efd67","type":"debug","z":"19b9fb23.993845","name":"living off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":120,"wires":[]},{"id":"f3795c35.014aa","type":"debug","z":"19b9fb23.993845","name":"bedroom on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":420,"wires":[]},{"id":"60d9ab41.a3e984","type":"debug","z":"19b9fb23.993845","name":"bedroom off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":460,"wires":[]},{"id":"710b5f7d.94104","type":"debug","z":"19b9fb23.993845","name":"living on boolean","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":20,"wires":[]},{"id":"a5ef9a7d.6d28d8","type":"debug","z":"19b9fb23.993845","name":"living off boolean","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":890,"y":60,"wires":[]},{"id":"5d64da42.5629a4","type":"debug","z":"19b9fb23.993845","name":"bedroom on boolean","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":420,"wires":[]},{"id":"b9f2c6bd.a8aa48","type":"debug","z":"19b9fb23.993845","name":"bedroom off boolean","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":460,"wires":[]},{"id":"c70a875c.ca3f58","type":"debug","z":"19b9fb23.993845","name":"Boolean joined","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1240,"y":40,"wires":[]},{"id":"2af0246a.b961cc","type":"join","z":"19b9fb23.993845","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":870,"y":200,"wires":[["a03cb70d.c792c8"]]},{"id":"a9b75353.08534","type":"join","z":"19b9fb23.993845","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":870,"y":280,"wires":[["66e4df3.15c1c2"]]},{"id":"51344085.c39e3","type":"and-gate","z":"19b9fb23.993845","name":"L off, Bed off","rules":[{"t":"false","propertyType":"msg","property":"payload.living","topic":"living"},{"t":"false","propertyType":"msg","property":"payload.bedroom","topic":"bedroom"}],"outputTopic":"heating","gateType":"and","emitOnlyIfTrue":false,"x":1050,"y":360,"wires":[["2d6cee5.a60a912"]]},{"id":"4567425c.e3424c","type":"join","z":"19b9fb23.993845","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":870,"y":360,"wires":[["51344085.c39e3"]]},{"id":"2d6cee5.a60a912","type":"debug","z":"19b9fb23.993845","name":"Test both off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":360,"wires":[]},{"id":"7287225c.c96b5c","type":"join","z":"19b9fb23.993845","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":870,"y":120,"wires":[["a93ff5a.7819408","c70a875c.ca3f58"]]},{"id":"3d881bc0.a54ee4","type":"inject","z":"19b9fb23.993845","name":"L on B on","props":[{"p":"payload.living.temperature","v":"1","vt":"num"},{"p":"payload.living.settemp","v":"2","vt":"num"},{"p":"payload.bedroom.temperature","v":"1","vt":"num"},{"p":"payload.bedroom.settemp","v":"2","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":80,"y":160,"wires":[["edf57538.f5e0d8"]]},{"id":"fcc3912f.b8e0b","type":"inject","z":"19b9fb23.993845","name":"L off B on","props":[{"p":"payload.living.temperature","v":"2","vt":"num"},{"p":"payload.living.settemp","v":"1","vt":"num"},{"p":"payload.bedroom.temperature","v":"1","vt":"num"},{"p":"payload.bedroom.settemp","v":"2","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":80,"y":300,"wires":[["edf57538.f5e0d8"]]},{"id":"55fda32a.16949c","type":"inject","z":"19b9fb23.993845","name":"L off B off","props":[{"p":"payload.living.temperature","v":"2","vt":"num"},{"p":"payload.living.settemp","v":"1","vt":"num"},{"p":"payload.bedroom.temperature","v":"2","vt":"num"},{"p":"payload.bedroom.settemp","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":80,"y":360,"wires":[["edf57538.f5e0d8"]]}]
Thanks