Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [Gelöst] Hilfe beim zerlegen von eine URL request.

    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] Hilfe beim zerlegen von eine URL request.

    This topic has been deleted. Only users with topic management privileges can see it.
    • liv-in-sky
      liv-in-sky @Fuchsbau last edited by

      @fuchsbau

      schau mal ob das passt

      https://forum.iobroker.net/topic/49299/aus-json-136-datenpunkte-erzeugen?_=1639227372923

      Homoran 1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @liv-in-sky last edited by

        @liv-in-sky sagte in Hilfe beim zerlegen von eine URL request.:

        schau mal ob das passt

        nee, ist kein json

        liv-in-sky 1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky @Homoran last edited by

          @homoran oja - da hast du recht

          JohGre Homoran 2 Replies Last reply Reply Quote 0
          • JohGre
            JohGre @liv-in-sky last edited by

            @Fuchsbau probiers mal mit replace und split

            var str = '<46;41;48;99;44;99;83;0;99;31;46;0;0;99;0>';
            str.replace(/>/g,"");
            str.replace(/</g,"");
            
            str.split(";")
            
                for (var i = 0; i < str.length; i++) {
                    log('Wert: ' + i + ' Value: ' + str[i]);
                }
            
            
            1 Reply Last reply Reply Quote 0
            • mickym
              mickym Most Active @Fuchsbau last edited by

              @fuchsbau Ersetze einfach die Dreiecksklammern gegen eckige Klammern und die Strichpunkte durch Kommas und Du hast ein Array - oder Du nutzt den Inhalt und nimmst die split Funktion die erstellt auch ein Array mit Strichpunkt als Seperator,

              1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @Fuchsbau last edited by paul53

                @fuchsbau sagte: Lösungsansatz.

                Bild_2021-12-11_155826.png

                Homoran 1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @liv-in-sky last edited by Homoran

                  @liv-in-sky Hab mal ein wenig probiert.
                  Grundlage könnte sein:
                  Liste_einzelfelder02.png
                  und dann in die entsprechenden Datenpunkte schreiben.
                  Geht wahrscheinlich mit i=1 to n noch eleganter

                  EDIT:
                  @paul53 hat's schon

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

                    @paul53 sagte:

                    Lösungsansatz

                    den Pulldown von hinten hab ich beim bis nicht gesehen 😞

                    liv-in-sky 1 Reply Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @Homoran last edited by liv-in-sky

                      @homoran
                      lösung kommt ja schon von paul

                      meine wäre:

                      const myvar='<416;41;48;919;44;99;83;110;99;31;46;0;0;99;0>'
                      
                      
                       let myvarArr = myvar.match(/\d+/g); // myvar.replace('<','').replace('>','').split(';')
                      
                      
                      
                      for(let u=0;u<myvarArr.length;u++){
                          let theVal='ventil'+String(u+1);
                       if(existsState('0_userdata.0.VENTILE.'+theVal)) setState('0_userdata.0.VENTILE.'+theVal,Number(myvarArr[u]));
                               else createState('0_userdata.0.VENTILE.'+theVal, Number(myvarArr[u]), { name: theVal,type:'number' }); 
                      }
                      
                      

                      könnte man ja in blockly als function einfügen

                      Image 2.png

                      F paul53 2 Replies Last reply Reply Quote 0
                      • F
                        fastfoot @liv-in-sky last edited by

                        @liv-in-sky sagte in Hilfe beim zerlegen von eine URL request.:

                        let myvarArr = myvar.replace('<','').replace('>','').split(';')

                        let myvarArr = myvar.match(/\d+/g)

                        liv-in-sky 1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @liv-in-sky last edited by

                          @liv-in-sky sagte: meine wäre:

                          Die Ventilwerte liegen im Array als String vor.

                          1 Reply Last reply Reply Quote 0
                          • liv-in-sky
                            liv-in-sky @fastfoot last edited by

                            @fastfoot
                            @paul53

                            ausgebessert - jetzt sind es number werte - ist besser für berechnungen

                            Fuchsbau 1 Reply Last reply Reply Quote 0
                            • Fuchsbau
                              Fuchsbau @liv-in-sky last edited by

                              @liv-in-sky
                              Ich danke Dir und allen Anderen für Eure Hilfe.
                              Jetzt funktioniert es und ich komme weiter.
                              👍 Danke an ALLE

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

                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              700
                              Online

                              31.8k
                              Users

                              80.0k
                              Topics

                              1.3m
                              Posts

                              7
                              14
                              403
                              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