Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Astro-Tageszeit abfragen und in Datenpunkt eintragen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    Astro-Tageszeit abfragen und in Datenpunkt eintragen

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

      @mguenther sagte:

      Ich nutze folgendes Script:

      Die Logik der Script-Zeilen 360 bis 367 erschließt sich mir auch nicht. Wenn Du die Zeiten von heute haben möchtest, dann ersetze Zeile 360 durch

             var next_event = today;
      

      und kommentiere die Zeilen 361 bis 367 aus.

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

        @paul53
        ich verstehe es auch gar nicht. Hatte @pix eigentlich mal was geantwortet dazu?

        P 1 Reply Last reply Reply Quote 0
        • SKB
          SKB Developer Most Active last edited by

          Ich habe hier mal ein strukturiertes und kommentiertes Skript abgelegt:
          https://www.kreyenborg.koeln/iobroker-astro-tageszeit-abfragen-und-in-datenpunkt-eintragen/

          Das Skript funktioniert sowohl zu Winter, als auch zur Sommerzeit. Alle Zeiten werden jede Stunde (anpassbar) aktualisiert.

          1 Reply Last reply Reply Quote 2
          • P
            pix @mguenther last edited by

            @mguenther Hallo,
            ich habe das Skript schon lange nicht mehr angefasst und bin jetzt auf die Schnelle nicht gleich im Thema.
            Die von @paul53 angesprochenen Zeilen haben den Sinn, abhängig von der aktuellen Tageszeit (oder abhängig davon, ob gerade Tag oder Nacht ist), den nächsten Event individuell zu schreiben.
            Beispiel:
            Es ist der 1.5. um 1800 Uhr und die Sonne ist noch nicht untergegangen. Dann ist der nächste Sonnenuntergang am 1.5. sagen wir um 2030 Uhr, also am gleichen Tag, also auch der heutige.
            Der heutige Sonnenaufgang ist bereits morgens gewesen, sagen wir am 1.5. um 0500 Uhr. Das ist der heutige, aber nicht der nächste. Der nächste ist erst morgen.
            Wenn ich also die Datenpunkte für Sonnenauf- und -untergang schreibe, muss ich vorher klarstellen, ob es die Zeiten für einen bestimmten Tag sein sollen oder je nach Skriptstart immer die kommenden nächsten.
            isAstrodDay() und isAstroNight() prüfen, ob man sich gerade zwischen Aufgang und Untergang (AstroDay) oder Untergang und Aufgang (AstroNight) befindet.

            Pix

            M 1 Reply Last reply Reply Quote 0
            • M
              mguenther @pix last edited by

              @pix
              verstanden. Was zeigen aber deine Werte an? Die für den aktuellen Tag oder den "nächsten" Event? Dann verstehe ich z.B. nicht, das ich immer den falschen (quasi +2min) Event angezeigt bekomme. Wenn ich bei deinem Beispiel bleibe - mir wird quasi als nächster Sonnenuntergang nicht von "heute" (2030Uhr), sondern von morgen (2032Uhr) angezeigt. Das verstehe ich dann nicht...

              1 Reply Last reply Reply Quote 0
              • G
                gammler2003 last edited by

                Hallo zusammen,

                das Script von @pix läuft bei mir schon länger einwandfrei. Heute habe ich erstmals Fehlermeldungen im Log festgestellt.

                javascript.0	2020-06-11 15:59:00.004	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:59:00.001	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:58:00.006	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:58:00.002	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:57:00.004	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:57:00.002	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:56:00.015	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:56:00.005	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:55:00.004	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:55:00.002	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:54:00.004	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:54:00.002	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:53:00.005	error	(2044) Cannot get astro date for "night"
                javascript.0	2020-06-11 15:53:00.002	error	(2044) Cannot get astro date for "nightEnd"
                javascript.0	2020-06-11 15:52:00.009	error	(2044) Cannot get astro date for "night"
                

                Bin ich der einzige, der diesen Fehler bekommt? Hat sich an der Astro-Funktion irgendetwas geändert?

                Vielen Dank für eure Hilfe.

                SKB 1 Reply Last reply Reply Quote 0
                • SKB
                  SKB Developer Most Active @gammler2003 last edited by

                  @gammler2003 aktuell kann aufgrund der Sommerzeit kein night und nightEnd via Astro abgefragt werden.

                  1 Reply Last reply Reply Quote 0
                  • Q
                    quorle last edited by

                    Muss mich wieder einklinken. Leider funktioniert nach den ganzen Updates die 24H Anzeige nicht mehr. Die Zeiten werden alle nur im 12H Format angezeigt. Gibt es eine Lösung?

                    R 1 Reply Last reply Reply Quote 0
                    • R
                      robert_r @quorle last edited by

                      Hallo, wenn ich den Code von @K_o_bold verwende, bekomme ich folgende Errormeldungen. Was passt da nicht? Danke

                      28.10.2020, 21:58:22.051	[info ]: javascript.0 (2880) Stop script script.js.common.Astro.Astro
                      28.10.2020, 21:58:23.110	[info ]: javascript.0 (2880) Start javascript script.js.common.Astro.Astro
                      28.10.2020, 21:58:23.131	[warn ]: javascript.0 (2880)     at getAstroday (script.js.common.Astro.Astro:647:3)
                      28.10.2020, 21:58:23.131	[warn ]: javascript.0 (2880)     at script.js.common.Astro.Astro:681:1
                      28.10.2020, 21:58:23.131	[info ]: javascript.0 (2880) script.js.common.Astro.Astro: registered 0 subscriptions and 11 schedules
                      28.10.2020, 21:58:26.124	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.125	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.126	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.127	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.127	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.131	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.150	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.151	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.153	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.154	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.154	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.156	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.157	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.157	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.159	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.160	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.160	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.162	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.163	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.163	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.165	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.166	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.166	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.168	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.189	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.189	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.191	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.192	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.192	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.193	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.194	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.194	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.197	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      28.10.2020, 21:58:26.198	[error]: javascript.0 (2880) script.js.common.Astro.Astro: The "getState" method cannot be used synchronously, because the adapter setting "Do not subscribe to all states on start" is enabled.
                      28.10.2020, 21:58:26.198	[error]: javascript.0 (2880) script.js.common.Astro.Astro: Please disable that setting or use "getState" with a callback, e.g.: getState("javascript.0.Astro.Astrotag", (err, state) => { ... });
                      28.10.2020, 21:58:26.200	[error]: javascript.0 (2880)     at Object.<anonymous> (script.js.common.Astro.Astro:579:42)
                      
                      paul53 1 Reply Last reply Reply Quote 0
                      • paul53
                        paul53 @robert_r last edited by paul53

                        @robert_r sagte):

                        Was passt da nicht?

                        In der Konfiguration der Javascript-Instanz:

                        Please disable that setting "Do not subscribe to all states on start"
                        
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        897
                        Online

                        31.9k
                        Users

                        80.1k
                        Topics

                        1.3m
                        Posts

                        72
                        349
                        91652
                        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