Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Error/Bug
    4. [Blockly] Fehler in Zeitvergleich mit Astro

    NEWS

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    [Blockly] Fehler in Zeitvergleich mit Astro

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

      Hallo

      EDIT: (Keine Ahnung ob der Fehler nur bei Blockly auftaucht) Nach Test von Paul53 nur in Blockly.

      147_beispiel.png

      Hier der js code

      // alle 10 Min
      schedule("*/10 * * * *", function () {
        if (compareTime(getAstroDate("sunset", undefined, 0), '18:00', "between", null)) {
          // FEHLER
          // Bedingung ist auch um 00:00 Uhr TRUE
        }
      });
      
      

      Die Zeit im cron ist fast egal. Er muss nur auch um 00:00 Uhr ausgeführt werden.

      Ich vermute mal, dass um 00:00 die neuen Astrozeiten generiert werden.

      Habe dies auch schon bei Trello reingesetzt. Aber dort scheint es nur noch eine traurige Ansammlung von Karten zu geben.

      Grüße

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

        @rantanplan:

          if (compareTime(getAstroDate("sunset", undefined, 0), '18:00', "between", null)) {
            // FEHLER
            // Bedingung ist auch um 00:00 Uhr TRUE
        ```` `  
        

        Kann ich so nicht bestätigen. Das folgende Skript lieferte um 19:20 Uhr "compareTime ergibt true",

        // alle 10 Min
        schedule("*/10 * * * *", function() {
          var x = (compareTime("sunset", '19:21', "between"));
          log('compareTime ergibt ' + x);
        });
        
        

        danach das:

        ! ````
        19:30:00.419 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        19:40:00.390 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        19:50:00.426 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        20:00:00.417 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        20:10:00.400 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        20:20:00.419 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        20:30:00.422 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        20:40:00.426 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        20:50:00.415 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        21:00:00.421 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        21:10:00.424 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        21:20:00.424 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        21:30:00.404 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        21:40:00.419 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        21:50:00.413 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        22:00:00.413 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        22:10:00.420 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        22:20:00.423 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        22:30:00.424 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        22:40:00.424 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        22:50:00.425 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        23:00:00.415 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        23:10:00.424 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        23:20:00.414 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        23:30:00.416 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        23:40:00.425 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        23:50:00.413 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        00:00:00.473 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        00:10:00.421 [info] javascript.1 script.js.common.Tests: compareTime ergibt false
        00:20:00.390 [info] javascript.1 script.js.common.Tests: compareTime ergibt false

        1 Reply Last reply Reply Quote 0
        • rantanplan
          rantanplan last edited by

          Hallo Paul53

          Vielen Dank für's Testen.

          Im Deinem Log sehe ich, das 00:00 immer noch false ist.

          Dann ist es wohl ein Blockly Problem bzw. der Funktion "getAstroDate".

          Grüße

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

            @rantanplan:

            Dann ist es wohl ein Blockly Problem bzw. der Funktion "getAstroDate". `
            Blockly erzeugt lediglich Javascript-Code, also kann es nicht an Blockly liegen.

            "getAstroDate" liefert ein Date object und als "bis"-Wert wird ein String im Format "hh:mm" verwendet. Sicherlich wird darin das Problem liegen.

            1 Reply Last reply Reply Quote 0
            • rantanplan
              rantanplan last edited by

              @paul53:

              Blockly erzeugt lediglich Javascript-Code, also kann es nicht an Blockly liegen. `
              Das ist mir schon klar 😉

              Blockly deshalb, weil dort "getAstroDate" vorgegeben ist.

              @paul53:

              "getAstroDate" liefert ein Date object und als "bis"-Wert wird ein String im Format "hh:mm" verwendet. Sicherlich wird darin das Problem liegen. `
              Gehe ich auch von aus. Wo meldet man das Problem jetzt am besten?

              Ich werde mal meinen Trello Eintrag aktualisieren.

              Grüße

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

                @rantanplan:

                Blockly deshalb, weil dort "getAstroDate" vorgegeben ist. `
                Wirklich ?
                493_blockly_comparetime.jpg

                1 Reply Last reply Reply Quote 0
                • rantanplan
                  rantanplan last edited by

                  @paul53:

                  Wirklich ? `
                  Sorry, aber die Diskussion verstehe ich jetzt nicht.
                  147_beispiel.png

                  Richtig, es gibt eine andere Lösung.

                  Ist das Problem damit erledigt?

                  Grüße

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

                    @rantanplan:

                    Richtig, es gibt eine andere Lösung.

                    Ist das Problem damit erledigt? `
                    Für Anwender, die die Doku zum JS-Adapter lesen und deshalb die andere Lösung anwenden: Ja.

                    Für diejenigen, die intuitiv mit Blockly "losmachen", sicherlich nicht.

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

                    Support us

                    ioBroker
                    Community Adapters
                    Donate

                    930
                    Online

                    31.6k
                    Users

                    79.4k
                    Topics

                    1.3m
                    Posts

                    2
                    8
                    1242
                    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