Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Einsteigerfragen
    4. Astrozeiten wo?

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Astrozeiten wo?

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

      @olli_m sagte in Astrozeiten wo?:

      ich finde die Astrozeiten nicht mehr

      nicht mehr heisst quasi nach einem neuen Aufsetzen vom iob !?
      Astrozeiten im Detail gibt es nicht als "standard".
      Dazu bedarf es einem Skript. 😉

      // v0.2
      const suncalc = require('suncalc2');
      
      const prefix = '0_userdata.0';
      
      function fillAstroStates() {
         try {
             const systemConfig = getObject('system.config');
      
             // console.log(`Starting fillAstroStates with latitude: ${systemConfig.common.latitude} and longitude: ${systemConfig.common.longitude}`);
      
             const times = suncalc.getTimes(new Date(), systemConfig.common.latitude, systemConfig.common.longitude);
      
             for (var t in times) {
                 const h = times[t].getHours();
                 const m = times[t].getMinutes();
      
                 const timeFormatted = `${h < 10 ? '0' + h : h}:${m < 10 ? '0' + m : m}`;
                 const objId = `${prefix}.Astrozeiten.${t}`;
      
                 if (!existsObject(objId)) {
                     createState(objId, timeFormatted, { name: `Astro ${t}`, type: 'string', role: 'value' }); 
                 } else {
                     setState(objId, { val: timeFormatted, ack: true });
                 }
             }
         } catch (err) {
             console.error(err);
         }
      }
      
      // Refresh every day at 00:01
      schedule('1 0 * * *', fillAstroStates);
      
      // Run immediately after script start
      fillAstroStates();
      

      ? 1 Reply Last reply Reply Quote 1
      • ?
        A Former User @DJMarc75 last edited by

        @djmarc75 @Olli_M

        Nee, die sind seit javascript 7.x im Ordner javascript.0.variables.astro.

        e5fc6d60-72df-4603-a292-76113b18a6a3-image.png

        Olli_M DJMarc75 frankthegreat 3 Replies Last reply Reply Quote 4
        • Olli_M
          Olli_M @Guest last edited by Olli_M

          @ilovegym @DJMarc75
          die hab ich die aber nicht drin, also brauch ich auf jedenfalls das Script?

          Bildschirmfoto 2023-12-13 um 09.35.11.png

          Olli_M 1 Reply Last reply Reply Quote 0
          • Olli_M
            Olli_M @Olli_M last edited by Olli_M

            @DJMarc75 @ilovegym

            ich hab ja ein Blockly, auf welche Infos greift die Astro Funktion?

            wenn ich die Dateien unter variable Astro nicht habe...

            Bildschirmfoto 2023-12-13 um 09.38.34.png

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

              @olli_m sagte in Astrozeiten wo?:

              auf welche Infos greift die Astro Funktion?

              auf deinen Standort und das Datum.
              Dann werden die Astrozeiten berechnet

              Olli_M 1 Reply Last reply Reply Quote 0
              • DJMarc75
                DJMarc75 @Guest last edited by

                @ilovegym sagte in Astrozeiten wo?:

                seit javascript 7.x im Ordner javascript.0.variables.astro

                Gibts erst ab 7.3.0 - ist aber nicht stable

                7.3.02023-12-07
                
                    klein0rUpdated blockly logo* (klein0r) Always set variables like isDaylightSaving
                    klein0rAdded astro times as states* (klein0r) Fixed copied time blocks
                
                1 Reply Last reply Reply Quote 0
                • frankthegreat
                  frankthegreat @Guest last edited by

                  @ilovegym sagte in Astrozeiten wo?:

                  @djmarc75 @Olli_M

                  Nee, die sind seit javascript 7.x im Ordner javascript.0.variables.astro.

                  Hey, super. Ist irgendwie an mir vorbeigegangen.
                  Da kann ich ja wieder ein Script eliminieren. 👍

                  Danke für den Tipp.

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

                    @homoran
                    na ich wollte die DP sehen 😉

                    @DJMarc75

                    mit deinem Script hab ich jetzt unter 0.Userdata die ganzen infos....greift darauf dann JS zu im Blockly?

                    okay dann muss ich noch warten bis stable 🙂

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

                      @olli_m sagte in Astrozeiten wo?:

                      na ich wollte die DP sehen

                      das sollte in der Konfiguration deiner Javascript Instanz stehen

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

                        @homoran
                        ha dachte halt es gibt dafür auch Datenpunkte, aber klar kann in jedem drop down im JS Instanz durchklicken und es zeigt es mir darunter an ....

                        bahnuhr 1 Reply Last reply Reply Quote 0
                        • bahnuhr
                          bahnuhr Forum Testing Most Active @Olli_M last edited by

                          @olli_m

                          Die Info bekommst du schon lange per Script und sind im System vorhanden:

                              var sunset = getAstroDate("sunset");
                              var sunrise = getAstroDate("sunrise");
                          

                          Dafür brauchst du keine Extra DP.
                          Die 2 Zeilen in die Scripte einbauen und fertig.

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          774
                          Online

                          32.0k
                          Users

                          80.4k
                          Topics

                          1.3m
                          Posts

                          6
                          12
                          833
                          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