Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Node-Red
  5. Node Red Modbus

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.4k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.0k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.5k

Node Red Modbus

Geplant Angeheftet Gesperrt Verschoben Node-Red
26 Beiträge 3 Kommentatoren 3.9k Aufrufe 2 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • G Garf

    @mickym

    Ehrlich? Den Gedanken hatte ich eben tatsächlich mal kurz. Aber dann sofort wieder verworfen. Ich glaube es jetzt nicht. Seit Stunden am Suchen und Probieren.

    Update

    Nein, dass funktioniert nicht. Das korrekte Ergebnis für die Modbusregister muss für die Fließkommzahl 100,00 so aussehen:

    51144308-d3d2-421a-b5fe-b2e560674d79-grafik.png

    Der Parser liefert die Eingangszahl 100

    915264fe-4c3d-4f26-a0a4-ee1a40000605-grafik.png

    bb006798-8072-4479-91e4-d35d0f0c8fdd-grafik.png

    mickymM Online
    mickymM Online
    mickym
    Most Active
    schrieb am zuletzt editiert von mickym
    #10

    @garf Du musst bei Parser nicht float nehmen - sondern der Maker macht aus Deinem Float einen Buffer mit 4 bytes - den parsed Du als 2 16 Bit Integer. ;)

    Mein Flow macht doch genau das. Aus dem 100.00 flot mache ich Dir das von Dir gewünschte Array. Du parsed das ja wieder als flow Wert dann kommt natürlich wieder 100 raus. ;)

    812ab101-3801-4a44-80af-b80e485fa239-image.png

    [
       {
           "id": "b2a1f09de6d12e90",
           "type": "inject",
           "z": "385f4b8d434f6005",
           "name": "",
           "props": [
               {
                   "p": "payload"
               }
           ],
           "repeat": "",
           "crontab": "",
           "once": false,
           "onceDelay": 0.1,
           "topic": "",
           "payload": "100.00",
           "payloadType": "num",
           "x": 470,
           "y": 2600,
           "wires": [
               [
                   "9bc9a74d1f455065"
               ]
           ]
       },
       {
           "id": "9bc9a74d1f455065",
           "type": "buffer-maker",
           "z": "385f4b8d434f6005",
           "name": "",
           "specification": "spec",
           "specificationType": "ui",
           "items": [
               {
                   "name": "item1",
                   "type": "floatbe",
                   "length": 1,
                   "dataType": "msg",
                   "data": "payload"
               }
           ],
           "swap1": "",
           "swap2": "",
           "swap3": "",
           "swap1Type": "swap",
           "swap2Type": "swap",
           "swap3Type": "swap",
           "msgProperty": "payload",
           "msgPropertyType": "str",
           "x": 670,
           "y": 2600,
           "wires": [
               [
                   "faea83afe6fa1bba",
                   "630def48ac40b034",
                   "c39e4fa3f88efaed"
               ]
           ]
       },
       {
           "id": "c5411af36dbc6206",
           "type": "debug",
           "z": "385f4b8d434f6005",
           "name": "Neues Array",
           "active": true,
           "tosidebar": true,
           "console": false,
           "tostatus": true,
           "complete": "payload",
           "targetType": "msg",
           "statusVal": "payload",
           "statusType": "auto",
           "x": 1050,
           "y": 2600,
           "wires": []
       },
       {
           "id": "7d49268d76c118b3",
           "type": "inject",
           "z": "385f4b8d434f6005",
           "name": "",
           "props": [
               {
                   "p": "payload"
               }
           ],
           "repeat": "",
           "crontab": "",
           "once": false,
           "onceDelay": 0.1,
           "topic": "",
           "payload": "-100.00",
           "payloadType": "num",
           "x": 470,
           "y": 2540,
           "wires": [
               [
                   "9bc9a74d1f455065"
               ]
           ]
       },
       {
           "id": "faea83afe6fa1bba",
           "type": "buffer-parser",
           "z": "385f4b8d434f6005",
           "name": "",
           "data": "payload",
           "dataType": "msg",
           "specification": "spec",
           "specificationType": "ui",
           "items": [
               {
                   "type": "uint16be",
                   "name": "item1",
                   "offset": 0,
                   "length": 1,
                   "offsetbit": 0,
                   "scale": "1",
                   "mask": ""
               },
               {
                   "type": "uint16be",
                   "name": "item2",
                   "offset": 2,
                   "length": 1,
                   "offsetbit": 0,
                   "scale": "1",
                   "mask": ""
               }
           ],
           "swap1": "",
           "swap2": "",
           "swap3": "",
           "swap1Type": "swap",
           "swap2Type": "swap",
           "swap3Type": "swap",
           "msgProperty": "payload",
           "msgPropertyType": "str",
           "resultType": "value",
           "resultTypeType": "return",
           "multipleResult": false,
           "fanOutMultipleResult": false,
           "setTopic": true,
           "outputs": 1,
           "x": 850,
           "y": 2600,
           "wires": [
               [
                   "c5411af36dbc6206"
               ]
           ]
       },
       {
           "id": "630def48ac40b034",
           "type": "buffer-parser",
           "z": "385f4b8d434f6005",
           "name": "",
           "data": "payload",
           "dataType": "msg",
           "specification": "spec",
           "specificationType": "ui",
           "items": [
               {
                   "type": "floatbe",
                   "name": "item1",
                   "offset": 0,
                   "length": 1,
                   "offsetbit": 0,
                   "scale": "1",
                   "mask": ""
               }
           ],
           "swap1": "",
           "swap2": "",
           "swap3": "",
           "swap1Type": "swap",
           "swap2Type": "swap",
           "swap3Type": "swap",
           "msgProperty": "payload",
           "msgPropertyType": "str",
           "resultType": "value",
           "resultTypeType": "return",
           "multipleResult": false,
           "fanOutMultipleResult": false,
           "setTopic": true,
           "outputs": 1,
           "x": 850,
           "y": 2660,
           "wires": [
               [
                   "dcd0c2795814669f"
               ]
           ]
       },
       {
           "id": "dcd0c2795814669f",
           "type": "debug",
           "z": "385f4b8d434f6005",
           "name": "wieder in Float",
           "active": true,
           "tosidebar": true,
           "console": false,
           "tostatus": true,
           "complete": "payload",
           "targetType": "msg",
           "statusVal": "payload",
           "statusType": "auto",
           "x": 1060,
           "y": 2660,
           "wires": []
       },
       {
           "id": "c310b522d6b2bc18",
           "type": "inject",
           "z": "385f4b8d434f6005",
           "name": "",
           "props": [
               {
                   "p": "payload"
               }
           ],
           "repeat": "",
           "crontab": "",
           "once": false,
           "onceDelay": 0.1,
           "topic": "",
           "payload": "-1234.00",
           "payloadType": "num",
           "x": 460,
           "y": 2660,
           "wires": [
               [
                   "9bc9a74d1f455065"
               ]
           ]
       },
       {
           "id": "c39e4fa3f88efaed",
           "type": "debug",
           "z": "385f4b8d434f6005",
           "name": "buffer",
           "active": true,
           "tosidebar": true,
           "console": false,
           "tostatus": false,
           "complete": "payload",
           "targetType": "msg",
           "statusVal": "",
           "statusType": "auto",
           "x": 830,
           "y": 2540,
           "wires": []
       }
    ]
    

    Wie gesagt, ob Dein Modbus unsigned integer braucht oder signed integer weiß ich nicht.

    Wenn ich mir das von Steve anschaue - der macht auch nichts anderes in seiner function Node:

    d86875f1-e170-4d14-8f39-199e09100cc0-image.png

    Er macht einen Buffer und dann behandelt er die beiden Buffer - allerdings als unsigned uint16(be). Also würde ich das genauso machen. ;)

    Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

    G 1 Antwort Letzte Antwort
    0
    • mickymM mickym

      @garf Du musst bei Parser nicht float nehmen - sondern der Maker macht aus Deinem Float einen Buffer mit 4 bytes - den parsed Du als 2 16 Bit Integer. ;)

      Mein Flow macht doch genau das. Aus dem 100.00 flot mache ich Dir das von Dir gewünschte Array. Du parsed das ja wieder als flow Wert dann kommt natürlich wieder 100 raus. ;)

      812ab101-3801-4a44-80af-b80e485fa239-image.png

      [
         {
             "id": "b2a1f09de6d12e90",
             "type": "inject",
             "z": "385f4b8d434f6005",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "100.00",
             "payloadType": "num",
             "x": 470,
             "y": 2600,
             "wires": [
                 [
                     "9bc9a74d1f455065"
                 ]
             ]
         },
         {
             "id": "9bc9a74d1f455065",
             "type": "buffer-maker",
             "z": "385f4b8d434f6005",
             "name": "",
             "specification": "spec",
             "specificationType": "ui",
             "items": [
                 {
                     "name": "item1",
                     "type": "floatbe",
                     "length": 1,
                     "dataType": "msg",
                     "data": "payload"
                 }
             ],
             "swap1": "",
             "swap2": "",
             "swap3": "",
             "swap1Type": "swap",
             "swap2Type": "swap",
             "swap3Type": "swap",
             "msgProperty": "payload",
             "msgPropertyType": "str",
             "x": 670,
             "y": 2600,
             "wires": [
                 [
                     "faea83afe6fa1bba",
                     "630def48ac40b034",
                     "c39e4fa3f88efaed"
                 ]
             ]
         },
         {
             "id": "c5411af36dbc6206",
             "type": "debug",
             "z": "385f4b8d434f6005",
             "name": "Neues Array",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": true,
             "complete": "payload",
             "targetType": "msg",
             "statusVal": "payload",
             "statusType": "auto",
             "x": 1050,
             "y": 2600,
             "wires": []
         },
         {
             "id": "7d49268d76c118b3",
             "type": "inject",
             "z": "385f4b8d434f6005",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "-100.00",
             "payloadType": "num",
             "x": 470,
             "y": 2540,
             "wires": [
                 [
                     "9bc9a74d1f455065"
                 ]
             ]
         },
         {
             "id": "faea83afe6fa1bba",
             "type": "buffer-parser",
             "z": "385f4b8d434f6005",
             "name": "",
             "data": "payload",
             "dataType": "msg",
             "specification": "spec",
             "specificationType": "ui",
             "items": [
                 {
                     "type": "uint16be",
                     "name": "item1",
                     "offset": 0,
                     "length": 1,
                     "offsetbit": 0,
                     "scale": "1",
                     "mask": ""
                 },
                 {
                     "type": "uint16be",
                     "name": "item2",
                     "offset": 2,
                     "length": 1,
                     "offsetbit": 0,
                     "scale": "1",
                     "mask": ""
                 }
             ],
             "swap1": "",
             "swap2": "",
             "swap3": "",
             "swap1Type": "swap",
             "swap2Type": "swap",
             "swap3Type": "swap",
             "msgProperty": "payload",
             "msgPropertyType": "str",
             "resultType": "value",
             "resultTypeType": "return",
             "multipleResult": false,
             "fanOutMultipleResult": false,
             "setTopic": true,
             "outputs": 1,
             "x": 850,
             "y": 2600,
             "wires": [
                 [
                     "c5411af36dbc6206"
                 ]
             ]
         },
         {
             "id": "630def48ac40b034",
             "type": "buffer-parser",
             "z": "385f4b8d434f6005",
             "name": "",
             "data": "payload",
             "dataType": "msg",
             "specification": "spec",
             "specificationType": "ui",
             "items": [
                 {
                     "type": "floatbe",
                     "name": "item1",
                     "offset": 0,
                     "length": 1,
                     "offsetbit": 0,
                     "scale": "1",
                     "mask": ""
                 }
             ],
             "swap1": "",
             "swap2": "",
             "swap3": "",
             "swap1Type": "swap",
             "swap2Type": "swap",
             "swap3Type": "swap",
             "msgProperty": "payload",
             "msgPropertyType": "str",
             "resultType": "value",
             "resultTypeType": "return",
             "multipleResult": false,
             "fanOutMultipleResult": false,
             "setTopic": true,
             "outputs": 1,
             "x": 850,
             "y": 2660,
             "wires": [
                 [
                     "dcd0c2795814669f"
                 ]
             ]
         },
         {
             "id": "dcd0c2795814669f",
             "type": "debug",
             "z": "385f4b8d434f6005",
             "name": "wieder in Float",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": true,
             "complete": "payload",
             "targetType": "msg",
             "statusVal": "payload",
             "statusType": "auto",
             "x": 1060,
             "y": 2660,
             "wires": []
         },
         {
             "id": "c310b522d6b2bc18",
             "type": "inject",
             "z": "385f4b8d434f6005",
             "name": "",
             "props": [
                 {
                     "p": "payload"
                 }
             ],
             "repeat": "",
             "crontab": "",
             "once": false,
             "onceDelay": 0.1,
             "topic": "",
             "payload": "-1234.00",
             "payloadType": "num",
             "x": 460,
             "y": 2660,
             "wires": [
                 [
                     "9bc9a74d1f455065"
                 ]
             ]
         },
         {
             "id": "c39e4fa3f88efaed",
             "type": "debug",
             "z": "385f4b8d434f6005",
             "name": "buffer",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": false,
             "complete": "payload",
             "targetType": "msg",
             "statusVal": "",
             "statusType": "auto",
             "x": 830,
             "y": 2540,
             "wires": []
         }
      ]
      

      Wie gesagt, ob Dein Modbus unsigned integer braucht oder signed integer weiß ich nicht.

      Wenn ich mir das von Steve anschaue - der macht auch nichts anderes in seiner function Node:

      d86875f1-e170-4d14-8f39-199e09100cc0-image.png

      Er macht einen Buffer und dann behandelt er die beiden Buffer - allerdings als unsigned uint16(be). Also würde ich das genauso machen. ;)

      G Offline
      G Offline
      Garf
      schrieb am zuletzt editiert von
      #11

      @mickym
      Bei dem DDC Regler sieht die Begrifflichkeiten nochmals etwas anders aus. Auch die Auswahl ist da recht klein gehalten. Aber die korrekten Werte werden eingelesen, wenn die -100,00 in diesem Format übergeben wird. Da kannst Du noch nicht einmal sagen wieviele Register er auslesen soll. Für 16bit Integer nimmt er ein Register und für float nimmt er zwei Register. Ich habe den Regler zwei definierte Werte in die Modbusregister schreiben lassen und mir das Ergebnis angeschaut. In diesem Format übergebe ich ihm jetzt die Werte vom Raspi. Dank deiner Hilfe funktionert es jetzt dann auch. Aber dass muss ich mir in Ruhe noch einmal anschauen.

      Danke für deine Hilfe. Ohne diese würde man sicher aufgeben. Wer kommt denn auf die Idee zwei Integerwerte zu schreiben. Unfassbar.

      mickymM 1 Antwort Letzte Antwort
      0
      • G Garf

        @mickym
        Bei dem DDC Regler sieht die Begrifflichkeiten nochmals etwas anders aus. Auch die Auswahl ist da recht klein gehalten. Aber die korrekten Werte werden eingelesen, wenn die -100,00 in diesem Format übergeben wird. Da kannst Du noch nicht einmal sagen wieviele Register er auslesen soll. Für 16bit Integer nimmt er ein Register und für float nimmt er zwei Register. Ich habe den Regler zwei definierte Werte in die Modbusregister schreiben lassen und mir das Ergebnis angeschaut. In diesem Format übergebe ich ihm jetzt die Werte vom Raspi. Dank deiner Hilfe funktionert es jetzt dann auch. Aber dass muss ich mir in Ruhe noch einmal anschauen.

        Danke für deine Hilfe. Ohne diese würde man sicher aufgeben. Wer kommt denn auf die Idee zwei Integerwerte zu schreiben. Unfassbar.

        mickymM Online
        mickymM Online
        mickym
        Most Active
        schrieb am zuletzt editiert von mickym
        #12

        @garf Na gut - aber dann scheint es also zu funktionieren. Schönen Abend - und freu Dich über das Unfassbare. ;) - Einfach das pragmatisch nehmen und wie gesagt - Steve macht in meinen Augen nichts anderes als Buffer erzeugen und den Parsen - nur dass er das halt programmiert. ;)

        Wie gesagt Steve macht nichts anderes:

        385e3893-5f31-427d-ab9c-b45a4fd92c45-image.png

        Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

        G 1 Antwort Letzte Antwort
        0
        • mickymM mickym

          @garf Na gut - aber dann scheint es also zu funktionieren. Schönen Abend - und freu Dich über das Unfassbare. ;) - Einfach das pragmatisch nehmen und wie gesagt - Steve macht in meinen Augen nichts anderes als Buffer erzeugen und den Parsen - nur dass er das halt programmiert. ;)

          Wie gesagt Steve macht nichts anderes:

          385e3893-5f31-427d-ab9c-b45a4fd92c45-image.png

          G Offline
          G Offline
          Garf
          schrieb am zuletzt editiert von Garf
          #13

          @mickym sagte in Node Red Modbus:

          Steve macht in meinen Augen nichts anderes als Buffer erzeugen und den Parsen - nur dass er das halt programmiert.

          Und genau dass wollte ich vermeiden. Jetzt wären dass dann schon so ca. 60 function nodes geworden.

          Und das values wollte ich halt mit JSONata machen. Aber so ist es noch einfacher.

          mickymM 1 Antwort Letzte Antwort
          0
          • G Garf

            @mickym sagte in Node Red Modbus:

            Steve macht in meinen Augen nichts anderes als Buffer erzeugen und den Parsen - nur dass er das halt programmiert.

            Und genau dass wollte ich vermeiden. Jetzt wären dass dann schon so ca. 60 function nodes geworden.

            Und das values wollte ich halt mit JSONata machen. Aber so ist es noch einfacher.

            mickymM Online
            mickymM Online
            mickym
            Most Active
            schrieb am zuletzt editiert von
            #14

            @garf Aber die Kombi buffer maker und buffer parser ist doch dann easy.

            Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

            G 1 Antwort Letzte Antwort
            0
            • mickymM mickym

              @garf Aber die Kombi buffer maker und buffer parser ist doch dann easy.

              G Offline
              G Offline
              Garf
              schrieb am zuletzt editiert von
              #15

              @mickym
              Ja, aber nur wenn man die richtigen Einstellungen findet. Ansonsten nervt mich das Teil schon mal so ein wenig. Aber jetzt weiß ich ja wen ich fragen kann und warum es keine Hilfe gibt. Wie soll die aussehen?

              mickymM 1 Antwort Letzte Antwort
              0
              • G Garf

                @mickym
                Ja, aber nur wenn man die richtigen Einstellungen findet. Ansonsten nervt mich das Teil schon mal so ein wenig. Aber jetzt weiß ich ja wen ich fragen kann und warum es keine Hilfe gibt. Wie soll die aussehen?

                mickymM Online
                mickymM Online
                mickym
                Most Active
                schrieb am zuletzt editiert von
                #16

                @garf sagte in Node Red Modbus:

                @mickym
                Ja, aber nur wenn man die richtigen Einstellungen findet. Ansonsten nervt mich das Teil schon mal so ein wenig. Aber jetzt weiß ich ja wen ich fragen kann und warum es keine Hilfe gibt. Wie soll die aussehen?

                Na ich bin da auch kein Spezialist und erst recht habe ich kein Modbus. Letztlich werden Floats auch immer als Integer im System abgebildet. Das Problem ist halt, dass Du immer auf den Buffer runterbrechen musst. Im Buffer-Maker musst Du ja angeben wie er eine Zahl interpretieren muss. Ich muss da aber auch immer etwas rumprobieren. ;)

                Und wichtig erst mal zu verstehen. Aber nun kommst ja erst mal weiter - ob ich Dir sonst behilflich sein kann, das weiß ich nicht. Ich mach das ja alles auf theoretischer Basis und habe kein System mit dem ich das verifizieren könnte.

                Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                G 1 Antwort Letzte Antwort
                1
                • mickymM mickym

                  @garf sagte in Node Red Modbus:

                  @mickym
                  Ja, aber nur wenn man die richtigen Einstellungen findet. Ansonsten nervt mich das Teil schon mal so ein wenig. Aber jetzt weiß ich ja wen ich fragen kann und warum es keine Hilfe gibt. Wie soll die aussehen?

                  Na ich bin da auch kein Spezialist und erst recht habe ich kein Modbus. Letztlich werden Floats auch immer als Integer im System abgebildet. Das Problem ist halt, dass Du immer auf den Buffer runterbrechen musst. Im Buffer-Maker musst Du ja angeben wie er eine Zahl interpretieren muss. Ich muss da aber auch immer etwas rumprobieren. ;)

                  Und wichtig erst mal zu verstehen. Aber nun kommst ja erst mal weiter - ob ich Dir sonst behilflich sein kann, das weiß ich nicht. Ich mach das ja alles auf theoretischer Basis und habe kein System mit dem ich das verifizieren könnte.

                  G Offline
                  G Offline
                  Garf
                  schrieb am zuletzt editiert von
                  #17

                  @mickym
                  Der buffer parser scheint bei der Umrechnung von Negativwerten nicht korrekt zu arbeiten. Schau mal bitte.
                  Das obere Array wird mit dem function Node und der Formel von Steve , das untere Array durch JSONata.

                  42c6c9b8-a789-4ba8-add4-c87bec882359-grafik.png

                  mickymM 1 Antwort Letzte Antwort
                  0
                  • G Garf

                    @mickym
                    Der buffer parser scheint bei der Umrechnung von Negativwerten nicht korrekt zu arbeiten. Schau mal bitte.
                    Das obere Array wird mit dem function Node und der Formel von Steve , das untere Array durch JSONata.

                    42c6c9b8-a789-4ba8-add4-c87bec882359-grafik.png

                    mickymM Online
                    mickymM Online
                    mickym
                    Most Active
                    schrieb am zuletzt editiert von
                    #18

                    @garf du musst beim parser uint16 und nicht int16 nehmen.

                    Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                    HomoranH 1 Antwort Letzte Antwort
                    1
                    • mickymM mickym

                      @garf du musst beim parser uint16 und nicht int16 nehmen.

                      HomoranH Nicht stören
                      HomoranH Nicht stören
                      Homoran
                      Global Moderator Administrators
                      schrieb am zuletzt editiert von
                      #19

                      @mickym sagte in Node Red Modbus:

                      @garf du musst beim parser uint16 und nicht int16 nehmen.

                      sicher?
                      das u steht für unsigned, also ohne Vorzeichen.

                      kein Support per PN! - Fragen im Forum stellen - es gibt fast nichts, was nicht auch für andere interessant ist.

                      Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.

                      der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

                      mickymM 1 Antwort Letzte Antwort
                      0
                      • HomoranH Homoran

                        @mickym sagte in Node Red Modbus:

                        @garf du musst beim parser uint16 und nicht int16 nehmen.

                        sicher?
                        das u steht für unsigned, also ohne Vorzeichen.

                        mickymM Online
                        mickymM Online
                        mickym
                        Most Active
                        schrieb am zuletzt editiert von mickym
                        #20

                        @homoran ja ich bin sicher. Hatte ich unten schon mal geschrieben.

                        Hier habe ich die Konvertierung hin und zurück gemacht:

                        3163d800-1fd9-416a-96be-70f1ec3fd46d-image.png

                        9e141db5-378b-4a71-a4dc-61a037e194e4-image.png

                        Und hier hatte ich das mit dem unsigned Int schon mal erwähnt: https://forum.iobroker.net/post/989556 und hier als ich es ausprobiert hatte: https://forum.iobroker.net/post/989554

                        [
                           {
                               "id": "b2a1f09de6d12e90",
                               "type": "inject",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "100.00",
                               "payloadType": "num",
                               "x": 170,
                               "y": 2620,
                               "wires": [
                                   [
                                       "1c12b45aa6c4adca"
                                   ]
                               ]
                           },
                           {
                               "id": "9bc9a74d1f455065",
                               "type": "buffer-maker",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "specification": "spec",
                               "specificationType": "ui",
                               "items": [
                                   {
                                       "name": "item1",
                                       "type": "floatbe",
                                       "length": 1,
                                       "dataType": "msg",
                                       "data": "payload"
                                   }
                               ],
                               "swap1": "",
                               "swap2": "",
                               "swap3": "",
                               "swap1Type": "swap",
                               "swap2Type": "swap",
                               "swap3Type": "swap",
                               "msgProperty": "payload",
                               "msgPropertyType": "str",
                               "x": 390,
                               "y": 2600,
                               "wires": [
                                   [
                                       "faea83afe6fa1bba",
                                       "c39e4fa3f88efaed"
                                   ]
                               ]
                           },
                           {
                               "id": "c5411af36dbc6206",
                               "type": "debug",
                               "z": "385f4b8d434f6005",
                               "name": "Neues Array",
                               "active": true,
                               "tosidebar": true,
                               "console": false,
                               "tostatus": true,
                               "complete": "payload",
                               "targetType": "msg",
                               "statusVal": "payload",
                               "statusType": "auto",
                               "x": 770,
                               "y": 2600,
                               "wires": []
                           },
                           {
                               "id": "7d49268d76c118b3",
                               "type": "inject",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "-100.00",
                               "payloadType": "num",
                               "x": 170,
                               "y": 2580,
                               "wires": [
                                   [
                                       "1c12b45aa6c4adca"
                                   ]
                               ]
                           },
                           {
                               "id": "faea83afe6fa1bba",
                               "type": "buffer-parser",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "data": "payload",
                               "dataType": "msg",
                               "specification": "spec",
                               "specificationType": "ui",
                               "items": [
                                   {
                                       "type": "uint16be",
                                       "name": "item1",
                                       "offset": 0,
                                       "length": 1,
                                       "offsetbit": 0,
                                       "scale": "1",
                                       "mask": ""
                                   },
                                   {
                                       "type": "uint16be",
                                       "name": "item2",
                                       "offset": 2,
                                       "length": 1,
                                       "offsetbit": 0,
                                       "scale": "1",
                                       "mask": ""
                                   }
                               ],
                               "swap1": "",
                               "swap2": "",
                               "swap3": "",
                               "swap1Type": "swap",
                               "swap2Type": "swap",
                               "swap3Type": "swap",
                               "msgProperty": "payload",
                               "msgPropertyType": "str",
                               "resultType": "value",
                               "resultTypeType": "return",
                               "multipleResult": false,
                               "fanOutMultipleResult": false,
                               "setTopic": true,
                               "outputs": 1,
                               "x": 570,
                               "y": 2600,
                               "wires": [
                                   [
                                       "c5411af36dbc6206",
                                       "28e7d3b028dcf2ba"
                                   ]
                               ]
                           },
                           {
                               "id": "c310b522d6b2bc18",
                               "type": "inject",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "-1234.00",
                               "payloadType": "num",
                               "x": 160,
                               "y": 2700,
                               "wires": [
                                   [
                                       "1c12b45aa6c4adca"
                                   ]
                               ]
                           },
                           {
                               "id": "c39e4fa3f88efaed",
                               "type": "debug",
                               "z": "385f4b8d434f6005",
                               "name": "buffer",
                               "active": true,
                               "tosidebar": true,
                               "console": false,
                               "tostatus": false,
                               "complete": "payload",
                               "targetType": "msg",
                               "statusVal": "",
                               "statusType": "auto",
                               "x": 550,
                               "y": 2540,
                               "wires": []
                           },
                           {
                               "id": "31e68b28d89b17db",
                               "type": "inject",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "68001",
                               "payloadType": "num",
                               "x": 170,
                               "y": 2660,
                               "wires": [
                                   [
                                       "1c12b45aa6c4adca"
                                   ]
                               ]
                           },
                           {
                               "id": "28e7d3b028dcf2ba",
                               "type": "buffer-maker",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "specification": "spec",
                               "specificationType": "ui",
                               "items": [
                                   {
                                       "name": "item1",
                                       "type": "uint16be",
                                       "length": 2,
                                       "dataType": "msg",
                                       "data": "payload"
                                   }
                               ],
                               "swap1": "",
                               "swap2": "",
                               "swap3": "",
                               "swap1Type": "swap",
                               "swap2Type": "swap",
                               "swap3Type": "swap",
                               "msgProperty": "payload",
                               "msgPropertyType": "str",
                               "x": 770,
                               "y": 2680,
                               "wires": [
                                   [
                                       "423d2ba998b44648"
                                   ]
                               ]
                           },
                           {
                               "id": "d23882e23c0fe50c",
                               "type": "debug",
                               "z": "385f4b8d434f6005",
                               "name": "Rückkonvertierung",
                               "active": true,
                               "tosidebar": true,
                               "console": false,
                               "tostatus": false,
                               "complete": "payload",
                               "targetType": "msg",
                               "statusVal": "",
                               "statusType": "auto",
                               "x": 1150,
                               "y": 2680,
                               "wires": []
                           },
                           {
                               "id": "423d2ba998b44648",
                               "type": "buffer-parser",
                               "z": "385f4b8d434f6005",
                               "name": "",
                               "data": "payload",
                               "dataType": "msg",
                               "specification": "spec",
                               "specificationType": "ui",
                               "items": [
                                   {
                                       "type": "floatbe",
                                       "name": "item1",
                                       "offset": 0,
                                       "length": 1,
                                       "offsetbit": 0,
                                       "scale": "1",
                                       "mask": ""
                                   }
                               ],
                               "swap1": "",
                               "swap2": "",
                               "swap3": "",
                               "swap1Type": "swap",
                               "swap2Type": "swap",
                               "swap3Type": "swap",
                               "msgProperty": "payload",
                               "msgPropertyType": "str",
                               "resultType": "value",
                               "resultTypeType": "return",
                               "multipleResult": true,
                               "fanOutMultipleResult": false,
                               "setTopic": false,
                               "outputs": 1,
                               "x": 950,
                               "y": 2680,
                               "wires": [
                                   [
                                       "d23882e23c0fe50c"
                                   ]
                               ]
                           },
                           {
                               "id": "9c99b46399646127",
                               "type": "debug",
                               "z": "385f4b8d434f6005",
                               "name": "Float- Eingabe",
                               "active": true,
                               "tosidebar": true,
                               "console": false,
                               "tostatus": false,
                               "complete": "payload",
                               "targetType": "msg",
                               "statusVal": "",
                               "statusType": "auto",
                               "x": 400,
                               "y": 2660,
                               "wires": []
                           },
                           {
                               "id": "1c12b45aa6c4adca",
                               "type": "junction",
                               "z": "385f4b8d434f6005",
                               "x": 280,
                               "y": 2620,
                               "wires": [
                                   [
                                       "9bc9a74d1f455065",
                                       "9c99b46399646127"
                                   ]
                               ]
                           }
                        ]
                        

                        Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                        G 2 Antworten Letzte Antwort
                        2
                        • mickymM mickym

                          @homoran ja ich bin sicher. Hatte ich unten schon mal geschrieben.

                          Hier habe ich die Konvertierung hin und zurück gemacht:

                          3163d800-1fd9-416a-96be-70f1ec3fd46d-image.png

                          9e141db5-378b-4a71-a4dc-61a037e194e4-image.png

                          Und hier hatte ich das mit dem unsigned Int schon mal erwähnt: https://forum.iobroker.net/post/989556 und hier als ich es ausprobiert hatte: https://forum.iobroker.net/post/989554

                          [
                             {
                                 "id": "b2a1f09de6d12e90",
                                 "type": "inject",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "props": [
                                     {
                                         "p": "payload"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "100.00",
                                 "payloadType": "num",
                                 "x": 170,
                                 "y": 2620,
                                 "wires": [
                                     [
                                         "1c12b45aa6c4adca"
                                     ]
                                 ]
                             },
                             {
                                 "id": "9bc9a74d1f455065",
                                 "type": "buffer-maker",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "specification": "spec",
                                 "specificationType": "ui",
                                 "items": [
                                     {
                                         "name": "item1",
                                         "type": "floatbe",
                                         "length": 1,
                                         "dataType": "msg",
                                         "data": "payload"
                                     }
                                 ],
                                 "swap1": "",
                                 "swap2": "",
                                 "swap3": "",
                                 "swap1Type": "swap",
                                 "swap2Type": "swap",
                                 "swap3Type": "swap",
                                 "msgProperty": "payload",
                                 "msgPropertyType": "str",
                                 "x": 390,
                                 "y": 2600,
                                 "wires": [
                                     [
                                         "faea83afe6fa1bba",
                                         "c39e4fa3f88efaed"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c5411af36dbc6206",
                                 "type": "debug",
                                 "z": "385f4b8d434f6005",
                                 "name": "Neues Array",
                                 "active": true,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": true,
                                 "complete": "payload",
                                 "targetType": "msg",
                                 "statusVal": "payload",
                                 "statusType": "auto",
                                 "x": 770,
                                 "y": 2600,
                                 "wires": []
                             },
                             {
                                 "id": "7d49268d76c118b3",
                                 "type": "inject",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "props": [
                                     {
                                         "p": "payload"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "-100.00",
                                 "payloadType": "num",
                                 "x": 170,
                                 "y": 2580,
                                 "wires": [
                                     [
                                         "1c12b45aa6c4adca"
                                     ]
                                 ]
                             },
                             {
                                 "id": "faea83afe6fa1bba",
                                 "type": "buffer-parser",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "data": "payload",
                                 "dataType": "msg",
                                 "specification": "spec",
                                 "specificationType": "ui",
                                 "items": [
                                     {
                                         "type": "uint16be",
                                         "name": "item1",
                                         "offset": 0,
                                         "length": 1,
                                         "offsetbit": 0,
                                         "scale": "1",
                                         "mask": ""
                                     },
                                     {
                                         "type": "uint16be",
                                         "name": "item2",
                                         "offset": 2,
                                         "length": 1,
                                         "offsetbit": 0,
                                         "scale": "1",
                                         "mask": ""
                                     }
                                 ],
                                 "swap1": "",
                                 "swap2": "",
                                 "swap3": "",
                                 "swap1Type": "swap",
                                 "swap2Type": "swap",
                                 "swap3Type": "swap",
                                 "msgProperty": "payload",
                                 "msgPropertyType": "str",
                                 "resultType": "value",
                                 "resultTypeType": "return",
                                 "multipleResult": false,
                                 "fanOutMultipleResult": false,
                                 "setTopic": true,
                                 "outputs": 1,
                                 "x": 570,
                                 "y": 2600,
                                 "wires": [
                                     [
                                         "c5411af36dbc6206",
                                         "28e7d3b028dcf2ba"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c310b522d6b2bc18",
                                 "type": "inject",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "props": [
                                     {
                                         "p": "payload"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "-1234.00",
                                 "payloadType": "num",
                                 "x": 160,
                                 "y": 2700,
                                 "wires": [
                                     [
                                         "1c12b45aa6c4adca"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c39e4fa3f88efaed",
                                 "type": "debug",
                                 "z": "385f4b8d434f6005",
                                 "name": "buffer",
                                 "active": true,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "payload",
                                 "targetType": "msg",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 550,
                                 "y": 2540,
                                 "wires": []
                             },
                             {
                                 "id": "31e68b28d89b17db",
                                 "type": "inject",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "props": [
                                     {
                                         "p": "payload"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "68001",
                                 "payloadType": "num",
                                 "x": 170,
                                 "y": 2660,
                                 "wires": [
                                     [
                                         "1c12b45aa6c4adca"
                                     ]
                                 ]
                             },
                             {
                                 "id": "28e7d3b028dcf2ba",
                                 "type": "buffer-maker",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "specification": "spec",
                                 "specificationType": "ui",
                                 "items": [
                                     {
                                         "name": "item1",
                                         "type": "uint16be",
                                         "length": 2,
                                         "dataType": "msg",
                                         "data": "payload"
                                     }
                                 ],
                                 "swap1": "",
                                 "swap2": "",
                                 "swap3": "",
                                 "swap1Type": "swap",
                                 "swap2Type": "swap",
                                 "swap3Type": "swap",
                                 "msgProperty": "payload",
                                 "msgPropertyType": "str",
                                 "x": 770,
                                 "y": 2680,
                                 "wires": [
                                     [
                                         "423d2ba998b44648"
                                     ]
                                 ]
                             },
                             {
                                 "id": "d23882e23c0fe50c",
                                 "type": "debug",
                                 "z": "385f4b8d434f6005",
                                 "name": "Rückkonvertierung",
                                 "active": true,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "payload",
                                 "targetType": "msg",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 1150,
                                 "y": 2680,
                                 "wires": []
                             },
                             {
                                 "id": "423d2ba998b44648",
                                 "type": "buffer-parser",
                                 "z": "385f4b8d434f6005",
                                 "name": "",
                                 "data": "payload",
                                 "dataType": "msg",
                                 "specification": "spec",
                                 "specificationType": "ui",
                                 "items": [
                                     {
                                         "type": "floatbe",
                                         "name": "item1",
                                         "offset": 0,
                                         "length": 1,
                                         "offsetbit": 0,
                                         "scale": "1",
                                         "mask": ""
                                     }
                                 ],
                                 "swap1": "",
                                 "swap2": "",
                                 "swap3": "",
                                 "swap1Type": "swap",
                                 "swap2Type": "swap",
                                 "swap3Type": "swap",
                                 "msgProperty": "payload",
                                 "msgPropertyType": "str",
                                 "resultType": "value",
                                 "resultTypeType": "return",
                                 "multipleResult": true,
                                 "fanOutMultipleResult": false,
                                 "setTopic": false,
                                 "outputs": 1,
                                 "x": 950,
                                 "y": 2680,
                                 "wires": [
                                     [
                                         "d23882e23c0fe50c"
                                     ]
                                 ]
                             },
                             {
                                 "id": "9c99b46399646127",
                                 "type": "debug",
                                 "z": "385f4b8d434f6005",
                                 "name": "Float- Eingabe",
                                 "active": true,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "payload",
                                 "targetType": "msg",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 400,
                                 "y": 2660,
                                 "wires": []
                             },
                             {
                                 "id": "1c12b45aa6c4adca",
                                 "type": "junction",
                                 "z": "385f4b8d434f6005",
                                 "x": 280,
                                 "y": 2620,
                                 "wires": [
                                     [
                                         "9bc9a74d1f455065",
                                         "9c99b46399646127"
                                     ]
                                 ]
                             }
                          ]
                          

                          G Offline
                          G Offline
                          Garf
                          schrieb am zuletzt editiert von Garf
                          #21

                          @mickym
                          Kein Problem. Ist doch schnell umgestellt. Und das Ergebnis auch schnell zu sehen.

                          Jetzt fällt es mir auch wieder ein. Ja dass hattest Du auch schon mal geschrieben, du Fuchs. :+1:

                          Jetzt passt es und die drei Varianten laufen auch bei Minuswerten im Gleichschritt. Super Danke nochmal dafür.

                          6e41add0-42d9-43b7-904f-cff59b3d57e5-grafik.png

                          1 Antwort Letzte Antwort
                          1
                          • mickymM mickym

                            @homoran ja ich bin sicher. Hatte ich unten schon mal geschrieben.

                            Hier habe ich die Konvertierung hin und zurück gemacht:

                            3163d800-1fd9-416a-96be-70f1ec3fd46d-image.png

                            9e141db5-378b-4a71-a4dc-61a037e194e4-image.png

                            Und hier hatte ich das mit dem unsigned Int schon mal erwähnt: https://forum.iobroker.net/post/989556 und hier als ich es ausprobiert hatte: https://forum.iobroker.net/post/989554

                            [
                               {
                                   "id": "b2a1f09de6d12e90",
                                   "type": "inject",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "props": [
                                       {
                                           "p": "payload"
                                       }
                                   ],
                                   "repeat": "",
                                   "crontab": "",
                                   "once": false,
                                   "onceDelay": 0.1,
                                   "topic": "",
                                   "payload": "100.00",
                                   "payloadType": "num",
                                   "x": 170,
                                   "y": 2620,
                                   "wires": [
                                       [
                                           "1c12b45aa6c4adca"
                                       ]
                                   ]
                               },
                               {
                                   "id": "9bc9a74d1f455065",
                                   "type": "buffer-maker",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "specification": "spec",
                                   "specificationType": "ui",
                                   "items": [
                                       {
                                           "name": "item1",
                                           "type": "floatbe",
                                           "length": 1,
                                           "dataType": "msg",
                                           "data": "payload"
                                       }
                                   ],
                                   "swap1": "",
                                   "swap2": "",
                                   "swap3": "",
                                   "swap1Type": "swap",
                                   "swap2Type": "swap",
                                   "swap3Type": "swap",
                                   "msgProperty": "payload",
                                   "msgPropertyType": "str",
                                   "x": 390,
                                   "y": 2600,
                                   "wires": [
                                       [
                                           "faea83afe6fa1bba",
                                           "c39e4fa3f88efaed"
                                       ]
                                   ]
                               },
                               {
                                   "id": "c5411af36dbc6206",
                                   "type": "debug",
                                   "z": "385f4b8d434f6005",
                                   "name": "Neues Array",
                                   "active": true,
                                   "tosidebar": true,
                                   "console": false,
                                   "tostatus": true,
                                   "complete": "payload",
                                   "targetType": "msg",
                                   "statusVal": "payload",
                                   "statusType": "auto",
                                   "x": 770,
                                   "y": 2600,
                                   "wires": []
                               },
                               {
                                   "id": "7d49268d76c118b3",
                                   "type": "inject",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "props": [
                                       {
                                           "p": "payload"
                                       }
                                   ],
                                   "repeat": "",
                                   "crontab": "",
                                   "once": false,
                                   "onceDelay": 0.1,
                                   "topic": "",
                                   "payload": "-100.00",
                                   "payloadType": "num",
                                   "x": 170,
                                   "y": 2580,
                                   "wires": [
                                       [
                                           "1c12b45aa6c4adca"
                                       ]
                                   ]
                               },
                               {
                                   "id": "faea83afe6fa1bba",
                                   "type": "buffer-parser",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "data": "payload",
                                   "dataType": "msg",
                                   "specification": "spec",
                                   "specificationType": "ui",
                                   "items": [
                                       {
                                           "type": "uint16be",
                                           "name": "item1",
                                           "offset": 0,
                                           "length": 1,
                                           "offsetbit": 0,
                                           "scale": "1",
                                           "mask": ""
                                       },
                                       {
                                           "type": "uint16be",
                                           "name": "item2",
                                           "offset": 2,
                                           "length": 1,
                                           "offsetbit": 0,
                                           "scale": "1",
                                           "mask": ""
                                       }
                                   ],
                                   "swap1": "",
                                   "swap2": "",
                                   "swap3": "",
                                   "swap1Type": "swap",
                                   "swap2Type": "swap",
                                   "swap3Type": "swap",
                                   "msgProperty": "payload",
                                   "msgPropertyType": "str",
                                   "resultType": "value",
                                   "resultTypeType": "return",
                                   "multipleResult": false,
                                   "fanOutMultipleResult": false,
                                   "setTopic": true,
                                   "outputs": 1,
                                   "x": 570,
                                   "y": 2600,
                                   "wires": [
                                       [
                                           "c5411af36dbc6206",
                                           "28e7d3b028dcf2ba"
                                       ]
                                   ]
                               },
                               {
                                   "id": "c310b522d6b2bc18",
                                   "type": "inject",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "props": [
                                       {
                                           "p": "payload"
                                       }
                                   ],
                                   "repeat": "",
                                   "crontab": "",
                                   "once": false,
                                   "onceDelay": 0.1,
                                   "topic": "",
                                   "payload": "-1234.00",
                                   "payloadType": "num",
                                   "x": 160,
                                   "y": 2700,
                                   "wires": [
                                       [
                                           "1c12b45aa6c4adca"
                                       ]
                                   ]
                               },
                               {
                                   "id": "c39e4fa3f88efaed",
                                   "type": "debug",
                                   "z": "385f4b8d434f6005",
                                   "name": "buffer",
                                   "active": true,
                                   "tosidebar": true,
                                   "console": false,
                                   "tostatus": false,
                                   "complete": "payload",
                                   "targetType": "msg",
                                   "statusVal": "",
                                   "statusType": "auto",
                                   "x": 550,
                                   "y": 2540,
                                   "wires": []
                               },
                               {
                                   "id": "31e68b28d89b17db",
                                   "type": "inject",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "props": [
                                       {
                                           "p": "payload"
                                       }
                                   ],
                                   "repeat": "",
                                   "crontab": "",
                                   "once": false,
                                   "onceDelay": 0.1,
                                   "topic": "",
                                   "payload": "68001",
                                   "payloadType": "num",
                                   "x": 170,
                                   "y": 2660,
                                   "wires": [
                                       [
                                           "1c12b45aa6c4adca"
                                       ]
                                   ]
                               },
                               {
                                   "id": "28e7d3b028dcf2ba",
                                   "type": "buffer-maker",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "specification": "spec",
                                   "specificationType": "ui",
                                   "items": [
                                       {
                                           "name": "item1",
                                           "type": "uint16be",
                                           "length": 2,
                                           "dataType": "msg",
                                           "data": "payload"
                                       }
                                   ],
                                   "swap1": "",
                                   "swap2": "",
                                   "swap3": "",
                                   "swap1Type": "swap",
                                   "swap2Type": "swap",
                                   "swap3Type": "swap",
                                   "msgProperty": "payload",
                                   "msgPropertyType": "str",
                                   "x": 770,
                                   "y": 2680,
                                   "wires": [
                                       [
                                           "423d2ba998b44648"
                                       ]
                                   ]
                               },
                               {
                                   "id": "d23882e23c0fe50c",
                                   "type": "debug",
                                   "z": "385f4b8d434f6005",
                                   "name": "Rückkonvertierung",
                                   "active": true,
                                   "tosidebar": true,
                                   "console": false,
                                   "tostatus": false,
                                   "complete": "payload",
                                   "targetType": "msg",
                                   "statusVal": "",
                                   "statusType": "auto",
                                   "x": 1150,
                                   "y": 2680,
                                   "wires": []
                               },
                               {
                                   "id": "423d2ba998b44648",
                                   "type": "buffer-parser",
                                   "z": "385f4b8d434f6005",
                                   "name": "",
                                   "data": "payload",
                                   "dataType": "msg",
                                   "specification": "spec",
                                   "specificationType": "ui",
                                   "items": [
                                       {
                                           "type": "floatbe",
                                           "name": "item1",
                                           "offset": 0,
                                           "length": 1,
                                           "offsetbit": 0,
                                           "scale": "1",
                                           "mask": ""
                                       }
                                   ],
                                   "swap1": "",
                                   "swap2": "",
                                   "swap3": "",
                                   "swap1Type": "swap",
                                   "swap2Type": "swap",
                                   "swap3Type": "swap",
                                   "msgProperty": "payload",
                                   "msgPropertyType": "str",
                                   "resultType": "value",
                                   "resultTypeType": "return",
                                   "multipleResult": true,
                                   "fanOutMultipleResult": false,
                                   "setTopic": false,
                                   "outputs": 1,
                                   "x": 950,
                                   "y": 2680,
                                   "wires": [
                                       [
                                           "d23882e23c0fe50c"
                                       ]
                                   ]
                               },
                               {
                                   "id": "9c99b46399646127",
                                   "type": "debug",
                                   "z": "385f4b8d434f6005",
                                   "name": "Float- Eingabe",
                                   "active": true,
                                   "tosidebar": true,
                                   "console": false,
                                   "tostatus": false,
                                   "complete": "payload",
                                   "targetType": "msg",
                                   "statusVal": "",
                                   "statusType": "auto",
                                   "x": 400,
                                   "y": 2660,
                                   "wires": []
                               },
                               {
                                   "id": "1c12b45aa6c4adca",
                                   "type": "junction",
                                   "z": "385f4b8d434f6005",
                                   "x": 280,
                                   "y": 2620,
                                   "wires": [
                                       [
                                           "9bc9a74d1f455065",
                                           "9c99b46399646127"
                                       ]
                                   ]
                               }
                            ]
                            

                            G Offline
                            G Offline
                            Garf
                            schrieb am zuletzt editiert von
                            #22

                            @mickym

                            Ich schon wieder. Heute wieder eine neue Herausforderung. Und wieder der buffer parser, der mich zur Verzweiflung bringt.
                            Jetzt gilt es die signed Integerwerte an den Regler zu senden. Also erst einmal wieder die Werte vom Regler in drei Modbusregister schreiben lassen.
                            0 = 0
                            1 = 1
                            -1 = 65535

                            Gut die ersten beiden Zahlen soweit kein Problem. Bei der -1 geht das Gedöns wieder los. Kriege es mit dem buffer parser wieder nicht hin. Rechne ich mit der Formel von Steve und fasse die Werte aus dem Buffer Maker zusamen, kommt der Wert 65535 raus.

                            265b3e8f-2121-41ad-adac-9e8b2d88975f-grafik.png

                            5cc0020c-af6d-465b-9bde-24524fbda848-grafik.png

                            479a7f66-3221-4b7c-9d61-9dd7483c2805-grafik.png

                            Klar jetzt könnte man aus der -1 einfach eine 2 machen und schon hätte man die Aufgabe elegant umgangen. Aber einfach kann jeder. Außerdem so lernt man ja nichts.

                            Ich bin schon wieder auf deine Antwort gespannt. Vielleicht kapiere ich es dann auch irgendwann noch mal.

                            Ach ja, mit den Werten -1, 0, 1 beschreibt der WR seinen Betriebszustand, Ausgeschaltet, Standby, Betrieb.

                            mickymM 1 Antwort Letzte Antwort
                            0
                            • G Garf

                              @mickym

                              Ich schon wieder. Heute wieder eine neue Herausforderung. Und wieder der buffer parser, der mich zur Verzweiflung bringt.
                              Jetzt gilt es die signed Integerwerte an den Regler zu senden. Also erst einmal wieder die Werte vom Regler in drei Modbusregister schreiben lassen.
                              0 = 0
                              1 = 1
                              -1 = 65535

                              Gut die ersten beiden Zahlen soweit kein Problem. Bei der -1 geht das Gedöns wieder los. Kriege es mit dem buffer parser wieder nicht hin. Rechne ich mit der Formel von Steve und fasse die Werte aus dem Buffer Maker zusamen, kommt der Wert 65535 raus.

                              265b3e8f-2121-41ad-adac-9e8b2d88975f-grafik.png

                              5cc0020c-af6d-465b-9bde-24524fbda848-grafik.png

                              479a7f66-3221-4b7c-9d61-9dd7483c2805-grafik.png

                              Klar jetzt könnte man aus der -1 einfach eine 2 machen und schon hätte man die Aufgabe elegant umgangen. Aber einfach kann jeder. Außerdem so lernt man ja nichts.

                              Ich bin schon wieder auf deine Antwort gespannt. Vielleicht kapiere ich es dann auch irgendwann noch mal.

                              Ach ja, mit den Werten -1, 0, 1 beschreibt der WR seinen Betriebszustand, Ausgeschaltet, Standby, Betrieb.

                              mickymM Online
                              mickymM Online
                              mickym
                              Most Active
                              schrieb am zuletzt editiert von mickym
                              #23

                              @garf Hier kann ich 2 Anmerkungen machen.

                              1. Wenn Du bereits Integer hast, kannst Du der Parser-Node einfach ein signed Integer-Array übergeben und musst nicht über den Umweg eines Buffers gehen (mit Einzelbytes).

                              Siehst Du in der Hilfe zur Parser Node:

                              72e1e674-1a6c-4f51-9db1-eccf589eda20-image.png

                              Das heißt bei signed Integer musst Du nicht über den Buffer Maker gehen. Du musst Deinen signed Integer nur in ein Array packen.

                              8910b267-8a72-4052-a615-907262a3350b-image.png

                              Das ist der untere Weg.

                              Für Dein Modbus Array - gibst Du IMMER - egal ob Du einen Buffer hast oder eine 16bint Integer-Array hast - einen unsigned 16bit Integer aus bzw. ein Array von unsigned 16bit Integers.

                              1. Wenn Du keinen signed Integer hast, dann musst Du erst über einen Buffer gehen (hier ist es optional). Und hier (und nicht im Parser) gibst Du vor ,wie die Eingabe zu interpretieren ist.
                                Sprich hier gibst Du ein, dass die Eingabe als signed 16 Bit Integer ist.

                              9ddd0e4d-d57a-4b2e-9da6-f604946c0408-image.png


                              Sprich Deine Modbus-Register (Array) werden IMMER mit UNISIGNED 16 Bit Integer beschrieben. Das gilt für 1 und 2.

                              Da der BufferParser grundsätzlich mit Int16 gefüttert werden kann, musst bei der Rückkonvertierung Du dann nur wieder angeben, wie diese unsigned Modbus Integers zu interpretieren sind.

                              [
                                 {
                                     "id": "89afe07090940215",
                                     "type": "inject",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "props": [
                                         {
                                             "p": "payload"
                                         }
                                     ],
                                     "repeat": "",
                                     "crontab": "",
                                     "once": false,
                                     "onceDelay": 0.1,
                                     "topic": "",
                                     "payload": "1",
                                     "payloadType": "num",
                                     "x": 190,
                                     "y": 3760,
                                     "wires": [
                                         [
                                             "a1295e30a331a22d"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "6428a78309e813d1",
                                     "type": "inject",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "props": [
                                         {
                                             "p": "payload"
                                         }
                                     ],
                                     "repeat": "",
                                     "crontab": "",
                                     "once": false,
                                     "onceDelay": 0.1,
                                     "topic": "",
                                     "payload": "0",
                                     "payloadType": "num",
                                     "x": 190,
                                     "y": 3800,
                                     "wires": [
                                         [
                                             "a1295e30a331a22d"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "4361c6fff1762f7e",
                                     "type": "inject",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "props": [
                                         {
                                             "p": "payload"
                                         }
                                     ],
                                     "repeat": "",
                                     "crontab": "",
                                     "once": false,
                                     "onceDelay": 0.1,
                                     "topic": "",
                                     "payload": "-1",
                                     "payloadType": "num",
                                     "x": 190,
                                     "y": 3840,
                                     "wires": [
                                         [
                                             "a1295e30a331a22d"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "7d908abdaa064e7f",
                                     "type": "buffer-parser",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "data": "payload",
                                     "dataType": "msg",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "type": "uint16be",
                                             "name": "item1",
                                             "offset": 0,
                                             "length": 1,
                                             "offsetbit": 0,
                                             "scale": "1",
                                             "mask": ""
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "resultType": "value",
                                     "resultTypeType": "return",
                                     "multipleResult": false,
                                     "fanOutMultipleResult": false,
                                     "setTopic": true,
                                     "outputs": 1,
                                     "x": 690,
                                     "y": 3760,
                                     "wires": [
                                         [
                                             "d873a81aa9cad9b5",
                                             "fda789d44003c305"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "8d7bb8c0118236d3",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "Buffer - Bytes",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 640,
                                     "y": 3700,
                                     "wires": []
                                 },
                                 {
                                     "id": "d873a81aa9cad9b5",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "Modbus Array",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 900,
                                     "y": 3760,
                                     "wires": []
                                 },
                                 {
                                     "id": "fdca5ae4d2a60dab",
                                     "type": "buffer-maker",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "name": "item1",
                                             "type": "int16be",
                                             "length": 1,
                                             "dataType": "msg",
                                             "data": "payload"
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "x": 430,
                                     "y": 3760,
                                     "wires": [
                                         [
                                             "8d7bb8c0118236d3",
                                             "7d908abdaa064e7f"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "abe958f5c004a703",
                                     "type": "change",
                                     "z": "385f4b8d434f6005",
                                     "name": "integer Array",
                                     "rules": [
                                         {
                                             "t": "set",
                                             "p": "payload",
                                             "pt": "msg",
                                             "to": "[payload]",
                                             "tot": "jsonata"
                                         }
                                     ],
                                     "action": "",
                                     "property": "",
                                     "from": "",
                                     "to": "",
                                     "reg": false,
                                     "x": 410,
                                     "y": 3820,
                                     "wires": [
                                         [
                                             "786c6ec3bee5b1a5",
                                             "7d908abdaa064e7f"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "786c6ec3bee5b1a5",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "Integer Array",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 650,
                                     "y": 3860,
                                     "wires": []
                                 },
                                 {
                                     "id": "fda789d44003c305",
                                     "type": "buffer-parser",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "data": "payload",
                                     "dataType": "msg",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "type": "int16be",
                                             "name": "item1",
                                             "offset": 0,
                                             "length": 1,
                                             "offsetbit": 0,
                                             "scale": "1",
                                             "mask": ""
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "resultType": "value",
                                     "resultTypeType": "return",
                                     "multipleResult": true,
                                     "fanOutMultipleResult": false,
                                     "setTopic": true,
                                     "outputs": 1,
                                     "x": 890,
                                     "y": 3820,
                                     "wires": [
                                         [
                                             "3a36bcb61c95bba4"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "3a36bcb61c95bba4",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "Rückkonvertierung",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 1110,
                                     "y": 3820,
                                     "wires": []
                                 },
                                 {
                                     "id": "a1295e30a331a22d",
                                     "type": "junction",
                                     "z": "385f4b8d434f6005",
                                     "x": 300,
                                     "y": 3800,
                                     "wires": [
                                         [
                                             "fdca5ae4d2a60dab",
                                             "abe958f5c004a703"
                                         ]
                                     ]
                                 }
                              ]
                              


                              Zum Verständnis - wie ein Computer negative Werte abbildet. Es wird das erste Bit auf 1 (bzw das Bit 7 - du zählst ja von rechts nach links) gesetzt und dann die restlichen Bits (umgedreht).

                              9a923db6-523b-45bb-a1dc-3fc1378e59ca-image.png

                              b15f6b8c-62fc-4574-a52b-713b30ec7862-image.png

                              [
                                 {
                                     "id": "65392663801b7347",
                                     "type": "inject",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "props": [
                                         {
                                             "p": "payload"
                                         }
                                     ],
                                     "repeat": "",
                                     "crontab": "",
                                     "once": false,
                                     "onceDelay": 0.1,
                                     "topic": "",
                                     "payload": "-2",
                                     "payloadType": "num",
                                     "x": 190,
                                     "y": 2420,
                                     "wires": [
                                         [
                                             "e1b02064d9fdd3a2"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "652134c61c9e5717",
                                     "type": "buffer-maker",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "name": "item1",
                                             "type": "int8",
                                             "length": 1,
                                             "dataType": "msg",
                                             "data": "payload"
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "x": 390,
                                     "y": 2420,
                                     "wires": [
                                         [
                                             "95bd1a00f43c3a41",
                                             "1f0f6998b2fe22bd"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "95bd1a00f43c3a41",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "buffer maker",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 570,
                                     "y": 2380,
                                     "wires": []
                                 },
                                 {
                                     "id": "1f0f6998b2fe22bd",
                                     "type": "buffer-parser",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "data": "payload",
                                     "dataType": "msg",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "type": "8bit",
                                             "name": "item1",
                                             "offset": 0,
                                             "length": 1,
                                             "offsetbit": 0,
                                             "scale": "1",
                                             "mask": ""
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "resultType": "value",
                                     "resultTypeType": "return",
                                     "multipleResult": false,
                                     "fanOutMultipleResult": false,
                                     "setTopic": true,
                                     "outputs": 1,
                                     "x": 570,
                                     "y": 2420,
                                     "wires": [
                                         [
                                             "0d6994be085f2354",
                                             "e2ed4381ba501491"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "0d6994be085f2354",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "buffer parser",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 750,
                                     "y": 2420,
                                     "wires": []
                                 },
                                 {
                                     "id": "abae5fcc0b245338",
                                     "type": "inject",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "props": [
                                         {
                                             "p": "payload"
                                         }
                                     ],
                                     "repeat": "",
                                     "crontab": "",
                                     "once": false,
                                     "onceDelay": 0.1,
                                     "topic": "",
                                     "payload": "-3",
                                     "payloadType": "num",
                                     "x": 190,
                                     "y": 2460,
                                     "wires": [
                                         [
                                             "e1b02064d9fdd3a2"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "e2ed4381ba501491",
                                     "type": "change",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "rules": [
                                         {
                                             "t": "set",
                                             "p": "payload",
                                             "pt": "msg",
                                             "to": "[[payload[0][0].bits]]",
                                             "tot": "jsonata"
                                         }
                                     ],
                                     "action": "",
                                     "property": "",
                                     "from": "",
                                     "to": "",
                                     "reg": false,
                                     "x": 695,
                                     "y": 2480,
                                     "wires": [
                                         [
                                             "5574ff5ac8d119b9",
                                             "10d57305e25d5ffb"
                                         ]
                                     ],
                                     "l": false
                                 },
                                 {
                                     "id": "10d57305e25d5ffb",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "8bit Array",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 840,
                                     "y": 2460,
                                     "wires": []
                                 },
                                 {
                                     "id": "5574ff5ac8d119b9",
                                     "type": "buffer-maker",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "name": "item1",
                                             "type": "8bit",
                                             "length": 1,
                                             "dataType": "msg",
                                             "data": "payload"
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "x": 850,
                                     "y": 2500,
                                     "wires": [
                                         [
                                             "a8bc2f0c740651b7",
                                             "bc288c3fca11aefa"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "a8bc2f0c740651b7",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "buffer maker 2",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 1040,
                                     "y": 2460,
                                     "wires": []
                                 },
                                 {
                                     "id": "bc288c3fca11aefa",
                                     "type": "buffer-parser",
                                     "z": "385f4b8d434f6005",
                                     "name": "",
                                     "data": "payload",
                                     "dataType": "msg",
                                     "specification": "spec",
                                     "specificationType": "ui",
                                     "items": [
                                         {
                                             "type": "int8",
                                             "name": "item1",
                                             "offset": 0,
                                             "length": 1,
                                             "offsetbit": 0,
                                             "scale": "1",
                                             "mask": ""
                                         }
                                     ],
                                     "swap1": "",
                                     "swap2": "",
                                     "swap3": "",
                                     "swap1Type": "swap",
                                     "swap2Type": "swap",
                                     "swap3Type": "swap",
                                     "msgProperty": "payload",
                                     "msgPropertyType": "str",
                                     "resultType": "value",
                                     "resultTypeType": "return",
                                     "multipleResult": true,
                                     "fanOutMultipleResult": false,
                                     "setTopic": false,
                                     "outputs": 1,
                                     "x": 1030,
                                     "y": 2500,
                                     "wires": [
                                         [
                                             "177efcba05d60d49"
                                         ]
                                     ]
                                 },
                                 {
                                     "id": "177efcba05d60d49",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "buffer parser 2",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 1220,
                                     "y": 2500,
                                     "wires": []
                                 },
                                 {
                                     "id": "21fe0484881084c7",
                                     "type": "debug",
                                     "z": "385f4b8d434f6005",
                                     "name": "int 8 - Eíngabe",
                                     "active": true,
                                     "tosidebar": true,
                                     "console": false,
                                     "tostatus": false,
                                     "complete": "payload",
                                     "targetType": "msg",
                                     "statusVal": "",
                                     "statusType": "auto",
                                     "x": 400,
                                     "y": 2480,
                                     "wires": []
                                 },
                                 {
                                     "id": "39d7dcbddba73a69",
                                     "type": "comment",
                                     "z": "385f4b8d434f6005",
                                     "name": "int8 in bits and vice versa",
                                     "info": "",
                                     "x": 250,
                                     "y": 2320,
                                     "wires": []
                                 },
                                 {
                                     "id": "e1b02064d9fdd3a2",
                                     "type": "junction",
                                     "z": "385f4b8d434f6005",
                                     "x": 280,
                                     "y": 2440,
                                     "wires": [
                                         [
                                             "652134c61c9e5717",
                                             "21fe0484881084c7"
                                         ]
                                     ]
                                 }
                              ]
                              

                              Ich hoffe ich konnte etwas zur Klarstellung beitragen.

                              Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                              G 2 Antworten Letzte Antwort
                              1
                              • mickymM mickym

                                @garf Hier kann ich 2 Anmerkungen machen.

                                1. Wenn Du bereits Integer hast, kannst Du der Parser-Node einfach ein signed Integer-Array übergeben und musst nicht über den Umweg eines Buffers gehen (mit Einzelbytes).

                                Siehst Du in der Hilfe zur Parser Node:

                                72e1e674-1a6c-4f51-9db1-eccf589eda20-image.png

                                Das heißt bei signed Integer musst Du nicht über den Buffer Maker gehen. Du musst Deinen signed Integer nur in ein Array packen.

                                8910b267-8a72-4052-a615-907262a3350b-image.png

                                Das ist der untere Weg.

                                Für Dein Modbus Array - gibst Du IMMER - egal ob Du einen Buffer hast oder eine 16bint Integer-Array hast - einen unsigned 16bit Integer aus bzw. ein Array von unsigned 16bit Integers.

                                1. Wenn Du keinen signed Integer hast, dann musst Du erst über einen Buffer gehen (hier ist es optional). Und hier (und nicht im Parser) gibst Du vor ,wie die Eingabe zu interpretieren ist.
                                  Sprich hier gibst Du ein, dass die Eingabe als signed 16 Bit Integer ist.

                                9ddd0e4d-d57a-4b2e-9da6-f604946c0408-image.png


                                Sprich Deine Modbus-Register (Array) werden IMMER mit UNISIGNED 16 Bit Integer beschrieben. Das gilt für 1 und 2.

                                Da der BufferParser grundsätzlich mit Int16 gefüttert werden kann, musst bei der Rückkonvertierung Du dann nur wieder angeben, wie diese unsigned Modbus Integers zu interpretieren sind.

                                [
                                   {
                                       "id": "89afe07090940215",
                                       "type": "inject",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "props": [
                                           {
                                               "p": "payload"
                                           }
                                       ],
                                       "repeat": "",
                                       "crontab": "",
                                       "once": false,
                                       "onceDelay": 0.1,
                                       "topic": "",
                                       "payload": "1",
                                       "payloadType": "num",
                                       "x": 190,
                                       "y": 3760,
                                       "wires": [
                                           [
                                               "a1295e30a331a22d"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "6428a78309e813d1",
                                       "type": "inject",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "props": [
                                           {
                                               "p": "payload"
                                           }
                                       ],
                                       "repeat": "",
                                       "crontab": "",
                                       "once": false,
                                       "onceDelay": 0.1,
                                       "topic": "",
                                       "payload": "0",
                                       "payloadType": "num",
                                       "x": 190,
                                       "y": 3800,
                                       "wires": [
                                           [
                                               "a1295e30a331a22d"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "4361c6fff1762f7e",
                                       "type": "inject",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "props": [
                                           {
                                               "p": "payload"
                                           }
                                       ],
                                       "repeat": "",
                                       "crontab": "",
                                       "once": false,
                                       "onceDelay": 0.1,
                                       "topic": "",
                                       "payload": "-1",
                                       "payloadType": "num",
                                       "x": 190,
                                       "y": 3840,
                                       "wires": [
                                           [
                                               "a1295e30a331a22d"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "7d908abdaa064e7f",
                                       "type": "buffer-parser",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "data": "payload",
                                       "dataType": "msg",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "type": "uint16be",
                                               "name": "item1",
                                               "offset": 0,
                                               "length": 1,
                                               "offsetbit": 0,
                                               "scale": "1",
                                               "mask": ""
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "resultType": "value",
                                       "resultTypeType": "return",
                                       "multipleResult": false,
                                       "fanOutMultipleResult": false,
                                       "setTopic": true,
                                       "outputs": 1,
                                       "x": 690,
                                       "y": 3760,
                                       "wires": [
                                           [
                                               "d873a81aa9cad9b5",
                                               "fda789d44003c305"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "8d7bb8c0118236d3",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "Buffer - Bytes",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 640,
                                       "y": 3700,
                                       "wires": []
                                   },
                                   {
                                       "id": "d873a81aa9cad9b5",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "Modbus Array",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 900,
                                       "y": 3760,
                                       "wires": []
                                   },
                                   {
                                       "id": "fdca5ae4d2a60dab",
                                       "type": "buffer-maker",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "name": "item1",
                                               "type": "int16be",
                                               "length": 1,
                                               "dataType": "msg",
                                               "data": "payload"
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "x": 430,
                                       "y": 3760,
                                       "wires": [
                                           [
                                               "8d7bb8c0118236d3",
                                               "7d908abdaa064e7f"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "abe958f5c004a703",
                                       "type": "change",
                                       "z": "385f4b8d434f6005",
                                       "name": "integer Array",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "payload",
                                               "pt": "msg",
                                               "to": "[payload]",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 410,
                                       "y": 3820,
                                       "wires": [
                                           [
                                               "786c6ec3bee5b1a5",
                                               "7d908abdaa064e7f"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "786c6ec3bee5b1a5",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "Integer Array",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 650,
                                       "y": 3860,
                                       "wires": []
                                   },
                                   {
                                       "id": "fda789d44003c305",
                                       "type": "buffer-parser",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "data": "payload",
                                       "dataType": "msg",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "type": "int16be",
                                               "name": "item1",
                                               "offset": 0,
                                               "length": 1,
                                               "offsetbit": 0,
                                               "scale": "1",
                                               "mask": ""
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "resultType": "value",
                                       "resultTypeType": "return",
                                       "multipleResult": true,
                                       "fanOutMultipleResult": false,
                                       "setTopic": true,
                                       "outputs": 1,
                                       "x": 890,
                                       "y": 3820,
                                       "wires": [
                                           [
                                               "3a36bcb61c95bba4"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "3a36bcb61c95bba4",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "Rückkonvertierung",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 1110,
                                       "y": 3820,
                                       "wires": []
                                   },
                                   {
                                       "id": "a1295e30a331a22d",
                                       "type": "junction",
                                       "z": "385f4b8d434f6005",
                                       "x": 300,
                                       "y": 3800,
                                       "wires": [
                                           [
                                               "fdca5ae4d2a60dab",
                                               "abe958f5c004a703"
                                           ]
                                       ]
                                   }
                                ]
                                


                                Zum Verständnis - wie ein Computer negative Werte abbildet. Es wird das erste Bit auf 1 (bzw das Bit 7 - du zählst ja von rechts nach links) gesetzt und dann die restlichen Bits (umgedreht).

                                9a923db6-523b-45bb-a1dc-3fc1378e59ca-image.png

                                b15f6b8c-62fc-4574-a52b-713b30ec7862-image.png

                                [
                                   {
                                       "id": "65392663801b7347",
                                       "type": "inject",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "props": [
                                           {
                                               "p": "payload"
                                           }
                                       ],
                                       "repeat": "",
                                       "crontab": "",
                                       "once": false,
                                       "onceDelay": 0.1,
                                       "topic": "",
                                       "payload": "-2",
                                       "payloadType": "num",
                                       "x": 190,
                                       "y": 2420,
                                       "wires": [
                                           [
                                               "e1b02064d9fdd3a2"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "652134c61c9e5717",
                                       "type": "buffer-maker",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "name": "item1",
                                               "type": "int8",
                                               "length": 1,
                                               "dataType": "msg",
                                               "data": "payload"
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "x": 390,
                                       "y": 2420,
                                       "wires": [
                                           [
                                               "95bd1a00f43c3a41",
                                               "1f0f6998b2fe22bd"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "95bd1a00f43c3a41",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "buffer maker",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 570,
                                       "y": 2380,
                                       "wires": []
                                   },
                                   {
                                       "id": "1f0f6998b2fe22bd",
                                       "type": "buffer-parser",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "data": "payload",
                                       "dataType": "msg",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "type": "8bit",
                                               "name": "item1",
                                               "offset": 0,
                                               "length": 1,
                                               "offsetbit": 0,
                                               "scale": "1",
                                               "mask": ""
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "resultType": "value",
                                       "resultTypeType": "return",
                                       "multipleResult": false,
                                       "fanOutMultipleResult": false,
                                       "setTopic": true,
                                       "outputs": 1,
                                       "x": 570,
                                       "y": 2420,
                                       "wires": [
                                           [
                                               "0d6994be085f2354",
                                               "e2ed4381ba501491"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "0d6994be085f2354",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "buffer parser",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 750,
                                       "y": 2420,
                                       "wires": []
                                   },
                                   {
                                       "id": "abae5fcc0b245338",
                                       "type": "inject",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "props": [
                                           {
                                               "p": "payload"
                                           }
                                       ],
                                       "repeat": "",
                                       "crontab": "",
                                       "once": false,
                                       "onceDelay": 0.1,
                                       "topic": "",
                                       "payload": "-3",
                                       "payloadType": "num",
                                       "x": 190,
                                       "y": 2460,
                                       "wires": [
                                           [
                                               "e1b02064d9fdd3a2"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "e2ed4381ba501491",
                                       "type": "change",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "rules": [
                                           {
                                               "t": "set",
                                               "p": "payload",
                                               "pt": "msg",
                                               "to": "[[payload[0][0].bits]]",
                                               "tot": "jsonata"
                                           }
                                       ],
                                       "action": "",
                                       "property": "",
                                       "from": "",
                                       "to": "",
                                       "reg": false,
                                       "x": 695,
                                       "y": 2480,
                                       "wires": [
                                           [
                                               "5574ff5ac8d119b9",
                                               "10d57305e25d5ffb"
                                           ]
                                       ],
                                       "l": false
                                   },
                                   {
                                       "id": "10d57305e25d5ffb",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "8bit Array",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 840,
                                       "y": 2460,
                                       "wires": []
                                   },
                                   {
                                       "id": "5574ff5ac8d119b9",
                                       "type": "buffer-maker",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "name": "item1",
                                               "type": "8bit",
                                               "length": 1,
                                               "dataType": "msg",
                                               "data": "payload"
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "x": 850,
                                       "y": 2500,
                                       "wires": [
                                           [
                                               "a8bc2f0c740651b7",
                                               "bc288c3fca11aefa"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "a8bc2f0c740651b7",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "buffer maker 2",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 1040,
                                       "y": 2460,
                                       "wires": []
                                   },
                                   {
                                       "id": "bc288c3fca11aefa",
                                       "type": "buffer-parser",
                                       "z": "385f4b8d434f6005",
                                       "name": "",
                                       "data": "payload",
                                       "dataType": "msg",
                                       "specification": "spec",
                                       "specificationType": "ui",
                                       "items": [
                                           {
                                               "type": "int8",
                                               "name": "item1",
                                               "offset": 0,
                                               "length": 1,
                                               "offsetbit": 0,
                                               "scale": "1",
                                               "mask": ""
                                           }
                                       ],
                                       "swap1": "",
                                       "swap2": "",
                                       "swap3": "",
                                       "swap1Type": "swap",
                                       "swap2Type": "swap",
                                       "swap3Type": "swap",
                                       "msgProperty": "payload",
                                       "msgPropertyType": "str",
                                       "resultType": "value",
                                       "resultTypeType": "return",
                                       "multipleResult": true,
                                       "fanOutMultipleResult": false,
                                       "setTopic": false,
                                       "outputs": 1,
                                       "x": 1030,
                                       "y": 2500,
                                       "wires": [
                                           [
                                               "177efcba05d60d49"
                                           ]
                                       ]
                                   },
                                   {
                                       "id": "177efcba05d60d49",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "buffer parser 2",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 1220,
                                       "y": 2500,
                                       "wires": []
                                   },
                                   {
                                       "id": "21fe0484881084c7",
                                       "type": "debug",
                                       "z": "385f4b8d434f6005",
                                       "name": "int 8 - Eíngabe",
                                       "active": true,
                                       "tosidebar": true,
                                       "console": false,
                                       "tostatus": false,
                                       "complete": "payload",
                                       "targetType": "msg",
                                       "statusVal": "",
                                       "statusType": "auto",
                                       "x": 400,
                                       "y": 2480,
                                       "wires": []
                                   },
                                   {
                                       "id": "39d7dcbddba73a69",
                                       "type": "comment",
                                       "z": "385f4b8d434f6005",
                                       "name": "int8 in bits and vice versa",
                                       "info": "",
                                       "x": 250,
                                       "y": 2320,
                                       "wires": []
                                   },
                                   {
                                       "id": "e1b02064d9fdd3a2",
                                       "type": "junction",
                                       "z": "385f4b8d434f6005",
                                       "x": 280,
                                       "y": 2440,
                                       "wires": [
                                           [
                                               "652134c61c9e5717",
                                               "21fe0484881084c7"
                                           ]
                                       ]
                                   }
                                ]
                                

                                Ich hoffe ich konnte etwas zur Klarstellung beitragen.

                                G Offline
                                G Offline
                                Garf
                                schrieb am zuletzt editiert von
                                #24

                                @mickym sagte in Node Red Modbus:

                                Ich hoffe ich konnte etwas zur Klarstellung beitragen.

                                Ja konntest Du. Danke dafür. War wieder viel Neues dabei. Lohnt sich mit der Materie auseinander zu setzen, statt sich vorbei zu mogeln.

                                Danke nochmals.

                                1 Antwort Letzte Antwort
                                0
                                • mickymM mickym

                                  @garf Hier kann ich 2 Anmerkungen machen.

                                  1. Wenn Du bereits Integer hast, kannst Du der Parser-Node einfach ein signed Integer-Array übergeben und musst nicht über den Umweg eines Buffers gehen (mit Einzelbytes).

                                  Siehst Du in der Hilfe zur Parser Node:

                                  72e1e674-1a6c-4f51-9db1-eccf589eda20-image.png

                                  Das heißt bei signed Integer musst Du nicht über den Buffer Maker gehen. Du musst Deinen signed Integer nur in ein Array packen.

                                  8910b267-8a72-4052-a615-907262a3350b-image.png

                                  Das ist der untere Weg.

                                  Für Dein Modbus Array - gibst Du IMMER - egal ob Du einen Buffer hast oder eine 16bint Integer-Array hast - einen unsigned 16bit Integer aus bzw. ein Array von unsigned 16bit Integers.

                                  1. Wenn Du keinen signed Integer hast, dann musst Du erst über einen Buffer gehen (hier ist es optional). Und hier (und nicht im Parser) gibst Du vor ,wie die Eingabe zu interpretieren ist.
                                    Sprich hier gibst Du ein, dass die Eingabe als signed 16 Bit Integer ist.

                                  9ddd0e4d-d57a-4b2e-9da6-f604946c0408-image.png


                                  Sprich Deine Modbus-Register (Array) werden IMMER mit UNISIGNED 16 Bit Integer beschrieben. Das gilt für 1 und 2.

                                  Da der BufferParser grundsätzlich mit Int16 gefüttert werden kann, musst bei der Rückkonvertierung Du dann nur wieder angeben, wie diese unsigned Modbus Integers zu interpretieren sind.

                                  [
                                     {
                                         "id": "89afe07090940215",
                                         "type": "inject",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "props": [
                                             {
                                                 "p": "payload"
                                             }
                                         ],
                                         "repeat": "",
                                         "crontab": "",
                                         "once": false,
                                         "onceDelay": 0.1,
                                         "topic": "",
                                         "payload": "1",
                                         "payloadType": "num",
                                         "x": 190,
                                         "y": 3760,
                                         "wires": [
                                             [
                                                 "a1295e30a331a22d"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "6428a78309e813d1",
                                         "type": "inject",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "props": [
                                             {
                                                 "p": "payload"
                                             }
                                         ],
                                         "repeat": "",
                                         "crontab": "",
                                         "once": false,
                                         "onceDelay": 0.1,
                                         "topic": "",
                                         "payload": "0",
                                         "payloadType": "num",
                                         "x": 190,
                                         "y": 3800,
                                         "wires": [
                                             [
                                                 "a1295e30a331a22d"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "4361c6fff1762f7e",
                                         "type": "inject",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "props": [
                                             {
                                                 "p": "payload"
                                             }
                                         ],
                                         "repeat": "",
                                         "crontab": "",
                                         "once": false,
                                         "onceDelay": 0.1,
                                         "topic": "",
                                         "payload": "-1",
                                         "payloadType": "num",
                                         "x": 190,
                                         "y": 3840,
                                         "wires": [
                                             [
                                                 "a1295e30a331a22d"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "7d908abdaa064e7f",
                                         "type": "buffer-parser",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "data": "payload",
                                         "dataType": "msg",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "type": "uint16be",
                                                 "name": "item1",
                                                 "offset": 0,
                                                 "length": 1,
                                                 "offsetbit": 0,
                                                 "scale": "1",
                                                 "mask": ""
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "resultType": "value",
                                         "resultTypeType": "return",
                                         "multipleResult": false,
                                         "fanOutMultipleResult": false,
                                         "setTopic": true,
                                         "outputs": 1,
                                         "x": 690,
                                         "y": 3760,
                                         "wires": [
                                             [
                                                 "d873a81aa9cad9b5",
                                                 "fda789d44003c305"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "8d7bb8c0118236d3",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "Buffer - Bytes",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 640,
                                         "y": 3700,
                                         "wires": []
                                     },
                                     {
                                         "id": "d873a81aa9cad9b5",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "Modbus Array",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 900,
                                         "y": 3760,
                                         "wires": []
                                     },
                                     {
                                         "id": "fdca5ae4d2a60dab",
                                         "type": "buffer-maker",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "name": "item1",
                                                 "type": "int16be",
                                                 "length": 1,
                                                 "dataType": "msg",
                                                 "data": "payload"
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "x": 430,
                                         "y": 3760,
                                         "wires": [
                                             [
                                                 "8d7bb8c0118236d3",
                                                 "7d908abdaa064e7f"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "abe958f5c004a703",
                                         "type": "change",
                                         "z": "385f4b8d434f6005",
                                         "name": "integer Array",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "payload",
                                                 "pt": "msg",
                                                 "to": "[payload]",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 410,
                                         "y": 3820,
                                         "wires": [
                                             [
                                                 "786c6ec3bee5b1a5",
                                                 "7d908abdaa064e7f"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "786c6ec3bee5b1a5",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "Integer Array",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 650,
                                         "y": 3860,
                                         "wires": []
                                     },
                                     {
                                         "id": "fda789d44003c305",
                                         "type": "buffer-parser",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "data": "payload",
                                         "dataType": "msg",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "type": "int16be",
                                                 "name": "item1",
                                                 "offset": 0,
                                                 "length": 1,
                                                 "offsetbit": 0,
                                                 "scale": "1",
                                                 "mask": ""
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "resultType": "value",
                                         "resultTypeType": "return",
                                         "multipleResult": true,
                                         "fanOutMultipleResult": false,
                                         "setTopic": true,
                                         "outputs": 1,
                                         "x": 890,
                                         "y": 3820,
                                         "wires": [
                                             [
                                                 "3a36bcb61c95bba4"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "3a36bcb61c95bba4",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "Rückkonvertierung",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 1110,
                                         "y": 3820,
                                         "wires": []
                                     },
                                     {
                                         "id": "a1295e30a331a22d",
                                         "type": "junction",
                                         "z": "385f4b8d434f6005",
                                         "x": 300,
                                         "y": 3800,
                                         "wires": [
                                             [
                                                 "fdca5ae4d2a60dab",
                                                 "abe958f5c004a703"
                                             ]
                                         ]
                                     }
                                  ]
                                  


                                  Zum Verständnis - wie ein Computer negative Werte abbildet. Es wird das erste Bit auf 1 (bzw das Bit 7 - du zählst ja von rechts nach links) gesetzt und dann die restlichen Bits (umgedreht).

                                  9a923db6-523b-45bb-a1dc-3fc1378e59ca-image.png

                                  b15f6b8c-62fc-4574-a52b-713b30ec7862-image.png

                                  [
                                     {
                                         "id": "65392663801b7347",
                                         "type": "inject",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "props": [
                                             {
                                                 "p": "payload"
                                             }
                                         ],
                                         "repeat": "",
                                         "crontab": "",
                                         "once": false,
                                         "onceDelay": 0.1,
                                         "topic": "",
                                         "payload": "-2",
                                         "payloadType": "num",
                                         "x": 190,
                                         "y": 2420,
                                         "wires": [
                                             [
                                                 "e1b02064d9fdd3a2"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "652134c61c9e5717",
                                         "type": "buffer-maker",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "name": "item1",
                                                 "type": "int8",
                                                 "length": 1,
                                                 "dataType": "msg",
                                                 "data": "payload"
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "x": 390,
                                         "y": 2420,
                                         "wires": [
                                             [
                                                 "95bd1a00f43c3a41",
                                                 "1f0f6998b2fe22bd"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "95bd1a00f43c3a41",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "buffer maker",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 570,
                                         "y": 2380,
                                         "wires": []
                                     },
                                     {
                                         "id": "1f0f6998b2fe22bd",
                                         "type": "buffer-parser",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "data": "payload",
                                         "dataType": "msg",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "type": "8bit",
                                                 "name": "item1",
                                                 "offset": 0,
                                                 "length": 1,
                                                 "offsetbit": 0,
                                                 "scale": "1",
                                                 "mask": ""
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "resultType": "value",
                                         "resultTypeType": "return",
                                         "multipleResult": false,
                                         "fanOutMultipleResult": false,
                                         "setTopic": true,
                                         "outputs": 1,
                                         "x": 570,
                                         "y": 2420,
                                         "wires": [
                                             [
                                                 "0d6994be085f2354",
                                                 "e2ed4381ba501491"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "0d6994be085f2354",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "buffer parser",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 750,
                                         "y": 2420,
                                         "wires": []
                                     },
                                     {
                                         "id": "abae5fcc0b245338",
                                         "type": "inject",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "props": [
                                             {
                                                 "p": "payload"
                                             }
                                         ],
                                         "repeat": "",
                                         "crontab": "",
                                         "once": false,
                                         "onceDelay": 0.1,
                                         "topic": "",
                                         "payload": "-3",
                                         "payloadType": "num",
                                         "x": 190,
                                         "y": 2460,
                                         "wires": [
                                             [
                                                 "e1b02064d9fdd3a2"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "e2ed4381ba501491",
                                         "type": "change",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "rules": [
                                             {
                                                 "t": "set",
                                                 "p": "payload",
                                                 "pt": "msg",
                                                 "to": "[[payload[0][0].bits]]",
                                                 "tot": "jsonata"
                                             }
                                         ],
                                         "action": "",
                                         "property": "",
                                         "from": "",
                                         "to": "",
                                         "reg": false,
                                         "x": 695,
                                         "y": 2480,
                                         "wires": [
                                             [
                                                 "5574ff5ac8d119b9",
                                                 "10d57305e25d5ffb"
                                             ]
                                         ],
                                         "l": false
                                     },
                                     {
                                         "id": "10d57305e25d5ffb",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "8bit Array",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 840,
                                         "y": 2460,
                                         "wires": []
                                     },
                                     {
                                         "id": "5574ff5ac8d119b9",
                                         "type": "buffer-maker",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "name": "item1",
                                                 "type": "8bit",
                                                 "length": 1,
                                                 "dataType": "msg",
                                                 "data": "payload"
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "x": 850,
                                         "y": 2500,
                                         "wires": [
                                             [
                                                 "a8bc2f0c740651b7",
                                                 "bc288c3fca11aefa"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "a8bc2f0c740651b7",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "buffer maker 2",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 1040,
                                         "y": 2460,
                                         "wires": []
                                     },
                                     {
                                         "id": "bc288c3fca11aefa",
                                         "type": "buffer-parser",
                                         "z": "385f4b8d434f6005",
                                         "name": "",
                                         "data": "payload",
                                         "dataType": "msg",
                                         "specification": "spec",
                                         "specificationType": "ui",
                                         "items": [
                                             {
                                                 "type": "int8",
                                                 "name": "item1",
                                                 "offset": 0,
                                                 "length": 1,
                                                 "offsetbit": 0,
                                                 "scale": "1",
                                                 "mask": ""
                                             }
                                         ],
                                         "swap1": "",
                                         "swap2": "",
                                         "swap3": "",
                                         "swap1Type": "swap",
                                         "swap2Type": "swap",
                                         "swap3Type": "swap",
                                         "msgProperty": "payload",
                                         "msgPropertyType": "str",
                                         "resultType": "value",
                                         "resultTypeType": "return",
                                         "multipleResult": true,
                                         "fanOutMultipleResult": false,
                                         "setTopic": false,
                                         "outputs": 1,
                                         "x": 1030,
                                         "y": 2500,
                                         "wires": [
                                             [
                                                 "177efcba05d60d49"
                                             ]
                                         ]
                                     },
                                     {
                                         "id": "177efcba05d60d49",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "buffer parser 2",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 1220,
                                         "y": 2500,
                                         "wires": []
                                     },
                                     {
                                         "id": "21fe0484881084c7",
                                         "type": "debug",
                                         "z": "385f4b8d434f6005",
                                         "name": "int 8 - Eíngabe",
                                         "active": true,
                                         "tosidebar": true,
                                         "console": false,
                                         "tostatus": false,
                                         "complete": "payload",
                                         "targetType": "msg",
                                         "statusVal": "",
                                         "statusType": "auto",
                                         "x": 400,
                                         "y": 2480,
                                         "wires": []
                                     },
                                     {
                                         "id": "39d7dcbddba73a69",
                                         "type": "comment",
                                         "z": "385f4b8d434f6005",
                                         "name": "int8 in bits and vice versa",
                                         "info": "",
                                         "x": 250,
                                         "y": 2320,
                                         "wires": []
                                     },
                                     {
                                         "id": "e1b02064d9fdd3a2",
                                         "type": "junction",
                                         "z": "385f4b8d434f6005",
                                         "x": 280,
                                         "y": 2440,
                                         "wires": [
                                             [
                                                 "652134c61c9e5717",
                                                 "21fe0484881084c7"
                                             ]
                                         ]
                                     }
                                  ]
                                  

                                  Ich hoffe ich konnte etwas zur Klarstellung beitragen.

                                  G Offline
                                  G Offline
                                  Garf
                                  schrieb am zuletzt editiert von Garf
                                  #25

                                  @mickym
                                  Ich möchte aktuell den SDM630 Stromzähler auslesen. Funktioniert soweit echt gut mit dem BufferParser. Die Ausgabe mit den vielen Nachkommastellen gefallen mir jedoch so ganz und gar nicht. Leider finde ich keine Möglichkeit im BufferParser die Ausgabe direkt auf zwei Nachkommastellen zu begrenzen. Habe ich etwas übersehen, oder nicht richtig verstanden?
                                  Die Ausgabewerte im Nachgang zu bearbeiten wäre natürlich kein Problem.

                                  Vielleicht kennst Du im Parser noch eine direkte Einstellung um die gewünschte Formatierung einzustellen.

                                  db8f6b50-017a-4d29-8fc1-f0af5db7bd45-grafik.png

                                  mickymM 1 Antwort Letzte Antwort
                                  0
                                  • G Garf

                                    @mickym
                                    Ich möchte aktuell den SDM630 Stromzähler auslesen. Funktioniert soweit echt gut mit dem BufferParser. Die Ausgabe mit den vielen Nachkommastellen gefallen mir jedoch so ganz und gar nicht. Leider finde ich keine Möglichkeit im BufferParser die Ausgabe direkt auf zwei Nachkommastellen zu begrenzen. Habe ich etwas übersehen, oder nicht richtig verstanden?
                                    Die Ausgabewerte im Nachgang zu bearbeiten wäre natürlich kein Problem.

                                    Vielleicht kennst Du im Parser noch eine direkte Einstellung um die gewünschte Formatierung einzustellen.

                                    db8f6b50-017a-4d29-8fc1-f0af5db7bd45-grafik.png

                                    mickymM Online
                                    mickymM Online
                                    mickym
                                    Most Active
                                    schrieb am zuletzt editiert von
                                    #26

                                    @garf Nein - bei Floats musst Du zur mathematisch korrekten Rundung die Werte im Nachgang bearbeiten. Also kenn auch keine andere Möglichkeit.

                                    Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                                    1 Antwort Letzte Antwort
                                    1
                                    Antworten
                                    • In einem neuen Thema antworten
                                    Anmelden zum Antworten
                                    • Älteste zuerst
                                    • Neuste zuerst
                                    • Meiste Stimmen


                                    Support us

                                    ioBroker
                                    Community Adapters
                                    Donate

                                    760

                                    Online

                                    32.4k

                                    Benutzer

                                    81.4k

                                    Themen

                                    1.3m

                                    Beiträge
                                    Community
                                    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                    ioBroker Community 2014-2025
                                    logo
                                    • Anmelden

                                    • Du hast noch kein Konto? Registrieren

                                    • Anmelden oder registrieren, um zu suchen
                                    • Erster Beitrag
                                      Letzter Beitrag
                                    0
                                    • Home
                                    • Aktuell
                                    • Tags
                                    • Ungelesen 0
                                    • Kategorien
                                    • Unreplied
                                    • Beliebt
                                    • GitHub
                                    • Docu
                                    • Hilfe