Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Off Topic
    4. Grafana
    5. grafana - today() startet tag bei 02:00

    NEWS

    • [erledigt] 15. 05. Wartungsarbeiten am ioBroker Forum

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    grafana - today() startet tag bei 02:00

    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      CoComp last edited by

      Moin,

      die Daten kommen einer Influx2DB und liegen damit unter dem "Zeitformat" UTC vor. Ich habe eine Fluxx-Query (ich habe im Beispiel jetzt mal auf den entscheidenden Teil gekürzt, die timezone des dashboards ist Deutschland.

      Version mit today()

      import "timezone"
      option location = timezone.location(name: "Europe/Berlin")
      from(bucket: "nodered")
        |> range(start: today())
        |> filter(fn: (r) => r["_measurement"] == "KG.hz.SZ_A_Plus15")
        |> filter(fn: (r) => r["_field"] == "value")
      

      Die Daten beginnen um 02:00
      88bd158e-1e12-471a-803d-0afe8662ec71-image.png

      Version, bei der ich für das Dashbaord "manuell" den aktuellen Tag als Timeslot vorgebe

      import "timezone" // import wegen der Berechnung um 02:00:00
      option location = timezone.location(name: "Europe/Berlin")
      from(bucket: "nodered")
        |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
        |> filter(fn: (r) => r["_measurement"] == "KG.hz.SZ_A_Plus15")
        |> filter(fn: (r) => r["_field"] == "value")
      

      Der Tag beginnt um 00:00
      c42c7975-8db1-4733-bbd2-cf6d26128d68-image.png

      Die jeweils angezeigten Werte sind korrekt...

      Was übersehe ich?

      S 1 Reply Last reply Reply Quote 1
      • S
        SpacerX @CoComp last edited by SpacerX

        @cocomp Kurios!
        Lass dir das mal als Tabelle anzeigen. Vielleicht auch mal das ganze Skript zeigen.
        Ich Wette da fehlen Daten von 0:00 bis 2:00 Uhr

        C 1 Reply Last reply Reply Quote 0
        • C
          CoComp @SpacerX last edited by

          @spacerx Das ist korrekt, die Ergebnistabelle zeigt, wie das Diagramm, Werte ab 02:00.
          3d5e9796-656f-49b9-97a8-03d734073725-image.png

          Aber warum "filtert" today() in der Range die Zeit zwischen 00:00 01:59 raus?

          Hier das komplette JSON

          {
            "id": 35,
            "gridPos": {
              "h": 8,
              "w": 12,
              "x": 12,
              "y": 0
            },
            "type": "timeseries",
            "title": "Panel Title",
            "datasource": {
              "type": "influxdb",
              "uid": "D84bEx3nz"
            },
            "fieldConfig": {
              "defaults": {
                "custom": {
                  "drawStyle": "line",
                  "lineInterpolation": "stepAfter",
                  "barAlignment": 0,
                  "lineWidth": 1,
                  "fillOpacity": 0,
                  "gradientMode": "none",
                  "spanNulls": false,
                  "showPoints": "auto",
                  "pointSize": 5,
                  "stacking": {
                    "mode": "none",
                    "group": "A"
                  },
                  "axisPlacement": "auto",
                  "axisLabel": "",
                  "scaleDistribution": {
                    "type": "linear"
                  },
                  "hideFrom": {
                    "tooltip": false,
                    "viz": false,
                    "legend": false
                  },
                  "thresholdsStyle": {
                    "mode": "off"
                  }
                },
                "color": {
                  "mode": "palette-classic"
                },
                "mappings": [],
                "thresholds": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "red",
                      "value": 80
                    }
                  ]
                }
              },
              "overrides": []
            },
            "options": {
              "tooltip": {
                "mode": "single",
                "sort": "none"
              },
              "legend": {
                "displayMode": "list",
                "placement": "bottom",
                "calcs": []
              }
            },
            "targets": [
              {
                "datasource": {
                  "type": "influxdb",
                  "uid": "D84bEx3nz"
                },
                "query": "import \"timezone\"\r\noption location = timezone.location(name: \"Europe/Berlin\")\r\nfrom(bucket: \"nodered\")\r\n  |> range(start: today())\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"KG.hz.SZ_A_Plus15\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")",
                "refId": "A"
              }
            ]
          }
          
          Thomas Braun 1 Reply Last reply Reply Quote 0
          • Thomas Braun
            Thomas Braun Most Active @CoComp last edited by

            @cocomp

            Da wird in einem System die falsche/keine Zeitzone gesetzt sein. Ab nächsten Sonntag ist die Abweichung nur noch 1 Stunde. 🙂

            C 1 Reply Last reply Reply Quote 0
            • C
              CoComp @Thomas Braun last edited by CoComp

              @thomas-braun War auch meine erste Idee, aber wo?

              Die Datenquelle ist nutzt UTC. Stelle ich das grafana-dashboard auf UTC um, beginnt die Query mit today () nicht mehr um 02:00 sondern um 00:00.

              Also scheint durch today () der Tag nicht mit der deutschen Zeit 00:00 sondern mit UTC 00:00 zu beginnen, was dann ja der deutschen Zeit 02:00 entspricht...

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

                @cocomp sagte in grafana - today() startet tag bei 02:00:

                mit UTC 00:00 zu beginnen, was dann ja der deutschen Zeit 00:00 entspricht...

                enäää!

                heute ist 0:00Z (UTC) 02:00 MESZ

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

                  @homoran Jupp, Schreibfehler bei mir.

                  00:00 UTC ist 02:00 deutsche Zeit 😉 Habe ich in meinem Post geändert.

                  Das Problem scheint aber today() zu sein, denn eigentlich sollte die Tabelle / Darstellung mit 00:00 beginnen:
                  https://github.com/grafana/grafana/issues/43378

                  Sineos created this issue in grafana/grafana

                  closed Influxdb 2.x and Grafana's understanding of time is "different" #43378

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    SpacerX @CoComp last edited by SpacerX

                    @cocomp das habe ich auch so nachgelesen.

                    dann bleibt dir noch:

                    option location = timezone.fixed(offset: -Xh)
                    

                    und damit die Zeit selber hin rücken damit du today() benutzen kannst.

                    Homoran C 2 Replies Last reply Reply Quote 0
                    • Homoran
                      Homoran Global Moderator Administrators @SpacerX last edited by

                      @spacerx sagte in grafana - today() startet tag bei 02:00:

                      @cocomp d

                      ist das Kunst oder kann das weg 😂

                      S C 2 Replies Last reply Reply Quote 0
                      • S
                        SpacerX @Homoran last edited by

                        @homoran Ha ha Hi Hi

                        Da haben die Finger über der Maus gezittert. 😂

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

                          @homoran Das ist Kunst, kannst du aber gern nutzen 😉

                          1 Reply Last reply Reply Quote 0
                          • C
                            CoComp @SpacerX last edited by

                            @spacerx said in grafana - today() startet tag bei 02:00:

                            @cocomp das habe ich auch so nachgelesen.

                            dann bleibt dir noch:

                            option location = timezone.fixed(offset: -Xh)
                            

                            und damit die Zeit selber hin rücken damit du today() benutzen kannst.

                            Das wird immer kurioser, denn das verändert nichts...

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              SpacerX @CoComp last edited by

                              @cocomp ich bin jetzt auch mal an den Rechner gesprungen und hab das mit den Werten von meinem Stromzähler mal getestet.

                              import "timezone" // import wegen der Berechnung um 02:00:00
                              option location = timezone.location(name: "Europe/Berlin")
                              from(bucket: "ioBroker")
                                |> range(start: today())
                                |> filter(fn: (r) => r["_measurement"] == "Vb_Stromzaehler")
                                |> filter(fn: (r) => r["from"] == "system.adapter.javascript.0")
                              

                              SnipSnap_1.PNG

                              Macht genauso, wie es soll.🤔

                              C 1 Reply Last reply Reply Quote 0
                              • C
                                CoComp @SpacerX last edited by

                                @spacerx said in grafana - today() startet tag bei 02:00:

                                @cocomp ich bin jetzt auch mal an den Rechner gesprungen und hab das mit den Werten von meinem Stromzähler mal getestet.

                                import "timezone" // import wegen der Berechnung um 02:00:00
                                option location = timezone.location(name: "Europe/Berlin")
                                from(bucket: "ioBroker")
                                  |> range(start: today())
                                  |> filter(fn: (r) => r["_measurement"] == "Vb_Stromzaehler")
                                  |> filter(fn: (r) => r["from"] == "system.adapter.javascript.0")
                                

                                SnipSnap_1.PNG

                                Macht genauso, wie es soll.🤔

                                Das ist wirklich kurios, dann werde ich mal weiter forschen gehen...
                                Danke trotzdem für die Mühe...

                                S 1 Reply Last reply Reply Quote 0
                                • S
                                  SpacerX @CoComp last edited by

                                  @cocomp wie ist den deine Default Timezone gesetzt?

                                  C 1 Reply Last reply Reply Quote 0
                                  • C
                                    CoComp @SpacerX last edited by

                                    @spacerx said in grafana - today() startet tag bei 02:00:

                                    @cocomp wie ist den deine Default Timezone gesetzt?

                                    Europe / Berlin - sowohl global für grafana als auch im Dashboard. Und die UTC-Zeitstempel in der Influx2DB stimmen.

                                    Was mich halt stutzig macht, dass der feste timeslot in Verbindung mit

                                    from(bucket: "nodered")
                                      |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
                                      |> filter(fn: (r) => r["_measurement"] == "KG.hz.SZ_A_Plus15")
                                      |> filter(fn: (r) => r["_field"] == "value")
                                    

                                    das gewünschte Ergebnis bringt.

                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      SpacerX @CoComp last edited by SpacerX

                                      @cocomp hier mal ein Ausschnitt, das hab ich bei dir nicht so gesehen.

                                      SnipSnap_1.PNG

                                      Sicher das deine Zeitzone in deinem System stimmt?

                                      C 1 Reply Last reply Reply Quote 0
                                      • C
                                        CoComp @SpacerX last edited by CoComp

                                        @spacerx

                                        So sieht das bei mir aus:
                                        96ada0f8-ed2a-49cd-b7a8-59becfc87d60-image.png

                                        S 1 Reply Last reply Reply Quote 0
                                        • S
                                          SpacerX @CoComp last edited by

                                          @cocomp mal eine andere Frage, wie kommt das timeshift -0m da hin.
                                          Das kann ich gar nicht eingeben.

                                          C 1 Reply Last reply Reply Quote 0
                                          • C
                                            CoComp @SpacerX last edited by

                                            @spacerx Das stammt aus meiner "mal was ausprobieren-phase" von heute Nachmittag. Normal steht da 1h
                                            00fa5f10-1926-4d1b-b0f5-f1f612bb5307-image.png

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            750
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            4
                                            22
                                            2991
                                            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