NEWS
Script für Mondphase
-
@paul53
Du hast mal ein Script erstellt für die Mondphase.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 MinutenSo weit ich erkennen kann, ist das fast das was ich benötige.
Leider habe ich keine Erfahrung in Java.
Kann man das so umschrieben, das 2 Datenpunkte Mond_State und Mond_Text bei den Anderen Astrodaten beschrieben werden? -
@paul53
Du hast mal ein Script erstellt für die Mondphase.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 MinutenSo weit ich erkennen kann, ist das fast das was ich benötige.
Leider habe ich keine Erfahrung in Java.
Kann man das so umschrieben, das 2 Datenpunkte Mond_State und Mond_Text bei den Anderen Astrodaten beschrieben werden?@berges01 sagte: 2 Datenpunkte Mond_State und Mond_Text bei den Anderen Astrodaten
const suncalc = require('suncalc'); const idState = 'variables.astro.moonState'; // Für Vis const idText = 'variables.astro.moonText'; const states = { 0: 'Neumond', 1: 'Viertelmond zu', 2: 'Halbmond zu', 3: 'Dreiviertelmond zu', 4: 'Vollmond', 5: 'Dreiviertelmond ab', 6: 'Halbmond ab', 7: 'Viertelmond ab' }; createState(idState, 0, { name: 'Mond Status', type: 'number', min: 0, max: 7, role: 'value', read: true, write: false, states: states }); createState(idText, '', { name: 'Mond Text', type: 'string', role: 'text', read: true, write: false }); function mpVis() { const mond = suncalc.getMoonIllumination(new Date()); const mp = mond.phase; let 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(idState, state, true); setState(idText, states[state], true); } setTimeout(mpVis, 200); // Skriptstart schedule("*/10 * * * *", mpVis); // alle 10 Minuten -
@berges01 sagte: 2 Datenpunkte Mond_State und Mond_Text bei den Anderen Astrodaten
const suncalc = require('suncalc'); const idState = 'variables.astro.moonState'; // Für Vis const idText = 'variables.astro.moonText'; const states = { 0: 'Neumond', 1: 'Viertelmond zu', 2: 'Halbmond zu', 3: 'Dreiviertelmond zu', 4: 'Vollmond', 5: 'Dreiviertelmond ab', 6: 'Halbmond ab', 7: 'Viertelmond ab' }; createState(idState, 0, { name: 'Mond Status', type: 'number', min: 0, max: 7, role: 'value', read: true, write: false, states: states }); createState(idText, '', { name: 'Mond Text', type: 'string', role: 'text', read: true, write: false }); function mpVis() { const mond = suncalc.getMoonIllumination(new Date()); const mp = mond.phase; let 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(idState, state, true); setState(idText, states[state], true); } setTimeout(mpVis, 200); // Skriptstart schedule("*/10 * * * *", mpVis); // alle 10 Minuten
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden