Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Wert aus json

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Wert aus json

    This topic has been deleted. Only users with topic management privileges can see it.
    • Homoran
      Homoran Global Moderator Administrators @Kaspaani last edited by

      @kaspaani sagte in Wert aus json:

      Ich habe folgende JSON

      bitte als Text in code-tags!

      K 1 Reply Last reply Reply Quote 0
      • K
        Kaspaani @Homoran last edited by

        @homoran meinst du das so?

        [{"start":61,"end":100,"date":"24.12.2022 14:29","diff":154,"quantity":"25.74","price":"10.04","odo":3646,"basicPrice":0.39,"startDate":"24.12.2022 11:56","duration":154,"perHour":0.0027857142857142855}]
        
        Homoran 1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @Kaspaani last edited by

          @kaspaani sagte: Als Ansatz habe ich diesen:

          Du hast die asynchrone Version mit Callback-Funktion ausgewählt, die den Zustand des Datenpunktes in der Variablen state (nicht result) liefert.

          Bild_2022-12-26_112543838.png

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

            @paul53 Ich sehe den Wald vor lauter Bäumen nicht mehr. Ich finde das "setze ...auf" nicht.

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

              @kaspaani sagte: Ich finde das "setze ...auf" nicht.

              Die Variable muss erst erstellt werden, damit "setze ... auf" angeboten wird.

              Bild_2022-12-26_114530977.png

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

                @paul53 Sieht jetzt so aus. Leider immer noch nicht das Ergebnis wie bei dir.
                256190d9-2b14-4566-bfea-17e4967c449d-image.png
                Mach ich was verkehrt mit der Obj ID?

                cc7f98df-35dd-4ad5-b545-5592edd7f3f6-image.png

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

                  @kaspaani sagte: Mach ich was verkehrt mit der Obj ID?

                  Anscheinend ja: Der Datenpunkt "Charging history as json" enthält offenbar nicht das gezeigte JSON.
                  Die 2 Log-Ausgaben oberhalb von "Cannot get ..." wären interessant gewesen.

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

                    @paul53 Nach meinem Verständnis doch. Wenn man sich das hier ansieht.
                    cd9d656e-ac07-4f26-96fc-dc0ba564b9df-image.png

                    K 1 Reply Last reply Reply Quote 0
                    • K
                      Kaspaani @Kaspaani last edited by

                      @kaspaani 0b7c2cce-3c97-4614-9b2f-488f56465615-image.png

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

                        @kaspaani
                        Der Wert des Datenpunktes ist ein leeres Objekt. Es ist offenbar ein anderer Datenpunkt als der gezeigte DP.

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

                          @paul53 Das sagt mir leider nichts. Meinst du obwohl man was sieht ist die Tabelle leer?
                          Wenn ich die Tabelle in VIS aufrufe zeigt mir die JSON Tabelle alle Werte an.

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

                            @kaspaani sagte: Meinst du obwohl man was sieht ist die Tabelle leer?

                            Starte mal die Javascript-Instanz neu.

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

                              @paul53 9a101d9f-cc21-43f8-93a8-5625567e2764-image.png

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

                                @kaspaani
                                Nach Neustart der Javascript-Instanz?
                                Zeige bitte den DP im Tab Objekte, so dass man den Namen und den Anfang des zugehörigen Wertes erkennen kann.

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

                                  @paul53 2cc3dd7d-cef3-4a7b-875f-ccf2aba592d3-image.png

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

                                    @kaspaani
                                    Danke, sollte passen.
                                    Nun starte mal die Instanz admin.0 neu. Steht danach immer noch das JSON im Wert?

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

                                      @kaspaani wenn du dir das json ansiehst
                                      Screenshot_20221226-125841_Firefox.jpg
                                      siehst du dass es in einem Array steckt und Attribut von 0.quantity heißen muss

                                      K paul53 2 Replies Last reply Reply Quote 0
                                      • K
                                        Kaspaani @Homoran last edited by

                                        @homoran sorry der Start hat ein wenig länger benötigt.
                                        Heißt das, dass ich das so eintragen muss?
                                        a54f85a2-2b6f-46fd-8ec2-d1c393c9e4af-image.png
                                        gibt auch die Fehlermeldung.

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

                                          @homoran sagte: Attribut von 0.quantity heißen muss

                                          Ja, mit der asynchronen Version würde es so aussehen.

                                          Bild_2022-12-26_131155864.png

                                          Das Ergebnis enthält allerdings einen String.
                                          Es scheint mir eher ein Pufferproblem zu sein, denn ich kann mir nicht vorstellen, dass es einen zweiten DP mit dem Namen "Charging history as json" gibt.

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

                                            @kaspaani sagte: der Start hat ein wenig länger benötigt.

                                            Welcher Wert wird jetzt im Tab "Objekte" angezeigt?

                                            @kaspaani sagte in Wert aus json:

                                            Heißt das, dass ich das so eintragen muss?

                                            Mache es erst einmal schrittweise bis der Fehler gefunden ist.
                                            Poste bitte den erzeugten Javascript-Code ohne die letzte Zeile in Code tags.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            796
                                            Online

                                            32.0k
                                            Users

                                            80.5k
                                            Topics

                                            1.3m
                                            Posts

                                            7
                                            42
                                            818
                                            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