Skip to content
  • 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
Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Gesucht: Script: Sonnenwinkel berechnen?

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.1k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.8k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.1k

Gesucht: Script: Sonnenwinkel berechnen?

Scheduled Pinned Locked Moved Skripten / Logik
101 Posts 27 Posters 27.4k Views 7 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.
  • paul53P paul53

    @t-c-0
    Stimmen die Ortskoordinaten? Hänge mal an das Skriptende eine Log-Ausgabe dran:

    log('Lat: ' + lat + ' °, Long: ' + long + ' °');
    
    T. C. 0T Offline
    T. C. 0T Offline
    T. C. 0
    wrote on last edited by
    #86

    @paul53 said in Gesucht: Script: Sonnenwinkel berechnen?:

    log('Lat: ' + lat + ' °, Long: ' + long + ' °');

    Hallo Paul, heraus kommt:

    2021-07-04 14:02:13.669 - info: javascript.0 (2557) Start javascript script.js.common.Steuerung.Astroskript
    2021-07-04 14:02:13.677 - info: javascript.0 (2557) script.js.common.Steuerung.Astroskript: registered 0 subscriptions and 1 schedule
    2021-07-04 14:03:00.004 - info: javascript.0 (2557) script.js.common.Steuerung.Astroskript: Lat: °, Long: °

    Wo kann man die Koordinaten angeben ? Wenn ich in den Instanzen von javascript schaue, ist zumindest meine Adresse angezeigt.

    Gruß
    Thiemo

    paul53P 1 Reply Last reply
    0
    • T. C. 0T T. C. 0

      @paul53 said in Gesucht: Script: Sonnenwinkel berechnen?:

      log('Lat: ' + lat + ' °, Long: ' + long + ' °');

      Hallo Paul, heraus kommt:

      2021-07-04 14:02:13.669 - info: javascript.0 (2557) Start javascript script.js.common.Steuerung.Astroskript
      2021-07-04 14:02:13.677 - info: javascript.0 (2557) script.js.common.Steuerung.Astroskript: registered 0 subscriptions and 1 schedule
      2021-07-04 14:03:00.004 - info: javascript.0 (2557) script.js.common.Steuerung.Astroskript: Lat: °, Long: °

      Wo kann man die Koordinaten angeben ? Wenn ich in den Instanzen von javascript schaue, ist zumindest meine Adresse angezeigt.

      Gruß
      Thiemo

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

      @t-c-0 sagte: ist zumindest meine Adresse angezeigt.

      Dann verwende die Daten aus der System-Konfiguration (Ersatz für Zeilen 5 bis 7):

      const config = getObject('system.config');
      const lat = config.common.latitude;
      const long = config.common.longitude;
      

      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

      T. C. 0T 1 Reply Last reply
      1
      • paul53P paul53

        @t-c-0 sagte: ist zumindest meine Adresse angezeigt.

        Dann verwende die Daten aus der System-Konfiguration (Ersatz für Zeilen 5 bis 7):

        const config = getObject('system.config');
        const lat = config.common.latitude;
        const long = config.common.longitude;
        
        T. C. 0T Offline
        T. C. 0T Offline
        T. C. 0
        wrote on last edited by
        #88

        @paul53

        Hallo! es scheint nun mehr zu stimmen, wobei mir auf der oben genannten Seite 265° angezeigt wird.
        Aus IOBroker nun 254°

        Dennoch besser als vorher 🙂

        Danke

        T. C. 0T 1 Reply Last reply
        0
        • T. C. 0T T. C. 0

          @paul53

          Hallo! es scheint nun mehr zu stimmen, wobei mir auf der oben genannten Seite 265° angezeigt wird.
          Aus IOBroker nun 254°

          Dennoch besser als vorher 🙂

          Danke

          T. C. 0T Offline
          T. C. 0T Offline
          T. C. 0
          wrote on last edited by
          #89

          @t-c-0

          Alles klar, beim aktualisieren hat sich die GMT verstellt. Also stimmen die Werte nun überein, danke!

          1 Reply Last reply
          0
          • HomoranH Homoran

            Danke,

            habe ich in die Skriptsammlung eingefügt:

            http://www.iobroker.net/docu/?page_id=57&lang=de

            Gruß

            Rainer

            K Offline
            K Offline
            klassisch
            Most Active
            wrote on last edited by klassisch
            #90

            @homoran sagte in Gesucht: Script: Sonnenwinkel berechnen?:

            habe ich in die Skriptsammlung eingefügt:

            http://www.iobroker.net/docu/?page_id=57&lang=de

            ERROR
            Cannot GET /docu/
            

            Umgezogen?

            1 Reply Last reply
            0
            • HomoranH Do not disturb
              HomoranH Do not disturb
              Homoran
              Global Moderator Administrators
              wrote on last edited by
              #91

              @klassisch sagte in Gesucht: Script: Sonnenwinkel berechnen?:

              Umgezogen?

              nicht wirlich! seit 2018/2020 offline und noch kein neues Zuhause

              kein Support per PN! - Fragen im Forum stellen - es gibt fast nichts, was nicht auch für andere interessant ist.

              Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.

              der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

              1 Reply Last reply
              0
              • bahnuhrB Online
                bahnuhrB Online
                bahnuhr
                Forum Testing Most Active
                wrote on last edited by
                #92

                anbei mal ein Script von ursprünglich pix; was ich dann erweitert habe mit den Monddaten:

                
                // Sonnenstand Script von pix
                // erweitert mit Moon durch bahnuhr
                
                const suncalc = require('suncalc');
                const result = getObject("system.adapter.javascript.0");
                const lat = result.native.latitude;
                const long = result.native.longitude;
                const idSonneEle = 'javascript.0.System.Sonne_Mond.Sonne_Elevation';
                const idSonneAzi = 'javascript.0.System.Sonne_Mond.Sonne_Azimut';
                const idMondEle = 'javascript.0.System.Sonne_Mond.Mond_Elevation';
                const idMondAzi = 'javascript.0.System.Sonne_Mond.Mond_Azimut';
                 
                createState(idSonneEle, 0, {type: 'number', unit: '°'});
                createState(idSonneAzi, 0, {type: 'number', unit: '°'});
                createState(idMondEle, 0, {type: 'number', unit: '°'});
                createState(idMondAzi, 0, {type: 'number', unit: '°'});
                
                function Stand_berechnen () {
                    var now = new Date();
                    var sunpos = suncalc.getPosition(now, lat, long);
                    var h = sunpos.altitude * 180 / Math.PI;
                    var a = sunpos.azimuth * 180 / Math.PI + 180;
                    setState(idSonneEle, Math.round(10 * h) / 10, true);
                    setState(idSonneAzi, Math.round(Math.round(10 * a) / 10), true);
                 
                    var moonpos = suncalc.getMoonPosition(now, lat, long);
                    var h = moonpos.altitude * 180 / Math.PI;
                    var a = moonpos.azimuth * 180 / Math.PI + 180;
                    setState(idMondEle, Math.round(10 * h) / 10, true);
                    setState(idMondAzi, Math.round(Math.round(10 * a) / 10), true);
                 
                    log ("Sonne: Azimut: " + getState(idSonneAzi).val + "° / Sonne: Elevation: " + getState(idSonneEle).val + "° / Mond: Azimut: " + getState(idMondAzi).val + "° / Mond: Elevation: " + getState(idMondEle).val + "°");
                }
                 
                schedule('23 */4 * * * *', Stand_berechnen); // jede 4. Minute
                
                

                Für alle die es gebrauchen wollen.


                Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                Danke.
                gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                ScreenToGif :https://www.screentogif.com/downloads.html

                1 Reply Last reply
                2
                • bahnuhrB Online
                  bahnuhrB Online
                  bahnuhr
                  Forum Testing Most Active
                  wrote on last edited by
                  #93

                  und in vis dann so:

                  881a46f8-d7bf-4754-a009-e45b85c6a0eb-image.png


                  Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                  Danke.
                  gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                  ScreenToGif :https://www.screentogif.com/downloads.html

                  K 1 Reply Last reply
                  1
                  • bahnuhrB bahnuhr

                    und in vis dann so:

                    881a46f8-d7bf-4754-a009-e45b85c6a0eb-image.png

                    K Offline
                    K Offline
                    klassisch
                    Most Active
                    wrote on last edited by
                    #94

                    @bahnuhr cool, Vielen Dank!

                    bahnuhrB 1 Reply Last reply
                    1
                    • K klassisch

                      @bahnuhr cool, Vielen Dank!

                      bahnuhrB Online
                      bahnuhrB Online
                      bahnuhr
                      Forum Testing Most Active
                      wrote on last edited by
                      #95

                      @klassisch sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                      @bahnuhr cool, Vielen Dank!

                      wenn du was brauchst, sag Bescheid.


                      Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                      Danke.
                      gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                      ScreenToGif :https://www.screentogif.com/downloads.html

                      cashC K 2 Replies Last reply
                      0
                      • bahnuhrB bahnuhr

                        @klassisch sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                        @bahnuhr cool, Vielen Dank!

                        wenn du was brauchst, sag Bescheid.

                        cashC Offline
                        cashC Offline
                        cash
                        Most Active
                        wrote on last edited by
                        #96

                        @bahnuhr wofür kann man den denn stand des mondes gebrauchen? Den Sonnenstand für Licht oder Rollos ist soweit klar aber Mond? Kann ich daraus noch etwas schließen oder ist es nur für die Visualisierung?

                        bahnuhrB 1 Reply Last reply
                        0
                        • bahnuhrB bahnuhr

                          @klassisch sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                          @bahnuhr cool, Vielen Dank!

                          wenn du was brauchst, sag Bescheid.

                          K Offline
                          K Offline
                          klassisch
                          Most Active
                          wrote on last edited by
                          #97

                          @bahnuhr sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                          @klassisch sagte in Gesucht: Script: Sonnenwinkel berechnen?:
                          wenn du was brauchst, sag Bescheid.

                          Vielen Dank, scheint zu laufen. Ich vergleche mal mit https://www.sonnenverlauf.de/

                          1 Reply Last reply
                          0
                          • cashC cash

                            @bahnuhr wofür kann man den denn stand des mondes gebrauchen? Den Sonnenstand für Licht oder Rollos ist soweit klar aber Mond? Kann ich daraus noch etwas schließen oder ist es nur für die Visualisierung?

                            bahnuhrB Online
                            bahnuhrB Online
                            bahnuhr
                            Forum Testing Most Active
                            wrote on last edited by
                            #98

                            @cash sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                            wofür kann man den denn stand des mondes gebrauchen?

                            Damit ich immer weiß in welche Richtung in schauen muss 😉


                            Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                            Danke.
                            gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                            ScreenToGif :https://www.screentogif.com/downloads.html

                            O 1 Reply Last reply
                            0
                            • bahnuhrB bahnuhr

                              @cash sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                              wofür kann man den denn stand des mondes gebrauchen?

                              Damit ich immer weiß in welche Richtung in schauen muss 😉

                              O Away
                              O Away
                              oFbEQnpoLKKl6mbY5e13
                              wrote on last edited by
                              #99

                              @bahnuhr

                              Woher bekommst du denn die anderen Informationen wie Sonnenaufgang usw.?

                              bahnuhrB K 2 Replies Last reply
                              0
                              • O oFbEQnpoLKKl6mbY5e13

                                @bahnuhr

                                Woher bekommst du denn die anderen Informationen wie Sonnenaufgang usw.?

                                bahnuhrB Online
                                bahnuhrB Online
                                bahnuhr
                                Forum Testing Most Active
                                wrote on last edited by
                                #100

                                @ofbeqnpolkkl6mby5e13 sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                                @bahnuhr

                                Woher bekommst du denn die anderen Informationen wie Sonnenaufgang usw.?

                                Adapter: dasWetter


                                Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                                Danke.
                                gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                                ScreenToGif :https://www.screentogif.com/downloads.html

                                1 Reply Last reply
                                1
                                • O oFbEQnpoLKKl6mbY5e13

                                  @bahnuhr

                                  Woher bekommst du denn die anderen Informationen wie Sonnenaufgang usw.?

                                  K Offline
                                  K Offline
                                  klassisch
                                  Most Active
                                  wrote on last edited by
                                  #101

                                  @ofbeqnpolkkl6mby5e13 sagte in Gesucht: Script: Sonnenwinkel berechnen?:

                                  Woher bekommst du denn die anderen Informationen wie Sonnenaufgang usw.?

                                  Nicht immer ganz leicht zu finden, steht aber in der Doc zum JS Adapter

                                  https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md

                                  Following values can be used as attribute in astro-function:

                                  "sunrise": sunrise (top edge of the sun appears on the horizon)
                                  "sunriseEnd": sunrise ends (bottom edge of the sun touches the horizon)
                                  "goldenHourEnd": morning golden hour (soft light, best time for photography) ends
                                  "solarNoon": solar noon (sun is in the highest position)
                                  "goldenHour": evening golden hour starts
                                  "sunsetStart": sunset starts (bottom edge of the sun touches the horizon)
                                  "sunset": sunset (sun disappears below the horizon, evening civil twilight starts)
                                  "dusk": dusk (evening nautical twilight starts)
                                  "nauticalDusk": nautical dusk (evening astronomical twilight starts)
                                  "night": night starts (dark enough for astronomical observations)
                                  "nightEnd": night ends (morning astronomical twilight starts)
                                  "nauticalDawn": nautical dawn (morning nautical twilight starts)
                                  "dawn": dawn (morning nautical twilight ends, morning civil twilight starts)
                                  "nadir": nadir (darkest moment of the night, sun is in the lowest position)
                                  

                                  Note: to use "astro"-function the "latitude" and "longitude" must be defined in javascript adapter settings.

                                  Note: On some places sometimes it could be so, that no night/nightEnd exists. Please read here about it.

                                  Note: you can use "on" function for schedule with small modification:

                                  on({time: "*/2 * * * *"}, function () {
                                  log((new Date()).toString() + " - Will be triggered every 2 minutes!");
                                  });

                                  on({time: {hour: 12, minute: 30}}, function () {
                                  log((new Date()).toString() + " - Will be triggered at 12:30!");
                                  });

                                  on({astro: "sunset", shift: 10}, function () {
                                  log((new Date()).toString() + " - 10 minutes after sunset!");
                                  });

                                  ENDE Zitat aus der Doc

                                  1 Reply Last reply
                                  1
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate

                                  417

                                  Online

                                  32.4k

                                  Users

                                  81.4k

                                  Topics

                                  1.3m

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

                                  • Don't have an account? Register

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