I'm using node red to regulate fan speed I installed under my water heaters. It's running well. Till now I regulate the fan speed in steps e.g. 30/40/50%. I would like to do this with calculation in relation to the input temperature. E.g. 30°C => 40% fan speed and 35°C => 60% fan speed.
My problem is how can I get the calculated result into the function node to sent it to the fan.
- Spoiler: show
Code: Select all
[ { "id": "cf3ed0c4e266eb23", "type": "change", "z": "27bd8ea24b66cf31", "name": "calculate consumption", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload*4-80", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1600, "y": 840, "wires": [ [ "864087b683e6aecc", "f60883853089911c" ] ] }, { "id": "dee39cb0daa74649", "type": "function", "z": "27bd8ea24b66cf31", "name": "SZ_40%", "func": "msg.topic = \"cmnd/tasmota_07235490/DIMMER\";\nmsg.payload = \"40\";\nreturn msg;\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1640, "y": 760, "wires": [ [ "29a2b83b8fe6679b" ] ] }, { "id": "b685926d288f295d", "type": "inject", "z": "27bd8ea24b66cf31", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "SZ_Vorlauf", "payload": "35", "payloadType": "num", "x": 1390, "y": 840, "wires": [ [ "cf3ed0c4e266eb23", "dee39cb0daa74649", "08a697749e95080c" ] ] }, { "id": "08a697749e95080c", "type": "debug", "z": "27bd8ea24b66cf31", "name": "debug 1", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1580, "y": 900, "wires": [] }, { "id": "1ba62f886d0ad6f5", "type": "function", "z": "27bd8ea24b66cf31", "name": "SZ_Variable%", "func": "msg.topic = \"cmnd/tasmota_07235490/DIMMER\";\nmsg.payload = msg.payload.payload;\nreturn msg;\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1940, "y": 840, "wires": [ [ "7ccc2104d4956d9a" ] ] }, { "id": "29a2b83b8fe6679b", "type": "debug", "z": "27bd8ea24b66cf31", "name": "debug 2", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1800, "y": 760, "wires": [] }, { "id": "b66ecb5d3146f17a", "type": "comment", "z": "27bd8ea24b66cf31", "name": "working", "info": "", "x": 1630, "y": 720, "wires": [] }, { "id": "bb672a74f1f6887a", "type": "comment", "z": "27bd8ea24b66cf31", "name": "need help", "info": "", "x": 1920, "y": 800, "wires": [] }, { "id": "f60883853089911c", "type": "debug", "z": "27bd8ea24b66cf31", "name": "debug 3", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1780, "y": 900, "wires": [] }, { "id": "864087b683e6aecc", "type": "json", "z": "27bd8ea24b66cf31", "name": "", "property": "payload", "action": "", "pretty": false, "x": 1790, "y": 840, "wires": [ [ "1ba62f886d0ad6f5" ] ] }, { "id": "7ccc2104d4956d9a", "type": "debug", "z": "27bd8ea24b66cf31", "name": "debug 4", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 2120, "y": 840, "wires": [] } ]