Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Einsteigerfragen
    4. (gelöst) MQTT json DP in nutzbares verwandeln, wie?

    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

    (gelöst) MQTT json DP in nutzbares verwandeln, wie?

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

      Hallo,
      ich habe einen ESP32 Mikrocontroller angebunden per MQTT. Jetzt erscheint da auch nett was im Objektbaum.
      Leider sind die Werte in einem für mich nicht so trivialen json Format, nehme ich an.

      Beispiel:
      Werttyp: json

      {
        "Time": "2024-03-14T12:46:30",
        "MHZ19B": {
          "Model": "B",
          "CarbonDioxide": 421,
          "Temperature": 20
        },
        "TempUnit": "C"
      }
      

      Wie kann ich denn hier den tatsächlichen CO2-Wert (421) am einfachsten rauslesen, so dass ich damit was machen kann?

      haus-automatisierung Homoran 2 Replies Last reply Reply Quote 0
      • haus-automatisierung
        haus-automatisierung Developer Most Active @BertDerKleine last edited by haus-automatisierung

        @bertderkleine Alias anlegen, Lesefunktion definieren: JSON.parse(val).MHZ19B.CarbonDioxide - fertig.

        Alternativ mit Blockly (JSON zu Objekt -> Attribut MHZ19B.CarbonDioxide von Objekt).

        Beispiele habe ich dafür im ioBroker-Master-Kurs rauf und runter erklärt.

        BertDerKleine 1 Reply Last reply Reply Quote 1
        • Homoran
          Homoran Global Moderator Administrators @BertDerKleine last edited by Homoran

          @bertderkleine Attribut MHZ19B.CarbonDioxide von Datenpunkt
          Screenshot_20240315-125158_Firefox.jpg

          1 Reply Last reply Reply Quote 1
          • BertDerKleine
            BertDerKleine @haus-automatisierung last edited by

            @haus-automatisierung sagte in MQTT json DP in nutzbares verwandeln, wie?:

            JSON.parse(val).MHZ19B.CarbonDioxide

            Danke. das klappt mit dem Alias ganz gut. Und ich nutze Aliasse ja eh gerne.
            Muss ich mit die Tage mal ausführlicher durchlesen, wie man sowas im allgemeinen nutzt.

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

            Support us

            ioBroker
            Community Adapters
            Donate

            411
            Online

            31.9k
            Users

            80.3k
            Topics

            1.3m
            Posts

            3
            4
            225
            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