Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Einsteigerfragen
    4. [gelöst] Datenpunkt für Sonnenaufgang u.-untergang erzeugen

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    [gelöst] Datenpunkt für Sonnenaufgang u.-untergang erzeugen

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

      Hallo Community,

      ich schaffe es leider nicht ein Script zu erstellen, welches mir Datenpunkte für Sonnenauf- und Untergang erstellt, welche ich dann auf meiner Ulanzi (awtrix light) über den awtrix light adapter auf dem Display anzeigen lassen kann.

      Könnte mir evtl. jemand dabei behilflich sein?

      Alle Scripte die ich im Netz gefunden habe, haben nicht funktioniert - was natürlich auch an mir liegen kann, weil ich davon keine Ahnung habe.

      Ich danke euch schon mal.

      Gruß
      DJ

      Meister Mopper FredF DJMarc75 3 Replies Last reply Reply Quote 0
      • Meister Mopper
        Meister Mopper @ih8sn0w last edited by

        @ih8sn0w

        Die Werte kannst du jeden Tag (z. B. um 00:07 Uhr) mit z. B. einem Blockly in String-Datenpunkte unter 0_userdata.0 schreiben und den Datenpunkt zur Visualisierung verwenden.

        Ich nutze Blockly:

        c00e2d0b-ee47-49c1-b961-c150e5441b01-grafik.png

        1 Reply Last reply Reply Quote 0
        • FredF
          FredF Most Active Forum Testing @ih8sn0w last edited by

          @ih8sn0w Vielleicht nutzt du auch Adapter wie shuttercontrol oder uv-protect, die stellen sunrise und sunset als Datenpunkt zur Verfügung

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

            @ih8sn0w hier mal ein vorzügliches Skript von @haus-automatisierung 😉

            // 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 0
            • I
              ih8sn0w last edited by ih8sn0w

              @fredf
              da ich für Scripte anscheinend zu doof bin 😞 habe ich es jetzt mit dem uv Adapter gelöst. Ich danke dir Fred

              Mein Dank geht natürlich auch an alle anderen

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

                @ih8sn0w sagte in Datenpunkt für Sonnenaufgang und -untergang erzeugen:

                da ich für Scripte anscheinend zu doof bin

                JavaSkript Adapter öffnen, neues JavaSkript unter dem Ordner "Common" erstellen, Code einfügen, Skript speichern, starten und fertig.

                Falls das Thema für Dich gelöst ist dann editiere bitte Deinen Startbeitrag (den Titel) mit einem [gelöst] vorangestellt 😉

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

                Support us

                ioBroker
                Community Adapters
                Donate

                937
                Online

                31.6k
                Users

                79.5k
                Topics

                1.3m
                Posts

                4
                6
                240
                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