Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Einsteigerfragen
    4. json einfach Filtern (VIS)

    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

    json einfach Filtern (VIS)

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SirPritz @Ro75 last edited by Homoran

      @ro75 Ich habe das Script kopiert und mir den Datenpunkt angelegt, der ist aber leer

      createState('0_userdata.0.Alexa.Einkaufsliste', "[]", {read: true, write: true, desc: "JSON String", type: "string", def: "[]"});
       
      function Einkaufsliste() {
          setTimeout(function(){
              var vEString='';
              let ListeEinkauf = [];
              $('alexa2.0.Lists.SHOPPING_LIST.items*.value').each(function(id, i) {
                  if(getState(id.replace("value","completed")).val === false) {
                      vEString ='FF'; //dient einfach nur als merkmal, das die Liste nicht leer ist
                      ListeEinkauf.push({
                          Artikel: getState(id).val
                      })
                  }
              });
              if(vEString == '') {
                  ListeEinkauf.push({
                      Artikel: "kein Eintrag"
                  })
              }
              setState('0_userdata.0.Alexa.Einkaufsliste', JSON.stringify(ListeEinkauf), true);
              ListeEinkauf = [];
          },500);
      }
       
      on({id: 'alexa2.0.Lists.SHOPPING_LIST.json', change: 'any'}, Einkaufsliste);
      

      MOD-EDIT: Code in code-tags gesetzt!

      Ro75 arteck 2 Replies Last reply Reply Quote 0
      • Ro75
        Ro75 @SirPritz last edited by Ro75

        @sirpritz hast du alles in ein neues JS Skript einkopiert und dann das Skript gestartet? Der DP wird automatisch angelegt.

        Ro75.

        Edit: wie lautet denn dein DP für die Einkaufsliste?

        S 1 Reply Last reply Reply Quote 0
        • arteck
          arteck Developer Most Active @SirPritz last edited by

          @sirpritz code bitte in Code Tag

          b785c19b-2731-4b57-a5b3-cc8ed6ff2a16-grafik.png

          kann man besser lesen

          S 1 Reply Last reply Reply Quote 0
          • S
            SirPritz @Ro75 last edited by

            @ro75 alexa2.0.Lists.SHOPPING_LIST.json

            Ro75 1 Reply Last reply Reply Quote 0
            • S
              SirPritz @arteck last edited by Homoran

              @arteck

              createState('0_userdata.0.Alexa.Einkaufsliste', "[]", {read: true, write: true, desc: "JSON String", type: "string", def: "[]"});
               
              function Einkaufsliste() {
                  setTimeout(function(){
                      var vEString='';
                      let ListeEinkauf = [];
                      $('alexa2.0.Lists.SHOPPING_LIST.items*.value').each(function(id, i) {
                          if(getState(id.replace("value","completed")).val === false) {
                              vEString ='FF'; //dient einfach nur als merkmal, das die Liste nicht leer ist
                              ListeEinkauf.push({
                                  Artikel: getState(id).val
                              })
                          }
                      });
                      if(vEString == '') {
                          ListeEinkauf.push({
                              Artikel: "kein Eintrag"
                          })
                      }
                      setState('0_userdata.0.Alexa.Einkaufsliste', JSON.stringify(ListeEinkauf), true);
                      ListeEinkauf = [];
                  },500);
              }
               
              on({id: 'alexa2.0.Lists.SHOPPING_LIST.json', change: 'any'}, Einkaufsliste);
              
              1 Reply Last reply Reply Quote 0
              • Ro75
                Ro75 @SirPritz last edited by Ro75

                @sirpritz Und der Rest von meinem Beitrag? Starte das Skript und füge was der Einkaufsliste hinzu oder lösche erledige was davon. Das Skript reagiert nur auf Änderungen.

                S 1 Reply Last reply Reply Quote 0
                • S
                  SirPritz @Ro75 last edited by SirPritz

                  @ro75 OK, versuche es mal weiter...., danke.

                  Danke, so funktioniert es Perfekt, das ist das was ich gesucht habe, echt nochmal vielen Dank.

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

                    Manchmal frag ich mich, warum ich überhaupt poste - wenn es ignoriert wird.

                    Ro75 S 2 Replies Last reply Reply Quote 0
                    • Ro75
                      Ro75 @mickym last edited by

                      @mickym wieso, Lösung hat er doch.

                      1 Reply Last reply Reply Quote 0
                      • S
                        SirPritz @mickym last edited by

                        @mickym Sorry, mit deinem Ansatz kam ich nicht weiter.
                        Die andere Lösung hat dann aber gepasst.
                        Hätte nochmal nachfragen können, aber bei mir kommt jetzt alles richtig an, danke nochmal.

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        387
                        Online

                        31.9k
                        Users

                        80.2k
                        Topics

                        1.3m
                        Posts

                        7
                        23
                        976
                        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