Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. 2 Werte Subtrtahieren in Node Red

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    2 Werte Subtrtahieren in Node Red

    This topic has been deleted. Only users with topic management privileges can see it.
    • mickym
      mickym Most Active @siporax last edited by

      @siporax Die einfache Lösung nur mit der Trigger des Sonoff - war hier (sind nur 4 Nodes): https://forum.iobroker.net/post/1019849

      S 1 Reply Last reply Reply Quote 0
      • S
        siporax @mickym last edited by

        @mickym said in 2 Werte Subtrtahieren in Node Red:

        @siporax Die einfache Lösung nur mit der Trigger des Sonoff - war hier (sind nur 4 Nodes): https://forum.iobroker.net/post/1019849

        So habs soweit übernommen u d angepasst läuft aber nicht bzw schreib keine Daten in den Broker da steht immer Null

        [
            {
                "id": "78f6b708eb6bd2fe",
                "type": "tab",
                "label": "Realer Teichverbrauch",
                "disabled": false,
                "info": "",
                "env": []
            },
            {
                "id": "4e110ac9e3526a1d",
                "type": "ioBroker in",
                "z": "78f6b708eb6bd2fe",
                "name": "Teich-Pow",
                "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                "payloadType": "value",
                "onlyack": "",
                "func": "all",
                "gap": "",
                "fireOnStart": "false",
                "outFormat": "MQTT",
                "x": 120,
                "y": 100,
                "wires": [
                    [
                        "e6795d8dc9d84fcc"
                    ]
                ]
            },
            {
                "id": "be61f3942177482d",
                "type": "ioBroker get",
                "z": "78f6b708eb6bd2fe",
                "name": "WR-Fritz",
                "topic": "fritzdect.0.DECT_116570079058.power",
                "attrname": "wr",
                "payloadType": "value",
                "errOnInvalidState": "nothing",
                "x": 520,
                "y": 100,
                "wires": [
                    [
                        "719b166cf1c4cf56"
                    ]
                ]
            },
            {
                "id": "719b166cf1c4cf56",
                "type": "change",
                "z": "78f6b708eb6bd2fe",
                "name": "TeichPow - WR",
                "rules": [
                    {
                        "t": "set",
                        "p": "payload",
                        "pt": "msg",
                        "to": "verbrauch - wr",
                        "tot": "jsonata"
                    }
                ],
                "action": "",
                "property": "",
                "from": "",
                "to": "",
                "reg": false,
                "x": 700,
                "y": 140,
                "wires": [
                    [
                        "2528507974039f88",
                        "ec4528823eccb390"
                    ]
                ]
            },
            {
                "id": "2528507974039f88",
                "type": "ioBroker out",
                "z": "78f6b708eb6bd2fe",
                "d": true,
                "name": "Realer_Teichverbrauch",
                "topic": "0_userdata.0.Node_Red_Realer_Teichverbrauch",
                "ack": "true",
                "autoCreate": "false",
                "stateName": "",
                "role": "",
                "payloadType": "",
                "readonly": "",
                "stateUnit": "",
                "stateMin": "",
                "stateMax": "",
                "x": 950,
                "y": 180,
                "wires": []
            },
            {
                "id": "ec4528823eccb390",
                "type": "debug",
                "z": "78f6b708eb6bd2fe",
                "name": "Ergebnis nur payload",
                "active": true,
                "tosidebar": true,
                "console": false,
                "tostatus": false,
                "complete": "payload",
                "targetType": "msg",
                "statusVal": "",
                "statusType": "auto",
                "x": 940,
                "y": 140,
                "wires": []
            },
            {
                "id": "e6795d8dc9d84fcc",
                "type": "change",
                "z": "78f6b708eb6bd2fe",
                "name": "",
                "rules": [
                    {
                        "t": "move",
                        "p": "payload",
                        "pt": "msg",
                        "to": "verbrauch",
                        "tot": "msg"
                    }
                ],
                "action": "",
                "property": "",
                "from": "",
                "to": "",
                "reg": false,
                "x": 320,
                "y": 100,
                "wires": [
                    [
                        "be61f3942177482d"
                    ]
                ]
            },
            {
                "id": "5413c6e8e87d1659",
                "type": "ioBroker in",
                "z": "78f6b708eb6bd2fe",
                "name": "WR-Fritz",
                "topic": "fritzdect.0.DECT_116570079058.power",
                "payloadType": "value",
                "onlyack": "",
                "func": "all",
                "gap": "",
                "fireOnStart": "false",
                "outFormat": "MQTT",
                "x": 120,
                "y": 180,
                "wires": [
                    [
                        "e857e6e86301279a"
                    ]
                ]
            },
            {
                "id": "8e2c30a2834a5bc7",
                "type": "ioBroker get",
                "z": "78f6b708eb6bd2fe",
                "name": "Teich-Pow",
                "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                "attrname": "verbrauch",
                "payloadType": "value",
                "errOnInvalidState": "nothing",
                "x": 530,
                "y": 180,
                "wires": [
                    [
                        "719b166cf1c4cf56"
                    ]
                ]
            },
            {
                "id": "e857e6e86301279a",
                "type": "change",
                "z": "78f6b708eb6bd2fe",
                "name": "",
                "rules": [
                    {
                        "t": "move",
                        "p": "payload",
                        "pt": "msg",
                        "to": "wr",
                        "tot": "msg"
                    }
                ],
                "action": "",
                "property": "",
                "from": "",
                "to": "",
                "reg": false,
                "x": 320,
                "y": 180,
                "wires": [
                    [
                        "8e2c30a2834a5bc7"
                    ]
                ]
            }
        ]
        
        S 1 Reply Last reply Reply Quote 0
        • S
          siporax @siporax last edited by

          @siporax said in 2 Werte Subtrtahieren in Node Red:

          @mickym said in 2 Werte Subtrtahieren in Node Red:

          @siporax Die einfache Lösung nur mit der Trigger des Sonoff - war hier (sind nur 4 Nodes): https://forum.iobroker.net/post/1019849

          So habs soweit übernommen u d angepasst läuft aber nicht bzw schreib keine Daten in den Broker da steht immer Null

          [
              {
                  "id": "78f6b708eb6bd2fe",
                  "type": "tab",
                  "label": "Realer Teichverbrauch",
                  "disabled": false,
                  "info": "",
                  "env": []
              },
              {
                  "id": "4e110ac9e3526a1d",
                  "type": "ioBroker in",
                  "z": "78f6b708eb6bd2fe",
                  "name": "Teich-Pow",
                  "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                  "payloadType": "value",
                  "onlyack": "",
                  "func": "all",
                  "gap": "",
                  "fireOnStart": "false",
                  "outFormat": "MQTT",
                  "x": 120,
                  "y": 100,
                  "wires": [
                      [
                          "e6795d8dc9d84fcc"
                      ]
                  ]
              },
              {
                  "id": "be61f3942177482d",
                  "type": "ioBroker get",
                  "z": "78f6b708eb6bd2fe",
                  "name": "WR-Fritz",
                  "topic": "fritzdect.0.DECT_116570079058.power",
                  "attrname": "wr",
                  "payloadType": "value",
                  "errOnInvalidState": "nothing",
                  "x": 520,
                  "y": 100,
                  "wires": [
                      [
                          "719b166cf1c4cf56"
                      ]
                  ]
              },
              {
                  "id": "719b166cf1c4cf56",
                  "type": "change",
                  "z": "78f6b708eb6bd2fe",
                  "name": "TeichPow - WR",
                  "rules": [
                      {
                          "t": "set",
                          "p": "payload",
                          "pt": "msg",
                          "to": "verbrauch - wr",
                          "tot": "jsonata"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 700,
                  "y": 140,
                  "wires": [
                      [
                          "2528507974039f88",
                          "ec4528823eccb390"
                      ]
                  ]
              },
              {
                  "id": "2528507974039f88",
                  "type": "ioBroker out",
                  "z": "78f6b708eb6bd2fe",
                  "d": true,
                  "name": "Realer_Teichverbrauch",
                  "topic": "0_userdata.0.Node_Red_Realer_Teichverbrauch",
                  "ack": "true",
                  "autoCreate": "false",
                  "stateName": "",
                  "role": "",
                  "payloadType": "",
                  "readonly": "",
                  "stateUnit": "",
                  "stateMin": "",
                  "stateMax": "",
                  "x": 950,
                  "y": 180,
                  "wires": []
              },
              {
                  "id": "ec4528823eccb390",
                  "type": "debug",
                  "z": "78f6b708eb6bd2fe",
                  "name": "Ergebnis nur payload",
                  "active": true,
                  "tosidebar": true,
                  "console": false,
                  "tostatus": false,
                  "complete": "payload",
                  "targetType": "msg",
                  "statusVal": "",
                  "statusType": "auto",
                  "x": 940,
                  "y": 140,
                  "wires": []
              },
              {
                  "id": "e6795d8dc9d84fcc",
                  "type": "change",
                  "z": "78f6b708eb6bd2fe",
                  "name": "",
                  "rules": [
                      {
                          "t": "move",
                          "p": "payload",
                          "pt": "msg",
                          "to": "verbrauch",
                          "tot": "msg"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 320,
                  "y": 100,
                  "wires": [
                      [
                          "be61f3942177482d"
                      ]
                  ]
              },
              {
                  "id": "5413c6e8e87d1659",
                  "type": "ioBroker in",
                  "z": "78f6b708eb6bd2fe",
                  "name": "WR-Fritz",
                  "topic": "fritzdect.0.DECT_116570079058.power",
                  "payloadType": "value",
                  "onlyack": "",
                  "func": "all",
                  "gap": "",
                  "fireOnStart": "false",
                  "outFormat": "MQTT",
                  "x": 120,
                  "y": 180,
                  "wires": [
                      [
                          "e857e6e86301279a"
                      ]
                  ]
              },
              {
                  "id": "8e2c30a2834a5bc7",
                  "type": "ioBroker get",
                  "z": "78f6b708eb6bd2fe",
                  "name": "Teich-Pow",
                  "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                  "attrname": "verbrauch",
                  "payloadType": "value",
                  "errOnInvalidState": "nothing",
                  "x": 530,
                  "y": 180,
                  "wires": [
                      [
                          "719b166cf1c4cf56"
                      ]
                  ]
              },
              {
                  "id": "e857e6e86301279a",
                  "type": "change",
                  "z": "78f6b708eb6bd2fe",
                  "name": "",
                  "rules": [
                      {
                          "t": "move",
                          "p": "payload",
                          "pt": "msg",
                          "to": "wr",
                          "tot": "msg"
                      }
                  ],
                  "action": "",
                  "property": "",
                  "from": "",
                  "to": "",
                  "reg": false,
                  "x": 320,
                  "y": 180,
                  "wires": [
                      [
                          "8e2c30a2834a5bc7"
                      ]
                  ]
              }
          ]
          

          5.JPG

          mickym 1 Reply Last reply Reply Quote 0
          • mickym
            mickym Most Active @siporax last edited by mickym

            @siporax Ja dann mach mal ein Screenshot und zeig den Status bzw. mach Debug Nodes dran. Wenn 100-100 = 0 rauskommt, dann ist das ja richtig.

            Und es stimmt ja nicht, dass er nichts schreibt:

            d561deeb-4f1c-4b7e-a45c-45e666e830ea-image.png

            Der Datenpunkt wurde um 14:34 heute beschrieben.

            S geschild 2 Replies Last reply Reply Quote 0
            • S
              siporax @mickym last edited by

              @mickym said in 2 Werte Subtrtahieren in Node Red:

              @siporax Ja dann mach mal ein Screenshot und zeig den Status bzw. mach Debug Nodes dran. Wenn 100-100 = 0 rauskommt, dann ist das ja richtig.

              Und es stimmt ja nicht, dass er nichts schreibt:

              d561deeb-4f1c-4b7e-a45c-45e666e830ea-image.png

              Der Datenpunkt wurde um 14:34 heute beschrieben.

              6 Forum.JPG

              mickym 1 Reply Last reply Reply Quote 0
              • mickym
                mickym Most Active @siporax last edited by mickym

                @siporax Na dann kommt doch das Ergebnis raus. Du musst doch nur die iobroker-Out Node wieder aktivieren.

                fbeee56b-dea3-43d8-b28b-14044dacb649-image.png

                Die Debug Node kannst wieder wegschmeissen - das ist doch nur zur Fehlersuche bzw. zur Demonstration. Und wie gesagt - ich sehe die Sonoff Node trigger meistens - dann könntest auch die einfache Lösung mit den 4 Nodes nehmen:

                414c6163-0c59-4f6b-85e8-1b570e3ff8f4-image.png

                [
                  {
                      "id": "1abbb3ad15f02df1",
                      "type": "ioBroker in",
                      "z": "289f539dcc33814e",
                      "name": "Teich-Pow",
                      "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                      "payloadType": "value",
                      "onlyack": "",
                      "func": "all",
                      "gap": "",
                      "fireOnStart": "false",
                      "outFormat": "MQTT",
                      "x": 2440,
                      "y": 4320,
                      "wires": [
                          [
                              "db726a38cace8780"
                          ]
                      ]
                  },
                  {
                      "id": "db726a38cace8780",
                      "type": "ioBroker get",
                      "z": "289f539dcc33814e",
                      "name": "WR-Fritz",
                      "topic": "fritzdect.0.DECT_116570079058.power",
                      "attrname": "wr",
                      "payloadType": "value",
                      "errOnInvalidState": "nothing",
                      "x": 2600,
                      "y": 4320,
                      "wires": [
                          [
                              "5a663fa76121848c"
                          ]
                      ]
                  },
                  {
                      "id": "5a663fa76121848c",
                      "type": "change",
                      "z": "289f539dcc33814e",
                      "name": "TeichPow - WR",
                      "rules": [
                          {
                              "t": "set",
                              "p": "payload",
                              "pt": "msg",
                              "to": "payload - wr",
                              "tot": "jsonata"
                          }
                      ],
                      "action": "",
                      "property": "",
                      "from": "",
                      "to": "",
                      "reg": false,
                      "x": 2780,
                      "y": 4320,
                      "wires": [
                          [
                              "086dd9b2dd01f025"
                          ]
                      ]
                  },
                  {
                      "id": "086dd9b2dd01f025",
                      "type": "ioBroker out",
                      "z": "289f539dcc33814e",
                      "name": "Realer_Teichverbrauch",
                      "topic": "0_userdata.0.Node_Red_Realer_Teichverbrauch",
                      "ack": "true",
                      "autoCreate": "false",
                      "stateName": "",
                      "role": "",
                      "payloadType": "",
                      "readonly": "",
                      "stateUnit": "",
                      "stateMin": "",
                      "stateMax": "",
                      "x": 3010,
                      "y": 4320,
                      "wires": []
                  }
                ]
                
                

                1 Reply Last reply Reply Quote 0
                • geschild
                  geschild @mickym last edited by

                  @mickym
                  teichminus.txt TeichMInusNeu.jpg

                  Sorry: </> Code einfügen hab ich kapiert, aber wie daraus einen Spoiler macht ???

                  Egal. Code in .txt. Habe mal die topics in flow Variable gepackt. Jetzt braucht man die iobrokerIn/Out nur noch wie gewohnt mit den DP verbinden.

                  Könnte man das so machen. (Ich lerne gern dazu)

                  mickym 2 Replies Last reply Reply Quote 0
                  • mickym
                    mickym Most Active @geschild last edited by

                    @geschild Den Spoiler machst Du mit dem Auge. 😉

                    9dc4653a-17b9-418d-8d94-46944466d2e4-image.png

                    code_text
                    

                    Dann innerhalb des Spoilers die Code Tags:
                    a24319eb-ec3d-41c5-a1c6-34f3874b11f8-image.png

                    a681a1eb-cefa-4a6d-901c-72bf409506c0-image.png

                    1 Reply Last reply Reply Quote 0
                    • mickym
                      mickym Most Active @geschild last edited by mickym

                      @geschild So nun zu Deinem Flow. 😉

                      Das wird zwar so funktionieren - aber in dem Fall finde ich es übertrieben Flow variablen zu setzen, nur um das topic zu vereinfachen. Insbesondere ändert sich der Wert dieser Flowvariablen ja nie. Das würde nur Sinn machen, wenn Du unabhängig die Initialisierung triggern würdest. Dann lieber wieder das topic direkt setzen:

                      57f3191c-4a7d-4f9a-ba2c-f5edc05d9ab8-image.png

                      [
                         {
                             "id": "c32a0a1f4a2b9221",
                             "type": "ioBroker in",
                             "z": "78f6b708eb6bd2fe",
                             "name": "Teich-Pow",
                             "topic": "0_userdata.0.TeichMinus.Teich-Pow",
                             "payloadType": "value",
                             "onlyack": "",
                             "func": "all",
                             "gap": "",
                             "fireOnStart": "false",
                             "outFormat": "ioBroker",
                             "x": 180,
                             "y": 560,
                             "wires": [
                                 [
                                     "f85da542bcf883c8"
                                 ]
                             ]
                         },
                         {
                             "id": "eceba02fa565ce76",
                             "type": "ioBroker in",
                             "z": "78f6b708eb6bd2fe",
                             "name": "WR-Fritz",
                             "topic": "0_userdata.0.TeichMinus.WR-Fritz",
                             "payloadType": "value",
                             "onlyack": "",
                             "func": "all",
                             "gap": "",
                             "fireOnStart": "false",
                             "outFormat": "ioBroker",
                             "x": 180,
                             "y": 640,
                             "wires": [
                                 [
                                     "363c25994833957b"
                                 ]
                             ]
                         },
                         {
                             "id": "11f59eb25158b200",
                             "type": "ioBroker out",
                             "z": "78f6b708eb6bd2fe",
                             "name": "Ergebnis",
                             "topic": "0_userdata.0.TeichMinus.Ergebnis",
                             "ack": "false",
                             "autoCreate": "false",
                             "stateName": "",
                             "role": "",
                             "payloadType": "",
                             "readonly": "",
                             "stateUnit": "",
                             "stateMin": "",
                             "stateMax": "",
                             "x": 840,
                             "y": 600,
                             "wires": []
                         },
                         {
                             "id": "9a2bda7d9bbb1ca2",
                             "type": "function",
                             "z": "78f6b708eb6bd2fe",
                             "name": "wrFritz - teichPow",
                             "func": "var topic = msg.topic;\nvar teichPow;\nvar wrFritz;\nvar ergebnis;\n\nvar teichPow = context.get('teichPowData') || 0;;\nvar wrFritz = context.get('wrFritzData') || 0;;\n\n\nif (topic == 'teichPowTopic') {\n//if (topic == \"0_userdata.0.TeichMinus.Teich-Pow\") {\n    teichPow = parseInt(msg.payload);\n    context.set('teichPowData', teichPow)\n}\n\nif (topic == 'wrFritzTopic') {\n//if (topic == \"0_userdata/0/TeichMinus/WR-Fritz\") {\n    wrFritz = parseInt(msg.payload);\n    context.set('wrFritzData', wrFritz) \n}\n\nergebnis = wrFritz - teichPow;\nmsg.payload = ergebnis;\nreturn msg;\n\n\n",
                             "outputs": 1,
                             "noerr": 0,
                             "initialize": "",
                             "finalize": "",
                             "libs": [],
                             "x": 610,
                             "y": 600,
                             "wires": [
                                 [
                                     "11f59eb25158b200"
                                 ]
                             ]
                         },
                         {
                             "id": "f85da542bcf883c8",
                             "type": "change",
                             "z": "78f6b708eb6bd2fe",
                             "name": "",
                             "rules": [
                                 {
                                     "t": "set",
                                     "p": "topic",
                                     "pt": "msg",
                                     "to": "teichPowTopic",
                                     "tot": "str"
                                 }
                             ],
                             "action": "",
                             "property": "",
                             "from": "",
                             "to": "",
                             "reg": false,
                             "x": 380,
                             "y": 560,
                             "wires": [
                                 [
                                     "9a2bda7d9bbb1ca2"
                                 ]
                             ]
                         },
                         {
                             "id": "363c25994833957b",
                             "type": "change",
                             "z": "78f6b708eb6bd2fe",
                             "name": "",
                             "rules": [
                                 {
                                     "t": "set",
                                     "p": "topic",
                                     "pt": "msg",
                                     "to": "wrFritzTopic",
                                     "tot": "str"
                                 }
                             ],
                             "action": "",
                             "property": "",
                             "from": "",
                             "to": "",
                             "reg": false,
                             "x": 380,
                             "y": 640,
                             "wires": [
                                 [
                                     "9a2bda7d9bbb1ca2"
                                 ]
                             ]
                         }
                      ]
                      

                      geschild 1 Reply Last reply Reply Quote 0
                      • geschild
                        geschild @mickym last edited by

                        @mickym Ist klar, aber wollte @siporax das Leben leichter machen.

                        mickym 1 Reply Last reply Reply Quote 0
                        • mickym
                          mickym Most Active @geschild last edited by mickym

                          Übrigens Deine Function Node 😉

                          var topic = msg.topic;
                          flow.set('teichPowTopic', topic);
                          
                          msg.payload = flow.get('teichPowTopic');
                          return msg;
                          

                          kann man auch mit einer ChangeNode ohne Codieren machen. 😉

                          Das macht das Gleiche:

                          014d08e3-c169-4723-813e-d4692745e94d-image.png

                          S geschild 2 Replies Last reply Reply Quote 0
                          • S
                            siporax @mickym last edited by siporax

                            @mickym said in 2 Werte Subtrtahieren in Node Red:

                            Übrigens Deine Function Node 😉

                            var topic = msg.topic;
                            flow.set('teichPowTopic', topic);
                            
                            msg.payload = flow.get('teichPowTopic');
                            return msg;
                            

                            kann man auch mit einer ChangeNode ohne Codieren machen. 😉

                            Das macht das Gleiche:

                            014d08e3-c169-4723-813e-d4692745e94d-image.png

                            So habs zum rechnen gebracht steht zwar ein minus davor im Zielordner beim Ergebnis aber damit kann ich leben.

                            [
                               {
                                   "id": "78f6b708eb6bd2fe",
                                   "type": "tab",
                                   "label": "Realer Teichverbrauch",
                                   "disabled": false,
                                   "info": "",
                                   "env": []
                               },
                               {
                                   "id": "4e110ac9e3526a1d",
                                   "type": "ioBroker in",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "Teich-Pow",
                                   "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                                   "payloadType": "value",
                                   "onlyack": "",
                                   "func": "all",
                                   "gap": "",
                                   "fireOnStart": "false",
                                   "outFormat": "MQTT",
                                   "x": 120,
                                   "y": 100,
                                   "wires": [
                                       [
                                           "e6795d8dc9d84fcc"
                                       ]
                                   ]
                               },
                               {
                                   "id": "be61f3942177482d",
                                   "type": "ioBroker get",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "WR-Fritz",
                                   "topic": "fritzdect.0.DECT_116570079058.power",
                                   "attrname": "wr",
                                   "payloadType": "value",
                                   "errOnInvalidState": "nothing",
                                   "x": 520,
                                   "y": 100,
                                   "wires": [
                                       [
                                           "719b166cf1c4cf56"
                                       ]
                                   ]
                               },
                               {
                                   "id": "719b166cf1c4cf56",
                                   "type": "change",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "TeichPow - WR",
                                   "rules": [
                                       {
                                           "t": "set",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "verbrauch - wr",
                                           "tot": "jsonata"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 700,
                                   "y": 140,
                                   "wires": [
                                       [
                                           "2528507974039f88"
                                       ]
                                   ]
                               },
                               {
                                   "id": "2528507974039f88",
                                   "type": "ioBroker out",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "Realer_Teichverbrauch",
                                   "topic": "0_userdata.0.Node_Red_Realer_Teichverbrauch",
                                   "ack": "true",
                                   "autoCreate": "false",
                                   "stateName": "",
                                   "role": "",
                                   "payloadType": "",
                                   "readonly": "",
                                   "stateUnit": "",
                                   "stateMin": "",
                                   "stateMax": "",
                                   "x": 950,
                                   "y": 140,
                                   "wires": []
                               },
                               {
                                   "id": "e6795d8dc9d84fcc",
                                   "type": "change",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "",
                                   "rules": [
                                       {
                                           "t": "move",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "verbrauch",
                                           "tot": "msg"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 320,
                                   "y": 100,
                                   "wires": [
                                       [
                                           "be61f3942177482d"
                                       ]
                                   ]
                               },
                               {
                                   "id": "5413c6e8e87d1659",
                                   "type": "ioBroker in",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "WR-Fritz",
                                   "topic": "fritzdect.0.DECT_116570079058.power",
                                   "payloadType": "value",
                                   "onlyack": "",
                                   "func": "all",
                                   "gap": "",
                                   "fireOnStart": "false",
                                   "outFormat": "MQTT",
                                   "x": 120,
                                   "y": 180,
                                   "wires": [
                                       [
                                           "e857e6e86301279a"
                                       ]
                                   ]
                               },
                               {
                                   "id": "8e2c30a2834a5bc7",
                                   "type": "ioBroker get",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "Teich-Pow",
                                   "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                                   "attrname": "verbrauch",
                                   "payloadType": "value",
                                   "errOnInvalidState": "nothing",
                                   "x": 530,
                                   "y": 180,
                                   "wires": [
                                       [
                                           "719b166cf1c4cf56"
                                       ]
                                   ]
                               },
                               {
                                   "id": "e857e6e86301279a",
                                   "type": "change",
                                   "z": "78f6b708eb6bd2fe",
                                   "name": "",
                                   "rules": [
                                       {
                                           "t": "move",
                                           "p": "payload",
                                           "pt": "msg",
                                           "to": "wr",
                                           "tot": "msg"
                                       }
                                   ],
                                   "action": "",
                                   "property": "",
                                   "from": "",
                                   "to": "",
                                   "reg": false,
                                   "x": 320,
                                   "y": 180,
                                   "wires": [
                                       [
                                           "8e2c30a2834a5bc7"
                                       ]
                                   ]
                               }
                            ]
                            

                            mickym 1 Reply Last reply Reply Quote 0
                            • geschild
                              geschild @mickym last edited by geschild

                              @mickym Danke. Wie gesagt, komme vom Script und muss mir die Möglichkeiten von nodered erst aneignen. Schönen Sonntag noch.

                              PS. Kannst du mir den elektrischen Aufbau von @siporax erklären?

                              mickym 1 Reply Last reply Reply Quote 0
                              • mickym
                                mickym Most Active @siporax last edited by mickym

                                @siporax Das Minus kannst Du eliminieren, wenn Du die Subtraktion umdrehst oder halt den absoluten Wert nimmst.

                                Um den absoluten Wert zu erhalten - einfach die ChangeNode wie folgt ändern:

                                acdece76-dff7-4675-81a7-90f32dc1c15f-image.png

                                Oder alternativ mit -1 multiplizieren also

                                (payload-wr) * -1
                                
                                1 Reply Last reply Reply Quote 0
                                • mickym
                                  mickym Most Active @geschild last edited by

                                  @geschild sagte in 2 Werte Subtrtahieren in Node Red:

                                  PS. Kannst du mir den elektrischen Aufbau von @siporax erklären?

                                  Nee - das muss @siporax selbst machen - ich bin nur für die Logik in NodeRed zuständig. 😉

                                  S 1 Reply Last reply Reply Quote 0
                                  • S
                                    siporax @mickym last edited by

                                    @mickym said in 2 Werte Subtrtahieren in Node Red:

                                    @geschild sagte in 2 Werte Subtrtahieren in Node Red:

                                    PS. Kannst du mir den elektrischen Aufbau von @siporax erklären?

                                    Nee - das muss @siporax selbst machen - ich bin nur für die Logik in NodeRed zuständig. 😉

                                    Habe eine Warnmeldungen
                                    7 forum.JPG

                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      siporax @siporax last edited by

                                      @siporax said in 2 Werte Subtrtahieren in Node Red:

                                      @mickym said in 2 Werte Subtrtahieren in Node Red:

                                      @geschild sagte in 2 Werte Subtrtahieren in Node Red:

                                      PS. Kannst du mir den elektrischen Aufbau von @siporax erklären?

                                      Nee - das muss @siporax selbst machen - ich bin nur für die Logik in NodeRed zuständig. 😉

                                      Habe eine Warnmeldungen
                                      7 forum.JPG

                                      Wenn Wechselrichter ausgeschaltet ist hat der Teich dennoch Verbrauch der wird mir nicht dan angezeigt ?

                                      mickym 1 Reply Last reply Reply Quote 0
                                      • mickym
                                        mickym Most Active @siporax last edited by mickym

                                        @siporax

                                        1. Also Du musst halt vorher mit der Logik klar kommen. Die Warnmeldungen kommen, weil Du versucht hast einen schreibgeschützten Wert im Sonoff Adapter zu beschreiben - das darfst Du halt nicht. Überprüfe Deine iobroker-Out Nodes. Bis auf die Werte, die Du zum Steuern verwendest, darf sonst nur der Adapter was reinschreiben.

                                        Schreibgeschütze Werte erkennst Du an dem Schloss:

                                        dbeb62c8-1b84-4a07-984e-16acfd6a69c5-image.png

                                        1. Ich hab Dir ja gesagt Du sollst die einfache Variante nehmen und dann kannst Du wenn Du keinen Verbrauch auch 0 schreiben und den Wechselrichter ignorieren.

                                        e16926ac-2969-404c-84f3-4f4efa87ccbf-image.png

                                        [
                                           {
                                               "id": "18edda87f3b39f3e",
                                               "type": "ioBroker in",
                                               "z": "7e6af0015415146d",
                                               "name": "Teich-Pow",
                                               "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                                               "payloadType": "value",
                                               "onlyack": "",
                                               "func": "all",
                                               "gap": "",
                                               "fireOnStart": "false",
                                               "outFormat": "MQTT",
                                               "x": 2080,
                                               "y": 3600,
                                               "wires": [
                                                   [
                                                       "0ebf71f32dd2b609"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "f0133d29a83f3d17",
                                               "type": "ioBroker get",
                                               "z": "7e6af0015415146d",
                                               "name": "WR-Fritz",
                                               "topic": "fritzdect.0.DECT_116570079058.power",
                                               "attrname": "wr",
                                               "payloadType": "value",
                                               "errOnInvalidState": "nothing",
                                               "x": 2400,
                                               "y": 3660,
                                               "wires": [
                                                   [
                                                       "746280ddaeb139a2"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "746280ddaeb139a2",
                                               "type": "change",
                                               "z": "7e6af0015415146d",
                                               "name": "TeichPow - WR",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "payload",
                                                       "pt": "msg",
                                                       "to": "(payload - wr) * -1",
                                                       "tot": "jsonata"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 2580,
                                               "y": 3660,
                                               "wires": [
                                                   [
                                                       "1e4d02d4327046e2"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "1e4d02d4327046e2",
                                               "type": "ioBroker out",
                                               "z": "7e6af0015415146d",
                                               "name": "Realer_Teichverbrauch",
                                               "topic": "0_userdata.0.Node_Red_Realer_Teichverbrauch",
                                               "ack": "true",
                                               "autoCreate": "false",
                                               "stateName": "",
                                               "role": "",
                                               "payloadType": "",
                                               "readonly": "",
                                               "stateUnit": "",
                                               "stateMin": "",
                                               "stateMax": "",
                                               "x": 2810,
                                               "y": 3580,
                                               "wires": []
                                           },
                                           {
                                               "id": "0ebf71f32dd2b609",
                                               "type": "switch",
                                               "z": "7e6af0015415146d",
                                               "name": "Verbrauch > 0",
                                               "property": "payload",
                                               "propertyType": "msg",
                                               "rules": [
                                                   {
                                                       "t": "eq",
                                                       "v": "0",
                                                       "vt": "num"
                                                   },
                                                   {
                                                       "t": "gt",
                                                       "v": "0",
                                                       "vt": "num"
                                                   }
                                               ],
                                               "checkall": "true",
                                               "repair": false,
                                               "outputs": 2,
                                               "x": 2260,
                                               "y": 3600,
                                               "wires": [
                                                   [
                                                       "1e4d02d4327046e2"
                                                   ],
                                                   [
                                                       "f0133d29a83f3d17"
                                                   ]
                                               ]
                                           }
                                        ]
                                        

                                        S 1 Reply Last reply Reply Quote 0
                                        • S
                                          siporax @mickym last edited by

                                          @mickym said in 2 Werte Subtrtahieren in Node Red:

                                          @siporax

                                          1. Also Du musst halt vorher mit der Logik klar kommen. Die Warnmeldungen kommen, weil Du versucht hast einen schreibgeschützten Wert im Sonoff Adapter zu beschreiben - das darfst Du halt nicht. Überprüfe Deine iobroker-Out Nodes. Bis auf die Werte, die Du zum Steuern verwendest, darf sonst nur der Adapter was reinschreiben.

                                          Schreibgeschütze Werte erkennst Du an dem Schloss:

                                          dbeb62c8-1b84-4a07-984e-16acfd6a69c5-image.png

                                          1. Ich hab Dir ja gesagt Du sollst die einfache Variante nehmen und dann kannst Du wenn Du keinen Verbrauch auch 0 schreiben und den Wechselrichter ignorieren.

                                          e16926ac-2969-404c-84f3-4f4efa87ccbf-image.png

                                          [
                                             {
                                                 "id": "18edda87f3b39f3e",
                                                 "type": "ioBroker in",
                                                 "z": "7e6af0015415146d",
                                                 "name": "Teich-Pow",
                                                 "topic": "sonoff.0.Teich-Verbrauch.ENERGY_Power",
                                                 "payloadType": "value",
                                                 "onlyack": "",
                                                 "func": "all",
                                                 "gap": "",
                                                 "fireOnStart": "false",
                                                 "outFormat": "MQTT",
                                                 "x": 2080,
                                                 "y": 3600,
                                                 "wires": [
                                                     [
                                                         "0ebf71f32dd2b609"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "f0133d29a83f3d17",
                                                 "type": "ioBroker get",
                                                 "z": "7e6af0015415146d",
                                                 "name": "WR-Fritz",
                                                 "topic": "fritzdect.0.DECT_116570079058.power",
                                                 "attrname": "wr",
                                                 "payloadType": "value",
                                                 "errOnInvalidState": "nothing",
                                                 "x": 2400,
                                                 "y": 3660,
                                                 "wires": [
                                                     [
                                                         "746280ddaeb139a2"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "746280ddaeb139a2",
                                                 "type": "change",
                                                 "z": "7e6af0015415146d",
                                                 "name": "TeichPow - WR",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "(payload - wr) * -1",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 2580,
                                                 "y": 3660,
                                                 "wires": [
                                                     [
                                                         "1e4d02d4327046e2"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "1e4d02d4327046e2",
                                                 "type": "ioBroker out",
                                                 "z": "7e6af0015415146d",
                                                 "name": "Realer_Teichverbrauch",
                                                 "topic": "0_userdata.0.Node_Red_Realer_Teichverbrauch",
                                                 "ack": "true",
                                                 "autoCreate": "false",
                                                 "stateName": "",
                                                 "role": "",
                                                 "payloadType": "",
                                                 "readonly": "",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 2810,
                                                 "y": 3580,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "0ebf71f32dd2b609",
                                                 "type": "switch",
                                                 "z": "7e6af0015415146d",
                                                 "name": "Verbrauch > 0",
                                                 "property": "payload",
                                                 "propertyType": "msg",
                                                 "rules": [
                                                     {
                                                         "t": "eq",
                                                         "v": "0",
                                                         "vt": "num"
                                                     },
                                                     {
                                                         "t": "gt",
                                                         "v": "0",
                                                         "vt": "num"
                                                     }
                                                 ],
                                                 "checkall": "true",
                                                 "repair": false,
                                                 "outputs": 2,
                                                 "x": 2260,
                                                 "y": 3600,
                                                 "wires": [
                                                     [
                                                         "1e4d02d4327046e2"
                                                     ],
                                                     [
                                                         "f0133d29a83f3d17"
                                                     ]
                                                 ]
                                             }
                                          ]
                                          

                                          Versuche das morgen in Ruhe nochmal.
                                          bekomme ich damit immer den Teichverbrauch angezeigt auch wenn der Wechselrichter nicht läuft ?

                                          mickym 1 Reply Last reply Reply Quote 0
                                          • mickym
                                            mickym Most Active @siporax last edited by

                                            @siporax Na wenn der Wechselrichter nicht läuft, was steht denn dann in dem Datenpunkt. Nein - woran erkennt man denn dass der nicht läuft. Wenn in dem Datenpunkt 0 steht ist es doch egal dann wird halt nichts abgezogen. Wie gesagt die Logik musst Du formulieren - am Besten als Text.

                                            S 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.1k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            3
                                            60
                                            2618
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo