Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. Value in json String umwandeln für victron Venus OS

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Value in json String umwandeln für victron Venus OS

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

      Hallo zusammen,

      ich bin relativ neu in node Red und Versuche gerade irgendwie klarzukommen.
      Ich habe folgendes Problem ich lese aus dem mm IoBroker eine Temperatur aus und möchte sie mittel mqtt weiterschicken. Allerdings benötige ich ein Json

      {"value": 23.700000000000003}
      

      Gegeben habe ich aber nur 23.7

      Folgender Hintergrund ich habe ein victron system und möchte einen nicht kompatiblen Zähler hinzufügen. Also habe ich den dbus mqtt devices
      Treiber installiert.
      Mit dem mqtt Explorer bekomme ich es hin nun wollte ich die Werte mittels node Red übertragen.

      Gruß Nils

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

        @jacke du erstellst setzt eine payload, die so aussieht, wie du oben gepostet hast und wenn Du einen JSON String brauchst, dann hängst du noch eine JSON Node dran.

        Wenn du schon eine payload mit 23.7 hast, dann verschiebst du mit einer Change Node die payload auf payload.value und hängst dann die json Node hinten dran.

        1398b1c7-b15e-4bad-bd49-5b6107cf6567-image.png

        [
           {
               "id": "1780b1a5015337a8",
               "type": "inject",
               "z": "289f539dcc33814e",
               "name": "",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "23.7",
               "payloadType": "num",
               "x": 2750,
               "y": 2920,
               "wires": [
                   [
                       "f294d7fef083a967",
                       "402830e20c96bcf9"
                   ]
               ]
           },
           {
               "id": "f294d7fef083a967",
               "type": "change",
               "z": "289f539dcc33814e",
               "name": "",
               "rules": [
                   {
                       "t": "move",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload.value",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 2940,
               "y": 2920,
               "wires": [
                   [
                       "102bffe73dd48331",
                       "4afb4a6769f2ea5b"
                   ]
               ]
           },
           {
               "id": "102bffe73dd48331",
               "type": "json",
               "z": "289f539dcc33814e",
               "name": "",
               "property": "payload",
               "action": "",
               "pretty": false,
               "x": 3130,
               "y": 2920,
               "wires": [
                   [
                       "241dc4443d81082c"
                   ]
               ]
           },
           {
               "id": "402830e20c96bcf9",
               "type": "debug",
               "z": "289f539dcc33814e",
               "name": "normale payload",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 2950,
               "y": 2860,
               "wires": []
           },
           {
               "id": "4afb4a6769f2ea5b",
               "type": "debug",
               "z": "289f539dcc33814e",
               "name": "JS Objekt - payload.value",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 3210,
               "y": 2860,
               "wires": []
           },
           {
               "id": "241dc4443d81082c",
               "type": "debug",
               "z": "289f539dcc33814e",
               "name": "JSON Sting",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 3290,
               "y": 2920,
               "wires": []
           }
        ]
        

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

        Support us

        ioBroker
        Community Adapters
        Donate

        1.1k
        Online

        31.7k
        Users

        79.7k
        Topics

        1.3m
        Posts

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