Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. In einzelne States parsen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    In einzelne States parsen

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

      Hallo Zusammen,

      wie kann ich z.B. mit NodeRed folgenden Output in einzelne Objekte und States speichern.

      {"CGI_Result":{"result":["0"],"IOAlarm":["0"],"motionDetectAlarm":["1"],"soundAlarm":["0"],"record":["0"]

      Objekt: result State: 0

      IOAlarm State: 1

      usw.

      Oder aus diesem Inhalt:

      <cgi_result><result>0</result> <ioalarm>0</ioalarm> <motiondetectalarm>1</motiondetectalarm> <soundalarm>0</soundalarm> <record>0</record> <sdstate>0</sdstate> <sdfreespace>0k</sdfreespace> <sdtotalspace>0k</sdtotalspace> <ntpstate>1</ntpstate> <ddnsstate>0 <upnpstate>1</upnpstate> <iswificonnected>1</iswificonnected> <infraledstate>0</infraledstate></ddnsstate></cgi_result>

      Danke und Gruß

      1 Reply Last reply Reply Quote 0
      • frankjoke
        frankjoke last edited by

        @coronaxxl:

        {"CGI_Result":{"result":["0"],"IOAlarm":["0"],"motionDetectAlarm":["1"],"soundAlarm":["0"],"record":["0"]} `

        in node-red eine Funktion die in etwa so ausschaut (sie kriegt als payload diesen string)

        var list = JSON.parse(msg.payload)["CGI_Result"];
        for(var key in list) {
        	var nm = {};
        	nm.topic = "CGI_Result"+"."+key;
        	nm.payload = Number(list[key][0]); // oder Number(list[key][0]) != 0 // wenn es ein Boolean werden soll
        	node.send(nm);
        }
        return null;
        
        

        Die Ausgabe dieser Funktion dann an IO-Broker schicken.

        LG

        Frank

        1 Reply Last reply Reply Quote 0
        • S
          Schnutexxl last edited by

          Ok. Super danke. Werde ich am weekend probieren.

          Gesendet von meinem SM-N9005 mit Tapatalk

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

          Support us

          ioBroker
          Community Adapters
          Donate
          FAQ Cloud / IOT
          HowTo: Node.js-Update
          HowTo: Backup/Restore
          Downloads
          BLOG

          857
          Online

          31.9k
          Users

          80.3k
          Topics

          1.3m
          Posts

          2
          3
          730
          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