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. Node Red Werte addieren

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Node Red Werte addieren

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

      @mickym
      Danke für die sehr schnelle Hilfe! Das war die Ursache! 🙂

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

        @mickym said in Node Red Werte addieren:

        Hallo @mickym,
        ich stehe gerade vor dem gleichen Problem zwecks Addition in Node-Red und wollte dies wie hier über das Change Node realisiern.
        Aber ich weiß nicht genau, was hier genau falsch ist?
        3b232204-0eba-4ad4-ba2c-9cd9f037dbd8-grafik.png

        An sich sind die Payloads der Wert vom Objekt.

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

          @_r_a_l_f_ JSONATA mag die Klammerschreibweise nicht, da das einen Filter darstellt.

          Probiere:

          payload.‘0_userdata/0……‘
          
          _ 1 Reply Last reply Reply Quote 0
          • _
            _R_A_L_F_ @mickym last edited by _R_A_L_F_

            @mickym Da kommt leider undefined im Payload Ergebnis. Ich habe statt ' mal " genommen und so klappts. Vielen Dank für die schnelle Hilfe 😉

            mickym 1 Reply Last reply Reply Quote 0
            • Marc Berg
              Marc Berg Most Active last edited by Marc Berg

              @_r_a_l_f_

              So sollte es auch gehen:

              $lookup(payload,"0_userdata....Keller...") + $lookup(payload,"0_userdata....Bad...")
              
              _ 1 Reply Last reply Reply Quote 0
              • _
                _R_A_L_F_ @Marc Berg last edited by

                @marc-berg Danke dir für den Tipp. So wie @mickym es geschrieben hat klappt es fast. Nur ' durch "" ersetzen und schon klappts 😉

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

                  @_r_a_l_f_ sagte in Node Red Werte addieren:

                  @mickym Da kommt leider undefined im Payload Ergebnis. Ich habe statt ' mal " genommen und so klappts. Vielen Dank für die schnelle Hilfe 😉

                  Ja manchmal muss ich auch probieren. 😉 - Im Übrigen von @Marc-Berg s Lösung - kürze ich die topics meist bevor ich die Datenpunkte in einem Objekt zusammenfasse.

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

                    Hänge mich mir mal rein da ich fast das gleiche vorhabe.
                    Habe zum ersten mal mit node red zu tun.

                    Möchte von meinem Stromzähler den ich über den iobroker laufen habe von L1 +L2+L3 zusammen adieren lassen damit ich ein Gesamtverbrauch habe in Watt und diesen Wert dann weiterverwenden kann.
                    Später mal mit Grafana.

                    Kann mir da mal einer helfen wie ich das anstelle soll.

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

                      @siporax Wie im Anfang Posting beschrieben, alle werte L1-L3 in eine Eigenschaft des Nachrichtenobjektes sammeln und dann zusammenzählen. Über das Attribut kannst Du ja jeden Wert einer anderen Nachrichteneigenschaft zuweisen.

                      8bd773b5-9d91-4d0c-8262-4920e0321307-image.png

                      Hier zum Import:

                      [
                         {
                             "id": "a872a7ba51fd3484",
                             "type": "inject",
                             "z": "7e6af0015415146d",
                             "name": "",
                             "props": [
                                 {
                                     "p": "trigger",
                                     "v": "true",
                                     "vt": "bool"
                                 }
                             ],
                             "repeat": "",
                             "crontab": "",
                             "once": false,
                             "onceDelay": 0.1,
                             "topic": "",
                             "x": 150,
                             "y": 4320,
                             "wires": [
                                 [
                                     "256da960d23f9755"
                                 ]
                             ]
                         },
                         {
                             "id": "256da960d23f9755",
                             "type": "ioBroker get",
                             "z": "7e6af0015415146d",
                             "name": "L1",
                             "topic": "0_userdata.0.test0.test.temperature:100",
                             "attrname": "L1",
                             "payloadType": "value",
                             "errOnInvalidState": "nothing",
                             "x": 290,
                             "y": 4320,
                             "wires": [
                                 [
                                     "a4730fef776c6647"
                                 ]
                             ]
                         },
                         {
                             "id": "a4730fef776c6647",
                             "type": "ioBroker get",
                             "z": "7e6af0015415146d",
                             "name": "L2",
                             "topic": "0_userdata.0.test0.test.temperature:101",
                             "attrname": "L2",
                             "payloadType": "value",
                             "errOnInvalidState": "nothing",
                             "x": 430,
                             "y": 4320,
                             "wires": [
                                 [
                                     "9685e5e1edcb1ba4"
                                 ]
                             ]
                         },
                         {
                             "id": "c5166dda9c56917b",
                             "type": "debug",
                             "z": "7e6af0015415146d",
                             "name": "Summe",
                             "active": true,
                             "tosidebar": true,
                             "console": false,
                             "tostatus": false,
                             "complete": "payload",
                             "targetType": "msg",
                             "statusVal": "",
                             "statusType": "auto",
                             "x": 800,
                             "y": 4320,
                             "wires": []
                         },
                         {
                             "id": "9685e5e1edcb1ba4",
                             "type": "change",
                             "z": "7e6af0015415146d",
                             "name": "",
                             "rules": [
                                 {
                                     "t": "set",
                                     "p": "payload",
                                     "pt": "msg",
                                     "to": "L1 + L2",
                                     "tot": "jsonata"
                                 }
                             ],
                             "action": "",
                             "property": "",
                             "from": "",
                             "to": "",
                             "reg": false,
                             "x": 610,
                             "y": 4320,
                             "wires": [
                                 [
                                     "c5166dda9c56917b"
                                 ]
                             ]
                         }
                      ]
                      

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

                        habs mal so importiert denke ich muss die L1 bis L3 über Topic neu zuweisen da meine Adressen ja andere sind.
                        Was muss ich da noch ändern das es passt.

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

                          @siporax Na da ,musst halt die Datenpunkte angeben aus den Du es auslesen willst. Ich hab doch keine Ahnung wo Du Deine Werte her holst.

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

                            @mickym hole sie vom iobroker über dem modbus adapter.
                            Habe ich hinbekommen und um den L3 Erweitert.


                            [
                            {
                            "id": "02ad8ca016888437",
                            "type": "tab",
                            "label": "Flow 1",
                            "disabled": false,
                            "info": "",
                            "env": []
                            },
                            {
                            "id": "a872a7ba51fd3484",
                            "type": "inject",
                            "z": "02ad8ca016888437",
                            "name": "",
                            "props": [
                            {
                            "p": "trigger",
                            "v": "true",
                            "vt": "bool"
                            }
                            ],
                            "repeat": "",
                            "crontab": "",
                            "once": false,
                            "onceDelay": 0.1,
                            "topic": "",
                            "x": 190,
                            "y": 240,
                            "wires": [
                            [
                            "256da960d23f9755"
                            ]
                            ]
                            },
                            {
                            "id": "256da960d23f9755",
                            "type": "ioBroker get",
                            "z": "02ad8ca016888437",
                            "name": "Netzbezug L1",
                            "topic": "modbus.0.inputRegisters.100.820_Netzbezug_L1",
                            "attrname": "L1",
                            "payloadType": "value",
                            "errOnInvalidState": "nothing",
                            "x": 360,
                            "y": 240,
                            "wires": [
                            [
                            "a4730fef776c6647"
                            ]
                            ]
                            },
                            {
                            "id": "a4730fef776c6647",
                            "type": "ioBroker get",
                            "z": "02ad8ca016888437",
                            "name": "Netzbezug L2",
                            "topic": "modbus.0.inputRegisters.100.821_Netzbezug_L2",
                            "attrname": "L2",
                            "payloadType": "value",
                            "errOnInvalidState": "nothing",
                            "x": 500,
                            "y": 240,
                            "wires": [
                            [
                            "d04d571a8162877c"
                            ]
                            ]
                            },
                            {
                            "id": "c5166dda9c56917b",
                            "type": "debug",
                            "z": "02ad8ca016888437",
                            "name": "Summe",
                            "active": true,
                            "tosidebar": true,
                            "console": false,
                            "tostatus": false,
                            "complete": "payload",
                            "targetType": "msg",
                            "statusVal": "",
                            "statusType": "auto",
                            "x": 1060,
                            "y": 240,
                            "wires": []
                            },
                            {
                            "id": "9685e5e1edcb1ba4",
                            "type": "change",
                            "z": "02ad8ca016888437",
                            "name": "",
                            "rules": [
                            {
                            "t": "set",
                            "p": "payload",
                            "pt": "msg",
                            "to": "L1 + L2",
                            "tot": "jsonata"
                            }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 870,
                            "y": 240,
                            "wires": [
                            [
                            "c5166dda9c56917b"
                            ]
                            ]
                            },
                            {
                            "id": "d04d571a8162877c",
                            "type": "ioBroker get",
                            "z": "02ad8ca016888437",
                            "name": "Netzbezug L3",
                            "topic": "modbus.0.inputRegisters.100.822_Netzbezug_L3",
                            "attrname": "L3",
                            "payloadType": "value",
                            "errOnInvalidState": "nothing",
                            "x": 660,
                            "y": 240,
                            "wires": [
                            [
                            "9685e5e1edcb1ba4"
                            ]
                            ]
                            }
                            ]

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

                              @siporax Na freut mich. Noch ein Tipp: wenn Du ein Flow zum Import bereitstellen willst - dann musst Du das über CodeTags machen, sonst verfälscht der Browser den Code.

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

                                @mickym

                                code_text
                                ```[
                                    {
                                        "id": "02ad8ca016888437",
                                        "type": "tab",
                                        "label": "Flow 1",
                                        "disabled": false,
                                        "info": "",
                                        "env": []
                                    },
                                    {
                                        "id": "a872a7ba51fd3484",
                                        "type": "inject",
                                        "z": "02ad8ca016888437",
                                        "name": "",
                                        "props": [
                                            {
                                                "p": "trigger",
                                                "v": "true",
                                                "vt": "bool"
                                            }
                                        ],
                                        "repeat": "",
                                        "crontab": "",
                                        "once": false,
                                        "onceDelay": 0.1,
                                        "topic": "",
                                        "x": 190,
                                        "y": 240,
                                        "wires": [
                                            [
                                                "256da960d23f9755"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "256da960d23f9755",
                                        "type": "ioBroker get",
                                        "z": "02ad8ca016888437",
                                        "name": "Netzbezug L1",
                                        "topic": "modbus.0.inputRegisters.100.820_Netzbezug_L1",
                                        "attrname": "L1",
                                        "payloadType": "value",
                                        "errOnInvalidState": "nothing",
                                        "x": 360,
                                        "y": 240,
                                        "wires": [
                                            [
                                                "a4730fef776c6647"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "a4730fef776c6647",
                                        "type": "ioBroker get",
                                        "z": "02ad8ca016888437",
                                        "name": "Netzbezug L2",
                                        "topic": "modbus.0.inputRegisters.100.821_Netzbezug_L2",
                                        "attrname": "L2",
                                        "payloadType": "value",
                                        "errOnInvalidState": "nothing",
                                        "x": 500,
                                        "y": 240,
                                        "wires": [
                                            [
                                                "d04d571a8162877c"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "c5166dda9c56917b",
                                        "type": "debug",
                                        "z": "02ad8ca016888437",
                                        "name": "Summe",
                                        "active": true,
                                        "tosidebar": true,
                                        "console": false,
                                        "tostatus": false,
                                        "complete": "payload",
                                        "targetType": "msg",
                                        "statusVal": "",
                                        "statusType": "auto",
                                        "x": 1060,
                                        "y": 240,
                                        "wires": []
                                    },
                                    {
                                        "id": "9685e5e1edcb1ba4",
                                        "type": "change",
                                        "z": "02ad8ca016888437",
                                        "name": "",
                                        "rules": [
                                            {
                                                "t": "set",
                                                "p": "payload",
                                                "pt": "msg",
                                                "to": "L1 + L2 + L3",
                                                "tot": "jsonata"
                                            }
                                        ],
                                        "action": "",
                                        "property": "",
                                        "from": "",
                                        "to": "",
                                        "reg": false,
                                        "x": 870,
                                        "y": 240,
                                        "wires": [
                                            [
                                                "c5166dda9c56917b"
                                            ]
                                        ]
                                    },
                                    {
                                        "id": "d04d571a8162877c",
                                        "type": "ioBroker get",
                                        "z": "02ad8ca016888437",
                                        "name": "Netzbezug L3",
                                        "topic": "modbus.0.inputRegisters.100.822_Netzbezug_L3",
                                        "attrname": "L3",
                                        "payloadType": "value",
                                        "errOnInvalidState": "nothing",
                                        "x": 660,
                                        "y": 240,
                                        "wires": [
                                            [
                                                "9685e5e1edcb1ba4"
                                            ]
                                        ]
                                    }
                                ]
                                S 1 Reply Last reply Reply Quote 0
                                • S
                                  siporax @siporax last edited by

                                  so besser habe den Payload um den L3 noch erweitert ich hoffe das wahr richtig.

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

                                    @siporax Ja das passt schon

                                    9791c5e6-4229-400f-97b4-517d508c8260-image.png

                                    ABER - das mit den Codetags hast Du noch nicht richtig raus - da soll kein ''' und auch kein anderer Text drin stehen:

                                    [
                                       {
                                           "id": "1ce484e909033214",
                                           "type": "inject",
                                           "z": "7c4414c4c9653e12",
                                           "name": "",
                                           "props": [
                                               {
                                                   "p": "trigger",
                                                   "v": "true",
                                                   "vt": "bool"
                                               }
                                           ],
                                           "repeat": "",
                                           "crontab": "",
                                           "once": false,
                                           "onceDelay": 0.1,
                                           "topic": "",
                                           "x": 170,
                                           "y": 240,
                                           "wires": [
                                               [
                                                   "bfe50d1b1619adbc"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "bfe50d1b1619adbc",
                                           "type": "ioBroker get",
                                           "z": "7c4414c4c9653e12",
                                           "name": "Netzbezug L1",
                                           "topic": "modbus.0.inputRegisters.100.820_Netzbezug_L1",
                                           "attrname": "L1",
                                           "payloadType": "value",
                                           "errOnInvalidState": "nothing",
                                           "x": 320,
                                           "y": 240,
                                           "wires": [
                                               [
                                                   "91fe785f62b94a4f"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "91fe785f62b94a4f",
                                           "type": "ioBroker get",
                                           "z": "7c4414c4c9653e12",
                                           "name": "Netzbezug L2",
                                           "topic": "modbus.0.inputRegisters.100.821_Netzbezug_L2",
                                           "attrname": "L2",
                                           "payloadType": "value",
                                           "errOnInvalidState": "nothing",
                                           "x": 500,
                                           "y": 240,
                                           "wires": [
                                               [
                                                   "905a755e72a8bbdb"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "1f07146054b4751b",
                                           "type": "debug",
                                           "z": "7c4414c4c9653e12",
                                           "name": "Summe",
                                           "active": true,
                                           "tosidebar": true,
                                           "console": false,
                                           "tostatus": false,
                                           "complete": "payload",
                                           "targetType": "msg",
                                           "statusVal": "",
                                           "statusType": "auto",
                                           "x": 1060,
                                           "y": 240,
                                           "wires": []
                                       },
                                       {
                                           "id": "bc706d15e6b47333",
                                           "type": "change",
                                           "z": "7c4414c4c9653e12",
                                           "name": "",
                                           "rules": [
                                               {
                                                   "t": "set",
                                                   "p": "payload",
                                                   "pt": "msg",
                                                   "to": "L1 + L2 + L3",
                                                   "tot": "jsonata"
                                               }
                                           ],
                                           "action": "",
                                           "property": "",
                                           "from": "",
                                           "to": "",
                                           "reg": false,
                                           "x": 870,
                                           "y": 240,
                                           "wires": [
                                               [
                                                   "1f07146054b4751b"
                                               ]
                                           ]
                                       },
                                       {
                                           "id": "905a755e72a8bbdb",
                                           "type": "ioBroker get",
                                           "z": "7c4414c4c9653e12",
                                           "name": "Netzbezug L3",
                                           "topic": "modbus.0.inputRegisters.100.822_Netzbezug_L3",
                                           "attrname": "L3",
                                           "payloadType": "value",
                                           "errOnInvalidState": "nothing",
                                           "x": 680,
                                           "y": 240,
                                           "wires": [
                                               [
                                                   "bc706d15e6b47333"
                                               ]
                                           ]
                                       }
                                    ]
                                    

                                    Wenn Du das sauber machst - kann man mit einem Klick auf Select All

                                    454692de-7500-4e8e-8016-951e2d80e1da-image.png

                                    alles markieren und in die Zwischenablage kopieren.

                                    Also alles gut - aber für dir Zukunft einfach etwas benutzerfreundlicher machen.

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

                                      @mickym Werte kommen rein über L1 bis L3 aber kein Ergebnis dazu

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

                                        @siporax Du solltest doch im Status der Nodes die Werte sehen. Du kannst Dir ja mal in der Debug Node - das komplette Nachrichtenobjekt Dir ausgeben lassen.

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

                                          @mickym node red 2.JPG

                                          Ist das soweit dann richtig?

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

                                            @siporax Ja klar - Du siehst doch was ausgelesen wird.

                                            1468 + 102 + 6 = 1576

                                            Das passt doch?

                                            71f12604-23ec-4022-99c7-1c5235d8ab92-image.png

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            823
                                            Online

                                            31.6k
                                            Users

                                            79.6k
                                            Topics

                                            1.3m
                                            Posts

                                            9
                                            62
                                            24123
                                            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