NEWS
Suche Skript für Mondphase
-
Vorschlag:
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 Minuten -
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)
-
Die Icons stecken im icons-mfd-png Adapter.
-
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 -
Selber Ausscheiden :P
~~<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~~
-
Hallo,
ich nutze die images aus dem VClouds Weahter 2: https://www.deviantart.com/vclouds/art/ … -179058977
1662_moonimages.zip
1662_3.png -
So siehts bei uns aus…

-
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
-
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:1Kenn mich als Anfänger noch nicht so mit JS & Co. aus.
Danke