Removal of extensions in strings and converting to number for a two-point control

Removing extensions in strings and converting to number for a twoGood morning for days I've been trying the following: I have a target and actual temperature from OpenHab. I would like to subtract these from each other using a function and if the difference is greater than zero, it must be heated. Can someone help me there or is there another way.

in the meantime I've got the temperatures in the variables. Now I want to calculate the difference. Since the variables are strings with a unit, I try to get rid of the unit and convert the whole thing into numbers. Can someone give me a tip on this?

I am completely clueless.

There are various ways in Node-RED to be able to do this depending on what else you are trying to do.

JavaScript is often quite forgiving of text to number conversions on the fly so using just a change node to replace the unit text with an empty string may be all you need. More can be done with JSONata also in a change node or you could use a function node with plain JavaScript if you need to do more complex processing.

You can use parseFloat(msg.myInputFloatingNumber) or parseInt(msg.myInputInteger) in a function node.
These parse functions will convert them to numbers if they are strings that start with numbers.

eg

Can you give me an example of such a script? I have a flow variable that includes the following value: 23.5 ° C and the ° C has to go. and then it has to be processed further as a number. I would like to have a true or false at the end if the difference between the two temperatures is greater or less than zero for the other variant.

This is an example of doing it without a function node. But often, it is easier to use a function node:

