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 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
            • K
              Kaspaani @paul53 last edited by

              @paul53 In Objekte wird immer noch der Wert 25.74 und quantity angezeigt.
              Wenn ich das Skript ändere sieht es so aus
              df3ba6ca-a579-4f27-bb13-d29c8c1a9534-image.png

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

                @kaspaani sagte: In Objekte wird immer noch der Wert 25.74 und quantity angezeigt.

                Dann ist es wohl kein Pufferproblem.

                @kaspaani sagte in Wert aus json:

                Wenn ich das Skript ändere sieht es so aus

                Du hast keinen Datenpunkt selektiert und state falsch geschrieben.

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

                  @kaspaani Jetzt sieht es gut aus. Vielen herzlichen Dank.
                  afadde16-10ce-4897-ad40-ca342b1664d3-image.png
                  Wenn ich es richtig verstehe ist es jetzt ein string, also rechnen damit geht nicht. Aber schon mal sehr hilfreich.
                  Danke für die Geduld an alle!

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

                    @kaspaani sagte in Wert aus json:

                    ist es jetzt ein string, also rechnen damit geht nicht

                    dann musst du es in eine Zahl konvertieren.

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

                      @homoran ja, das habe ich mir schon gedacht. Aber jetzt kann ich erst einmal weiter machen. Super gut.
                      Danke noch mal an alle die geholfen haben.

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

                        @kaspaani sagte in Wert aus json:

                        , das habe ich mir schon gedacht. Aber jetzt kann ich erst einmal weiter machen

                        dann mach dich ditekt richtig weiter

                        nimm den Block nach Zahl aus der Gruppe Konvertierung und klemme ihn (hier) zwischen debug und Attribut

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

                          @homoran Und schon erledigt 🙂 Aber jetzt taucht gerade noch eine Frage bei mir auf. "state" ist doch eine Variable, finde ich die nicht in Objekte/javaskript/variables ? Wo werden die selbst angelegten Variablen gespeichert?

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

                            @kaspaani sagte: "state" ist doch eine Variable, finde ich die nicht in Objekte/javaskript/variables ?

                            Ja, eine Skriptvariable - kein Datenpunkt. Unter javaskript/variables findet man Datenpunkte.

                            @kaspaani sagte in Wert aus json:

                            Wo werden die selbst angelegten Variablen gespeichert?

                            Variablen existieren nur innerhalb eines Skriptes.

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

                              @paul53 Habe jetzt folgende Lösung. Denke vielleicht nicht die eleganteste aber fürs Erste.
                              f4d7d4a1-35bc-453d-b4a5-300d1d864a44-image.png
                              Gibt es bei Blocky auch eine Abfrage so wie , Wenn Datenpunkt vorhanden mach nichts, sonst erstellen?

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

                                @kaspaani sagte: Wenn Datenpunkt vorhanden mach nichts, sonst erstellen?

                                Diese Abfrage ist in "Datenpunkt erzeugen" vorhanden.
                                Das macht man aber nur einmal und nicht ständig bei jedem Trigger.

                                Besser:

                                Bild_2022-12-26_145727524.png

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

                                Support us

                                ioBroker
                                Community Adapters
                                Donate

                                856
                                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