Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. isAstroDay=true trotz "sunset"

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    756

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    6.1k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.5k

isAstroDay=true trotz "sunset"

Scheduled Pinned Locked Moved Skripten / Logik
3 Posts 2 Posters 316 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephan80
    wrote on last edited by Stephan80
    #1

    Re: [gelöst]Astro abhängig schedule verändern

    Grüß euch,

    ich rufe bei "sunrise" und bei "sunset" ein Script auf, in dem ich nochmals validiere, ob isAstroDay() true od. false ist. Nun habe ich bemerkt, dass bei Sonnenuntergang (sunset) isAstroDay()=true zurückliefert. Kann sein, dass sich hier um ein paar Millisekunden die Zeiten überschneiden, weshalb isAstroDay() kurzzeitig noch true sein kann?

    const setSchedule = async function () {
        if (isAstroDay()) {
            // Do something
        } else {
            // Do something
        })
    }
    
    schedule({ astro: "sunrise", shift: 0 }, setSchedule);
    schedule({ astro: "sunset", shift: 0 }, setSchedule);
    

    LG
    Stephan

    paul53P 1 Reply Last reply
    0
    • S Stephan80

      Re: [gelöst]Astro abhängig schedule verändern

      Grüß euch,

      ich rufe bei "sunrise" und bei "sunset" ein Script auf, in dem ich nochmals validiere, ob isAstroDay() true od. false ist. Nun habe ich bemerkt, dass bei Sonnenuntergang (sunset) isAstroDay()=true zurückliefert. Kann sein, dass sich hier um ein paar Millisekunden die Zeiten überschneiden, weshalb isAstroDay() kurzzeitig noch true sein kann?

      const setSchedule = async function () {
          if (isAstroDay()) {
              // Do something
          } else {
              // Do something
          })
      }
      
      schedule({ astro: "sunrise", shift: 0 }, setSchedule);
      schedule({ astro: "sunset", shift: 0 }, setSchedule);
      

      LG
      Stephan

      paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by paul53
      #2

      @stephan80 sagte: bemerkt, dass bei Sonnenuntergang (sunset) isAstroDay()=true zurückliefert.

      Das kann ich nicht bestätigen. In meinem Testskript

      var timer = null;
      schedule({ astro: "sunset", shift: 0 }, function() {
          if(isAstroDay()) {
              log('Astroday: true');
              timer = setInterval(function() {
                  if(!isAstroDay()) {
                      log('Astroday: false');
                      clearInterval(timer);
                  }
              }, 100);
          } else log('SU: false');
      });
      

      liefert isAstroDay() false im Sunset-Trigger.

      18:34:21.797	info	javascript.0 (16976) script.js.common.Neuer_Test: SU: false
      

      In der Praxis wird man nicht beides zusammen anwenden.

      const setSchedule = async function (hell) {
          if (hell) {
              // Do something
          } else {
              // Do something
          })
      }
       
      schedule({ astro: "sunrise", shift: 0 }, function() {
          setSchedule(true);
      });
      schedule({ astro: "sunset", shift: 0 }, function() {
          setSchedule(false);
      });
      

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Stephan80
        wrote on last edited by
        #3

        @paul53 Danke für den Hinweis. Das ist eine weitaus schönere Lösung! Habe ich soeben übernommen und warte nun auf sunset :)

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        Support us

        ioBroker
        Community Adapters
        Donate

        545

        Online

        32.8k

        Users

        82.7k

        Topics

        1.3m

        Posts
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
        ioBroker Community 2014-2025
        logo
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Home
        • Recent
        • Tags
        • Unread 0
        • Categories
        • Unreplied
        • Popular
        • GitHub
        • Docu
        • Hilfe