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.
    • K
      Kaspaani @liv-in-sky last edited by

      @liv-in-sky Hallo ich hoffe ich habe es richtig umgesetzt. Sieht jetzt so aus.
      cf17ec0f-40aa-4106-b849-01704f56cf35-image.png
      bekomme jetzt die Fehlermeldung:
      11:02:36.426 error javascript.0 (10450) script.js.Ladeleistung: Cannot get quantity of undefined

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

        @kaspaani Das ERSTE Element nehmen.

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

          @kaspaani
          Die Liste hat nur ein Element (ein Objekt). Man muss also das 1. Element nehmen.

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

            @paul53 trotzdem die gleiche Meldung:
            36586650-3abf-4808-8d86-61ab43b53380-image.png

            bahnuhr liv-in-sky paul53 3 Replies Last reply Reply Quote 0
            • bahnuhr
              bahnuhr Forum Testing Most Active @Kaspaani last edited by

              @kaspaani

              Wie schon mehrfach berichtet; du musst das 1. Element nehmen.

              Und dies ist [0]

              @mickym sagte in Wert aus json:

              @kaspaani Probier mal:

              Wert[0].quantity
              

              als Attribut.

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

                @kaspaani

                wie erwähnt - das erste !

                1672047858936-image-095.png

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

                  @kaspaani sagte: trotzdem die gleiche Meldung:

                  Dann checke es mal in einzelnen Schritten:

                  Bild_2022-12-26_111722173.png

                  EDIT: Log:

                  11:29:28.251	info	javascript.1 (2078) script.js.blockly.Test8_Blockly: [{'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}]
                  11:29:28.251	info	javascript.1 (2078) script.js.blockly.Test8_Blockly: {'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}
                  11:29:28.251	info	javascript.1 (2078) script.js.blockly.Test8_Blockly: 25.74
                  
                  K 1 Reply Last reply Reply Quote 0
                  • 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
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            665
                                            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