Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] Datenpunkte aus json erstellen

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [gelöst] Datenpunkte aus json erstellen

    This topic has been deleted. Only users with topic management privileges can see it.
    • paul53
      paul53 @Klaus 0 last edited by

      @klaus-0

      Blockly_temp.JPG

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

        @paul53 Ich versuche gerade Ähnliches, bekomme aber die Fehlermeldung "undefined"

        2c686dce-a3bc-40ff-9e70-4b41c6b07b2e-image.png

        javascript.0	21:50:59.113	info	Stopping script script.js.common.800-850_Energie.840_Spritpreise_updaten
        javascript.0	21:50:59.161	info	Start JavaScript script.js.common.800-850_Energie.840_Spritpreise_updaten (Blockly)
        javascript.0	21:50:59.170	info	script.js.common.800-850_Energie.840_Spritpreise_updaten: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
        javascript.1	21:50:59.335	info	Stop script script.js.common.800-850_Energie.840_Spritpreise_updaten
        javascript.0	21:50:59.492	info	script.js.common.800-850_Energie.840_Spritpreise_updaten: undefined
        

        Die geholten Daten schauen so aus:

        [
          {
            "id": 33395,
            "name": "SOCAR Perchtoldsdorf",
            "location": {
              "address": "Ketzergasse 191a",
              "postalCode": "2380",
              "city": "Perchtoldsdorf",
              "latitude": 48.1301731,
              "longitude": 16.2919418
            },
            "contact": {
              "telephone": "4318674570",
              "fax": "4318674804",
              "mail": "office-at@socarenergy.com",
              "website": "https://www.socarenergy.at/"
            },
            "openingHours": [
              {
                "day": "MO",
                "label": "Montag",
                "order": 1,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "DI",
                "label": "Dienstag",
                "order": 2,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "MI",
                "label": "Mittwoch",
                "order": 3,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "DO",
                "label": "Donnerstag",
                "order": 4,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "FR",
                "label": "Freitag",
                "order": 5,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "SA",
                "label": "Samstag",
                "order": 6,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "SO",
                "label": "Sonntag",
                "order": 7,
                "from": "00:00",
                "to": "24:00"
              },
              {
                "day": "FE",
                "label": "Feiertag",
                "order": 8,
                "from": "00:00",
                "to": "24:00"
              }
            ],
            "offerInformation": {
              "service": false,
              "selfService": true,
              "unattended": true
            },
            "paymentMethods": {
              "cash": true,
              "debitCard": true,
              "creditCard": true,
              "others": "UTA, DKV, Socarcard"
            },
            "paymentArrangements": {
              "cooperative": false,
              "clubCard": false
            },
            "position": 1,
            "open": true,
            "distance": 4.24828720258133,
            "prices": [
              {
                "fuelType": "DIE",
                "amount": 1.554,
                "label": "Diesel"
              }
            ]
          },
          {
            "id": 7812,
            "name": "Vivod",
        ...........
        

        Kannst du mir da event. bitte helfen?

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

          @metaxa sagte: Daten schauen so aus:

          Das ist ein Array --> Attribut "0.name".

          metaxa 1 Reply Last reply Reply Quote 2
          • K
            Klaus 0 @paul53 last edited by

            @paul53 Danke für die schnelle Anwort. Jetzt kommen die Fehlermeldungen. Screenshot 2024-05-27 220424.png

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

              @klaus-0
              In Data wird offenbar null geliefert. Debugge mal den Status code

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

                @paul53 sagte in Datenpunkte aus json erstellen:

                Das ist ein Array

                Herzlichen Dank! somit ist mir auch klar wie ich an die weiteren Einträge komme (1.name, 2.name....)

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

                  @paul53 Ist dann auch das gleiche Problem. muss ich vielleicht erst Irgendwas Parsen oder so?Screenshot 2024-05-27 221527.png

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

                    @klaus-0 sagte: Ist dann auch das gleiche Problem.

                    Den Status code ohne "Attribut" debuggen. Er enthält normalerweise eine Zahl (200 bei Erfolg).
                    Die URL stimmt? Im Web-Browser kommt das JSON mit dieser URL?

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

                      @paul53 Im Web-Browser sieht das so aus
                      Screenshot 2024-05-27 222231.png

                      Beim Status code ohne Attribut kommt das
                      Screenshot 2024-05-27 222321.png

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

                        @klaus-0
                        Mit der Fehlermeldung kann ich nichts anfangen. Da muss ein ITler ran.
                        Hast Du es mal mit dem request-Block (und der Variablen result) versucht?

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

                          @paul53
                          hi Paul,

                          das ist die Wetterstation die ich abfrage.

                          https://www.jbmedia.eu/faq/wetterstation

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

                            @klaus-0 sagte: das ist die Wetterstation die ich abfrage.

                            Der Browser liefert das JSON, aber offenbar der httpGet-Block nicht. Keine Ahnung - weshalb.

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

                              @paul53 habe das jetzt mal so ausprobiert. dann kommt wenigstens keine Fehlermeldung. Bin ich da auf dem richtigen Weg?
                              Screenshot 2024-05-27 223549.png

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

                                @paul53 sagte in Datenpunkte aus json erstellen:

                                aber offenbar der httpGet-Block nicht.

                                wenn du das json willst, nicht status code, sonden data nehmen.
                                und zum testen mal das timeout erhöhen

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

                                  @homoran
                                  hatte ich schon ausprobiert. War aber immer der gleiche Fehler.

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

                                    @klaus-0 sagte: Bin ich da auf dem richtigen Weg?

                                    Status code 500 = interner Serverfehler. Dann kommen keine Daten.

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

                                      @klaus-0 sagte in Datenpunkte aus json erstellen:

                                      Im Web-Browser sieht das so aus

                                      das ist ein json, dessen letztes Attribut targeturl ein Array enthält.
                                      Möglicherweise sind die darin enthaltenen Tilden ein Problem.

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

                                        @homoran
                                        Jetzt sieht das so aus. Und nun hat es auch den Status 200
                                        Screenshot 2024-05-27 225003.png

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

                                          @klaus-0 Und die "data" sehen so aus
                                          Screenshot 2024-05-27 225146.png

                                          W 1 Reply Last reply Reply Quote 0
                                          • W
                                            wolfi913 @Klaus 0 last edited by

                                            @klaus-0 sagte in Datenpunkte aus json erstellen:

                                            @klaus-0 Und die "data" sehen so aus

                                            Und mit Antwort-Typ Text ?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            835
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            7
                                            88
                                            4992
                                            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