Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Suche Skript für Mondphase

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Suche Skript für Mondphase

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

      Im oben genannten Script hast du an der Stelle

      var mond = suncalc.getMoonIllumination(new Date());
      

      in mond.phase die aktuelle Mondphase in Dezimalzahlen zwischen 0.0 und 1.0 stehen, wobei 0 Neumond und 0.5 Vollmond ist. Wenn du dahingegen den aktuellen Prozentwert der beleuchteten Mondfläche (egal ob abnehmend oder zunehmend) suchst, kannst du dir diesen aus mond.fraction auslesen. Hier ist dann 0.0 Neumond, 0.5 Halbmond und 1.0 Vollmond. (siehe Doku unter https://www.npmjs.com/package/suncalc#moon-illumination)

      1 Reply Last reply Reply Quote 0
      • C
        chriwo last edited by

        Ich habe noch eine Frage dazu. Kann ich auch irgendwie das Datum des nächsten Vollmondes berechnen und ausgeben lassen?

        Danke 🙂

        1 Reply Last reply Reply Quote 0
        • Chaot
          Chaot last edited by

          Das ist ein perfektes Script und auch eine Klasse Idee.

          Gibt es für die Mondphasen auch irgendwo ein Iconset? Das wäre noch perfekt.

          1 Reply Last reply Reply Quote 0
          • L
            Linedancer last edited by

            Die Icons stecken im icons-mfd-png Adapter.

            1 Reply Last reply Reply Quote 0
            • Chaot
              Chaot last edited by

              Danke.

              Die habe ich gefunden.

              Schade das scheinbar keine weiteren Iconsets existieren. Muss ich mir wohl selber was basteln

              1 Reply Last reply Reply Quote 0
              • Chaot
                Chaot last edited by

                Ok, schnell mal selber zurechtgeschnibbelt. Falls die jemand brauchen sollte.

                Die anderen gefallen mir nicht so sehr.
                5779_voll4.png
                5779_viertelab7.png
                5779_halbab6.png
                5779_dreiviertelab5.png
                5779_dreiviertelzu3.png
                5779_halbzu2.png
                5779_viertelzu1.png
                5779_neumond0.png

                1 Reply Last reply Reply Quote 0
                • Dutchman
                  Dutchman Developer Most Active Administrators last edited by

                  Selber Ausscheiden 😛

                  ~~![](</s><URL url=)<link_text text="https://uploads.tapatalk-cdn.com/201809 ... 5ddbd0.jpg">https://uploads.tapatalk-cdn.com/20180930/a91f2a644e35db5f47a5b1f55a5ddbd0.jpg</link_text>" />

                  Sent from my iPhone using Tapatalk~~

                  1 Reply Last reply Reply Quote 0
                  • C
                    chriwo last edited by

                    Eine Frage zum Skript: Bei mir zeigt er in der VIS beim Einfügen der Variable Vis.Mondphase statt der Mondphase nur die Zahl an. Kann ich irgendwie einstellen, dass hier der Text angezeigt wird?

                    1 Reply Last reply Reply Quote 0
                    • A
                      Annuit20 last edited by

                      Hallo,

                      ich nutze die images aus dem VClouds Weahter 2: https://www.deviantart.com/vclouds/art/ … -179058977
                      1662_moonimages.zip
                      1662_3.png

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

                        So siehts bei uns aus…

                        4229_moon.jpg

                        1 Reply Last reply Reply Quote 0
                        • C
                          chriwo last edited by

                          und wie hast Du Dein Script und die VIS aufgebaut? 🙂

                          1 Reply Last reply Reply Quote 0
                          • Negalein
                            Negalein Global Moderator last edited by

                            Hallo

                            Habe dank Sigi soeben diesen Thread entdeckt.

                            Dazu hätt ich als Anfänger gleich mal eine Frage.

                            Muss ich die Mondbilder in einen bestimmten Ordner geben, damit das Script darauf zugreifen kann?

                            Danke

                            1 Reply Last reply Reply Quote 0
                            • Negalein
                              Negalein Global Moderator last edited by

                              Bins nochmal!

                              Ich hab dieses Script als JS erstellt.

                              [/const suncalc = require('suncalc');
                              const idVis = 'Vis.Mondphase'; // Für Vis
                              
                              createState(idVis, 0, {
                              type: 'number',
                              min: 0,
                              max: 7,
                              role: 'level',
                              states: {
                              0: 'Neumond',
                              1: 'Viertelmond zu',
                              2: 'Halbmond zu',
                              3: 'Dreiviertelmond zu',
                              4: 'Vollmond',
                              5: 'Dreiviertelmond ab',
                              6: 'Halbmond ab',
                              7: 'Viertelmond ab'
                              } 
                              });
                              
                              function mpVis() {
                              var mond = suncalc.getMoonIllumination(new Date());
                              var mp = mond.phase;
                              var state = 0; 
                              if(mp > 0.05) state = 1;
                              if(mp > 0.2) state = 2;
                              if(mp > 0.3) state = 3;
                              if(mp > 0.45) state = 4;
                              if(mp > 0.55) state = 5;
                              if(mp > 0.7) state = 6;
                              if(mp > 0.8) state = 7;
                              if(mp > 0.95) state = 0;
                              setState(idVis, state, true);
                              }
                              
                              mpVis(); // Skriptstart
                              
                              schedule("*/10 * * * *", mpVis); // alle 10 Minutenspoiler]
                              

                              Wenn ich es starte, kommt folgende Fehlermeldung und ich seh nichts in den Objekten unter Javascript.0

                              21:38:16.315	[info]	javascript.0 Start javascript script.js.common.Mondphasen
                              21:38:16.315	[error]	javascript.0 script.js.common.Mondphasen compile failed: at script.js.common.Mondphasen:1
                              

                              Kenn mich als Anfänger noch nicht so mit JS & Co. aus.

                              Danke

                              1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 last edited by

                                Am Skriptanfang sind zwei störende Zeichen: [/

                                Richtig:

                                const suncalc = require('suncalc');
                                
                                1 Reply Last reply Reply Quote 0
                                • Chaot
                                  Chaot last edited by

                                  Was sollen die beiden Zeichen am Anfang vom Script:

                                  `[/[/code]`
                                  
                                  Edit - Ok Paul ist eindeutig schneller  :D
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • Negalein
                                    Negalein Global Moderator last edited by

                                    @paul53:

                                    Am Skriptanfang sind zwei störende Zeichen: [/

                                    Richtig:

                                    const suncalc = require('suncalc');
                                    ```` `  
                                    

                                    Danke, das wars!

                                    1 Reply Last reply Reply Quote 0
                                    • StM47
                                      StM47 last edited by

                                      @Annuit20:

                                      Hallo,

                                      ich nutze die images aus dem VClouds Weahter 2: https://www.deviantart.com/vclouds/art/ … -179058977 `

                                      Hi,

                                      sehr schöne Grafiken.

                                      Leider sind nur 8 Bilder enthalten.

                                      Hat jemand ähnliche Bilder für alle Mondphasen?

                                      EDIT: Habe mir aus folgender Vorlage selber welche gebastelt.

                                      ! 9039_alle_mondphasen.jpg

                                      9039_mond_neu.zip

                                      B spicer 2 Replies Last reply Reply Quote 0
                                      • B
                                        bitstorm66 @StM47 last edited by

                                        @stm47

                                        Ich habe mich an dem Script für die Mondphase versucht. Das ging auch ganz gut und ich habe es erweitert auf 28 Varianten.

                                        Soweit so gut, ich habe nun das Script einem image8 Widget angehängt, aber wie krieg ich die Daten nun an das Widget. Die 28 Icons sind angehängt im Widget aber es verändert sich nichts.

                                        Da ich ganz neuer iobroker User bin ist das ganze noch ein wenig Neuland und ich brauch einen Moment bis ich die Logik verstehe.

                                        1. Habe ich das Script am richtigen Ort?
                                        2. Wie krieg ich die Daten ins Widget?
                                        3. Was muss in die Object ID des Widgets

                                        Danke zum Voraus

                                        spicer 1 Reply Last reply Reply Quote 0
                                        • spicer
                                          spicer @StM47 last edited by spicer

                                          @stm47
                                          Schöne Mondbilder. Aber hättest den Vollmond auch noch?
                                          Das hier ist ein Blutmond (bei einer Mondfinsternis).

                                          Edit:
                                          Hab einen kreiert ^^
                                          FullMoon2.png

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

                                            @spicer
                                            Habe noch ein paar Mondphasen hinzugefügt.

                                            const suncalc = require('suncalc');
                                            const idVis = 'Vis.Mondphase';  // Für Vis
                                             
                                            
                                            createState(idVis, 0, {
                                               type: 'number',
                                               min: 0,
                                               max: 15,
                                               role: 'level',
                                               states: {
                                                  0: 'Neumond',
                                                  1: 'Achtelmond zu',
                                                  2: 'Viertelmond zu',
                                                  3: 'DreiAchtelmond zu',
                                                  4: 'Halbmond zu',
                                                  5: 'FunfAchtelmond zu',
                                                  6: 'Dreiviertelmond zu',
                                                  7: 'SiebenAchtelmond zu',
                                                  8: 'Vollmond',
                                                  9: 'SiebenAchtelmond ab',
                                                  10: 'Dreiviertelmond ab',
                                                  11: 'FunfAchtelmond ab',
                                                  12: 'Halbmond ab',
                                                  13: 'DreiAchtelmond ab',
                                                  14: 'Viertelmond ab',
                                                  15: 'Achtelmond ab'
                                               }   
                                            });
                                             
                                            
                                            function mpVis() {
                                               var mond = suncalc.getMoonIllumination(new Date());
                                               var mp = mond.phase;
                                               var state = 0; 
                                               if(mp > 0.04) state = 1;
                                               if(mp > 0.10) state = 2;
                                               if(mp > 0.20) state = 3;
                                               if(mp > 0.25) state = 4;
                                               if(mp > 0.30) state = 5;
                                               if(mp > 0.38) state = 6;
                                               if(mp > 0.43) state = 7;
                                               if(mp > 0.49) state = 8;
                                               if(mp > 0.55) state = 9;
                                               if(mp > 0.62) state = 10;
                                               if(mp > 0.70) state = 11;
                                               if(mp > 0.75) state = 12;
                                               if(mp > 0.80) state = 13;
                                               if(mp > 0.86) state = 14;
                                               if(mp > 0.92) state = 15;
                                               if(mp > 0.97) state = 0;
                                               setState(idVis, state, true);
                                            }
                                             
                                            
                                            mpVis(); // Skriptstart
                                             
                                            
                                            schedule("*/10 * * * *", mpVis);  // alle 10 Minuten
                                            
                                            

                                            Und die Mond-Icons etwas aufgeräumt.
                                            mond_icons.zip

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            696
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            14
                                            31
                                            8091
                                            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