[{"id":"4fb7c47673f019ee","type":"inject","z":"3ffe8f3084d4d0bd","name":"","props":[{"p":"payload"},{"p":"compare","v":"25.0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"23.5 ° C","payloadType":"str","x":310,"y":440,"wires":[["041a671156770a05"]]},{"id":"041a671156770a05","type":"change","z":"3ffe8f3084d4d0bd","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":" ° C","fromt":"str","to":"","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"compare - $number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":440,"wires":[["049e803ae9f7163a"]]},{"id":"049e803ae9f7163a","type":"debug","z":"3ffe8f3084d4d0bd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":440,"wires":[]}]


image

And here is how to remove ° c and convert to number, then return a boolean if the subtraction is greater than 0

[{"id":"f0f4c69.855abb8","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"temp1","v":" 23.5 ° C","vt":"str"},{"p":"temp2","v":" 20 ° C","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":4820,"wires":[["3127aea.44ee2d2"]]},{"id":"3127aea.44ee2d2","type":"change","z":"b779de97.b1b46","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number($trim($split(temp1,\"°\")[0])) - $number($trim($split(temp2, \"°\")[0])) > 0\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":4820,"wires":[["a22d044f.37e61"]]},{"id":"a22d044f.37e61","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":713.0000152587891,"y":4714,"wires":[]}]

The JSONata expression

$number($trim($split(temp1,"°")[0])) - $number($trim($split(temp2, "°")[0])) > 0

This will return true or false
[edit]
and here is the similar using a function node.

msg.payload = parseFloat(msg.temp1) - parseFloat(msg.temp2) > 0
return msg;
1 Like

Could you Explain me, the nummer is 1.5 and not 23.5 why?

Import the flow he posted and doubleclick the inject node and then check the change node.

There is my program an it doesn´t run

[
    {
        "id": "70025a83831da9ae",
        "type": "tab",
        "label": "Flow 7",
        "disabled": false,
        "info": ""
    },
    {
        "id": "c369be09dd2d8550",
        "type": "function",
        "z": "70025a83831da9ae",
        "name": "",
        "func": "global.set(\"Ist_Temp_DZ\",msg.temp1);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 365.75,
        "y": 29.75,
        "wires": [
            [
                "5f70099b9e59e469",
                "66e9b0320162a51a"
            ]
        ]
    },
    {
        "id": "5f70099b9e59e469",
        "type": "debug",
        "z": "70025a83831da9ae",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 695.75,
        "y": 29.75,
        "wires": []
    },
    {
        "id": "80cd2969d0328314",
        "type": "function",
        "z": "70025a83831da9ae",
        "name": "",
        "func": "global.set(\"Soll_Temp_DZ\",msg.temp2);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 355.75,
        "y": 109.75,
        "wires": [
            [
                "5f70099b9e59e469",
                "66e9b0320162a51a"
            ]
        ]
    },
    {
        "id": "66e9b0320162a51a",
        "type": "change",
        "z": "70025a83831da9ae",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "Ist_Temp_DZ",
                "pt": "global",
                "from": " ° C",
                "fromt": "str",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "Soll_Temp_DZ",
                "pt": "global",
                "from": " ° C",
                "fromt": "str",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(Ist_Temp_DZ) - $number(Soll_Temp_DZ)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 735.75,
        "y": 189.75,
        "wires": [
            [
                "f278fe3fde7384b8"
            ]
        ]
    },
    {
        "id": "f278fe3fde7384b8",
        "type": "debug",
        "z": "70025a83831da9ae",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1035.75,
        "y": 189.75,
        "wires": []
    },
    {
        "id": "c9257a1d7a8e73f3",
        "type": "inject",
        "z": "70025a83831da9ae",
        "name": "soll",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "23 °C",
        "payloadType": "str",
        "x": 90,
        "y": 40,
        "wires": [
            [
                "c369be09dd2d8550"
            ]
        ]
    },
    {
        "id": "8026359969dac9d9",
        "type": "inject",
        "z": "70025a83831da9ae",
        "name": "Ist",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "21.5 °C",
        "payloadType": "str",
        "x": 90,
        "y": 100,
        "wires": [
            [
                "80cd2969d0328314"
            ]
        ]
    }
]

here my code and the picture

In the change node, change the jsonata string:

$number($globalContext(Ist_Temp_DZ)) - $number($globalContext(Soll_Temp_DZ))

Messages are not aware of eachother, so if you want to make comparison from 2 different source, you either need to join the messages into 1 message (join node), but as you are using the global variables, you can access them both.

it does´t run

[
    {
        "id": "b2964c3aa7426115",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "110f04cc138a0e07",
        "type": "openhab2-in",
        "z": "b2964c3aa7426115",
        "name": "Ist_Temp",
        "controller": "2341e6d1c1f117f5",
        "itemname": "ThermostatDurchgangszimmer_ActualTemperature",
        "x": 230,
        "y": 160,
        "wires": [
            [
                "54236c96a417792b"
            ],
            []
        ]
    },
    {
        "id": "b1147b809f6e4e95",
        "type": "openhab2-in",
        "z": "b2964c3aa7426115",
        "name": "Soll_Temp",
        "controller": "2341e6d1c1f117f5",
        "itemname": "ThermostatDurchgangszimmer_SetTemperature",
        "x": 240,
        "y": 240,
        "wires": [
            [
                "afcc40e1aa707e49"
            ],
            []
        ]
    },
    {
        "id": "54236c96a417792b",
        "type": "function",
        "z": "b2964c3aa7426115",
        "name": "",
        "func": "global.set(\"Ist_Temp_DZ\",msg.temp1);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 160,
        "wires": [
            [
                "52824f7e12ac7a94",
                "29bce0cc076928f8"
            ]
        ]
    },
    {
        "id": "52824f7e12ac7a94",
        "type": "debug",
        "z": "b2964c3aa7426115",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 160,
        "wires": []
    },
    {
        "id": "afcc40e1aa707e49",
        "type": "function",
        "z": "b2964c3aa7426115",
        "name": "",
        "func": "global.set(\"Soll_Temp_DZ\",msg.temp2);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 240,
        "wires": [
            [
                "52824f7e12ac7a94",
                "29bce0cc076928f8"
            ]
        ]
    },
    {
        "id": "29bce0cc076928f8",
        "type": "change",
        "z": "b2964c3aa7426115",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "Ist_Temp_DZ",
                "pt": "global",
                "from": " °C",
                "fromt": "str",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "Soll_Temp_DZ",
                "pt": "global",
                "from": " °C",
                "fromt": "str",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number($globalContext(Ist_Temp_DZ)) - $number($globalContext(Soll_Temp_DZ))",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 850,
        "y": 320,
        "wires": [
            [
                "40d8a5b513354c8d"
            ]
        ]
    },
    {
        "id": "40d8a5b513354c8d",
        "type": "debug",
        "z": "b2964c3aa7426115",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1170,
        "y": 320,
        "wires": []
    },
    {
        "id": "2341e6d1c1f117f5",
        "type": "openhab2-controller",
        "name": "Ziegler",
        "protocol": "http",
        "host": "192.168.178.40",
        "port": "8080",
        "path": "",
        "username": "oh.NODERED.uPzMpvN5MI0C7cRpW9uNkqwWxx3XetWukNOAwEuYuvyd0CyiEj3oraUSQpqun8C0Bn2zUgXtZQs7AQ5ntky5pQ",
        "password": ""
    }
][
    {
        "id": "b2964c3aa7426115",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "110f04cc138a0e07",
        "type": "openhab2-in",
        "z": "b2964c3aa7426115",
        "name": "Ist_Temp",
        "controller": "2341e6d1c1f117f5",
        "itemname": "ThermostatDurchgangszimmer_ActualTemperature",
        "x": 230,
        "y": 160,
        "wires": [
            [
                "54236c96a417792b"
            ],
            []
        ]
    },
    {
        "id": "b1147b809f6e4e95",
        "type": "openhab2-in",
        "z": "b2964c3aa7426115",
        "name": "Soll_Temp",
        "controller": "2341e6d1c1f117f5",
        "itemname": "ThermostatDurchgangszimmer_SetTemperature",
        "x": 240,
        "y": 240,
        "wires": [
            [
                "afcc40e1aa707e49"
            ],
            []
        ]
    },
    {
        "id": "54236c96a417792b",
        "type": "function",
        "z": "b2964c3aa7426115",
        "name": "",
        "func": "global.set(\"Ist_Temp_DZ\",msg.temp1);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 160,
        "wires": [
            [
                "52824f7e12ac7a94",
                "29bce0cc076928f8"
            ]
        ]
    },
    {
        "id": "52824f7e12ac7a94",
        "type": "debug",
        "z": "b2964c3aa7426115",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 160,
        "wires": []
    },
    {
        "id": "afcc40e1aa707e49",
        "type": "function",
        "z": "b2964c3aa7426115",
        "name": "",
        "func": "global.set(\"Soll_Temp_DZ\",msg.temp2);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 240,
        "wires": [
            [
                "52824f7e12ac7a94",
                "29bce0cc076928f8"
            ]
        ]
    },
    {
        "id": "29bce0cc076928f8",
        "type": "change",
        "z": "b2964c3aa7426115",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "Ist_Temp_DZ",
                "pt": "global",
                "from": " °C",
                "fromt": "str",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "Soll_Temp_DZ",
                "pt": "global",
                "from": " °C",
                "fromt": "str",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number($globalContext(Ist_Temp_DZ)) - $number($globalContext(Soll_Temp_DZ))",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 850,
        "y": 320,
        "wires": [
            [
                "40d8a5b513354c8d"
            ]
        ]
    },
    {
        "id": "40d8a5b513354c8d",
        "type": "debug",
        "z": "b2964c3aa7426115",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1170,
        "y": 320,
        "wires": []
    },
    {
        "id": "2341e6d1c1f117f5",
        "type": "openhab2-controller",
        "name": "Ziegler",
        "protocol": "http",
        "host": "192.168.178.40",
        "port": "8080",
        "path": "",
        "username": "oh.NODERED.uPzMpvN5MI0C7cRpW9uNkqwWxx3XetWukNOAwEuYuvyd0CyiEj3oraUSQpqun8C0Bn2zUgXtZQs7AQ5ntky5pQ",
        "password": ""
    }
]

grafik

Hello I test your JSONata like this, where id did the error

$number($trim($split($globalContext(Ist_Temp_DZ),"°C")[0])) - $number($trim($split($globalContext(Soll_Temp_DZ), "°C")[0])) > 0	
$number($trim($split($globalContext("Ist_Temp_DZ"),"°C")[0])) - $number($trim($split($globalContext("Soll_Temp_DZ"), "°C")[0])) > 0

Ist_Temp_DZ and Soll_Temp_DZ are string references to global properties so need to be in quotes.
If still not working please supply what the global context values are.

it ist sitll not workinjg....

[
    {
        "id": "b2964c3aa7426115",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "110f04cc138a0e07",
        "type": "openhab2-in",
        "z": "b2964c3aa7426115",
        "name": "Ist_Temp",
        "controller": "2341e6d1c1f117f5",
        "itemname": "ThermostatDurchgangszimmer_ActualTemperature",
        "x": 230,
        "y": 160,
        "wires": [
            [
                "54236c96a417792b"
            ],
            []
        ]
    },
    {
        "id": "b1147b809f6e4e95",
        "type": "openhab2-in",
        "z": "b2964c3aa7426115",
        "name": "Soll_Temp",
        "controller": "2341e6d1c1f117f5",
        "itemname": "ThermostatDurchgangszimmer_SetTemperature",
        "x": 240,
        "y": 240,
        "wires": [
            [
                "afcc40e1aa707e49"
            ],
            []
        ]
    },
    {
        "id": "54236c96a417792b",
        "type": "function",
        "z": "b2964c3aa7426115",
        "name": "",
        "func": "global.set(\"Ist_Temp_DZ\",msg.temp1);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 160,
        "wires": [
            [
                "52824f7e12ac7a94",
                "ff4f2b84c8d03171"
            ]
        ]
    },
    {
        "id": "52824f7e12ac7a94",
        "type": "debug",
        "z": "b2964c3aa7426115",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 160,
        "wires": []
    },
    {
        "id": "afcc40e1aa707e49",
        "type": "function",
        "z": "b2964c3aa7426115",
        "name": "",
        "func": "global.set(\"Soll_Temp_DZ\",msg.temp2);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 240,
        "wires": [
            [
                "52824f7e12ac7a94",
                "ff4f2b84c8d03171"
            ]
        ]
    },
    {
        "id": "40d8a5b513354c8d",
        "type": "debug",
        "z": "b2964c3aa7426115",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 320,
        "wires": []
    },
    {
        "id": "ff4f2b84c8d03171",
        "type": "change",
        "z": "b2964c3aa7426115",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number($trim($split($globalContext(\"Ist_Temp_DZ\"),\"°C\")[0])) - $number($trim($split($globalContext(\"Soll_Temp_DZ\"), \"°C\")[0])) > 0",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 280,
        "wires": [
            [
                "40d8a5b513354c8d"
            ]
        ]
    },
    {
        "id": "2341e6d1c1f117f5",
        "type": "openhab2-controller",
        "name": "Ziegler",
        "protocol": "http",
        "host": "192.168.178.40",
        "port": "8080",
        "path": "",
        "username": "oh.NODERED.uPzMpvN5MI0C7cRpW9uNkqwWxx3XetWukNOAwEuYuvyd0CyiEj3oraUSQpqun8C0Bn2zUgXtZQs7AQ5ntky5pQ",
        "password": ""
    }
]

your functions are referencing msg.temp1 etc, they needed to reference the incoming payload from the openhab2 in nodes.

But why not just join the messages as below, replace injects with openhub2 nodes

[{"id":"f62322f0.ae0c38","type":"inject","z":"b2964c3aa7426115","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"23 °C","payloadType":"str","x":240,"y":160,"wires":[["742592b4.5eed0c"]]},{"id":"742592b4.5eed0c","type":"change","z":"b2964c3aa7426115","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"temp1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":220,"wires":[["fa678a58.c21848"]]},{"id":"fa678a58.c21848","type":"join","z":"b2964c3aa7426115","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":590,"y":280,"wires":[["ff4f2b84c8d03171"]]},{"id":"ff4f2b84c8d03171","type":"change","z":"b2964c3aa7426115","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number($trim($split(payload.temp1,\"°C\")[0])) - $number($trim($split(payload.temp2, \"°C\")[0])) > 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":280,"wires":[["40d8a5b513354c8d"]]},{"id":"34d9f5fe.34070a","type":"change","z":"b2964c3aa7426115","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"temp2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":280,"wires":[["fa678a58.c21848"]]},{"id":"40d8a5b513354c8d","type":"debug","z":"b2964c3aa7426115","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":970,"y":280,"wires":[]},{"id":"1564eaff.715645","type":"inject","z":"b2964c3aa7426115","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20 °C","payloadType":"str","x":240,"y":240,"wires":[["34d9f5fe.34070a"]]}]

This works for me

[{"id":"4fb7c47673f019ee","type":"inject","z":"78cae700c1494223","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"23.5 °C","payloadType":"str","x":338,"y":192,"wires":[["e5731e202e66348f"]]},{"id":"049e803ae9f7163a","type":"debug","z":"78cae700c1494223","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":818,"y":216,"wires":[]},{"id":"2b5b0812d9e2e5a0","type":"inject","z":"78cae700c1494223","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"17 °C","payloadType":"str","x":338,"y":240,"wires":[["94561f5f71af8472"]]},{"id":"e5731e202e66348f","type":"change","z":"78cae700c1494223","name":"","rules":[{"t":"set","p":"ist","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":502,"y":192,"wires":[["b29731fcf4807d34"]]},{"id":"94561f5f71af8472","type":"change","z":"78cae700c1494223","name":"","rules":[{"t":"set","p":"soll","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":502,"y":240,"wires":[["b29731fcf4807d34"]]},{"id":"b29731fcf4807d34","type":"function","z":"78cae700c1494223","name":"","func":"soll = parseFloat(flow.get(\"soll\")) || 0\nist = parseFloat(flow.get(\"ist\")) || 0\n\nmsg.payload = ist - soll\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":684,"y":216,"wires":[["049e803ae9f7163a"]]}]

Initial run will not work as it requires both values to be set at least once.

Thank you it works.....

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