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: Number in array wandel

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Node red: Number in array wandel

    This topic has been deleted. Only users with topic management privileges can see it.
    • Eckhard Meier
      Eckhard Meier last edited by

      Hallo stehe als Anfänger vor dem Problem wie ich msg. payload number in msg. payload Array[1] umwandeln kann.

      sprobst mickym 2 Replies Last reply Reply Quote 0
      • sprobst
        sprobst @Eckhard Meier last edited by

        @eckhard-meier

        Ich würde das z.B. so machen (jsonata mit "[payload]"):

        [
            {
                "id": "74cca6de35f6da1e",
                "type": "inject",
                "z": "96298e588ffbd16d",
                "name": "number",
                "props": [
                    {
                        "p": "payload"
                    },
                    {
                        "p": "topic",
                        "vt": "str"
                    }
                ],
                "repeat": "",
                "crontab": "",
                "once": false,
                "onceDelay": 0.1,
                "topic": "test",
                "payload": "12",
                "payloadType": "num",
                "x": 290,
                "y": 480,
                "wires": [
                    [
                        "3739397f4e83c55f"
                    ]
                ]
            },
            {
                "id": "3739397f4e83c55f",
                "type": "change",
                "z": "96298e588ffbd16d",
                "name": "number -> array[0]",
                "rules": [
                    {
                        "t": "set",
                        "p": "payload",
                        "pt": "msg",
                        "to": "[ payload ]",
                        "tot": "jsonata"
                    }
                ],
                "action": "",
                "property": "",
                "from": "",
                "to": "",
                "reg": false,
                "x": 490,
                "y": 480,
                "wires": [
                    [
                        "5a705a2010250aa6"
                    ]
                ]
            },
            {
                "id": "5a705a2010250aa6",
                "type": "debug",
                "z": "96298e588ffbd16d",
                "name": "output",
                "active": true,
                "tosidebar": true,
                "console": false,
                "tostatus": false,
                "complete": "payload",
                "targetType": "msg",
                "statusVal": "",
                "statusType": "auto",
                "x": 670,
                "y": 480,
                "wires": []
            }
        ]
        

        Gruß

        Sven

        Eckhard Meier 1 Reply Last reply Reply Quote 0
        • Eckhard Meier
          Eckhard Meier @sprobst last edited by

          @sprobst sorry ich bin wirklich blutiger Anfänger !!
          jetzt habe ich schon einmal die Meldung [object, object, objekt]
          wie greife ich auf das eine Feld zu ? Ich habe eine Nummer die ich umwandeln möchte

          sprobst 1 Reply Last reply Reply Quote 0
          • mickym
            mickym Most Active @Eckhard Meier last edited by mickym

            @eckhard-meier Du möchtest einfache ein normale Zahl in ein Array umwandeln? Wenn ja dann einfach wie unten vorgeschlagen machen. Auf ein Array greifst Du ganz normal zu. Also mit payload[<indexnummer>]

            1 Reply Last reply Reply Quote 0
            • sprobst
              sprobst @Eckhard Meier last edited by

              @eckhard-meier Das mit [object,object,object] klingt komisch. Zeig mal deine Daten und beschreib mal was Du damit wirklich machen willst. Wozu brauchst Du ein Array aus einer Zahl?

              Eckhard Meier 1 Reply Last reply Reply Quote 0
              • Eckhard Meier
                Eckhard Meier @sprobst last edited by

                @sprobst es gibt das node calulator unter function und das Ergebnis möchte ich mit dem Node : modbus write
                in eine Wärmepumpe schreiben. Bis ist der out dvon dem calulator node= number
                und das modbus write note erwartet array ?
                Kann den output oder input umdefinieren ?

                sprobst 1 Reply Last reply Reply Quote 0
                • sprobst
                  sprobst @Eckhard Meier last edited by

                  @eckhard-meier Da bin ich raus, modbus hab ich nicht, aber nach der Doku brauchst Du das array nur wenn Du mehrere Register gleichzeitig schreiben willst. Klingt für mich so, als ob Du nur eins schreibst, das müsste dann nach meinem Doku-Verständnis mit FunctionCode 6 und dem Single-Wert gehen.

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

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  929
                  Online

                  31.6k
                  Users

                  79.6k
                  Topics

                  1.3m
                  Posts

                  3
                  7
                  457
                  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