NEWS
FHEM hat WEEKDAYS, was hat IOBROKER?
-
Vielleicht ist eines der beiden Skripte für dich interessant:
https://forum.iobroker.net/topic/36578/vorlage-lightcontrol
https://forum.iobroker.net/topic/33228/vorlage-flexibles-timerskript-vis
@Dominik-F said in FHEM hat WEEKDAYS, was hat IOBROKER?:
https://forum.iobroker.net/topic/33228/vorlage-flexibles-timerskript-vis
Schaue ich mir an!
-
@FredF Wie installiere ich den .... klappt nicht so, wie ich mir das denke ....

Aber passieren tut nichts :(
@ch90045 sagte in FHEM hat WEEKDAYS, was hat IOBROKER?:
Wie installiere ich den .... klappt nicht so, wie ich mir das denke ....
Sorry, dachte im Thread zum Adapter ist geschrieben wie das geht... und vergaß das dieser Adapter noch nicht in der stable Repo ist...
Du warst schon mal richtig beim installieren aus eigener url... hättest nur den Reiter beliebig wählen und diese url https://github.com/walli545/ioBroker.time-switch eintragen müssen. Anschließend in der Adapteransicht mit dem Plus Zeichen ganz rechts noch eine Instanz hinzufügen müssen.
-
@ente34 sagte in FHEM hat WEEKDAYS, was hat IOBROKER?:
Übrigens war ich (auch?) zu dämlich, den adapter von github zu installieren.
Nach einer Installation von Github muss immer noch eine Instanz manuell erstellt werden.
Eine Adapterinstallation ist keine Instanziierung!https://www.iobroker.net/#de/documentation/tutorial/adapter.md
@ch90045 sagte in FHEM hat WEEKDAYS, was hat IOBROKER?:
nichts gegen IOB - aber das macht FHEM schon ganz smart.
und trotzdem wechselst du

-
Einfache Zeiten funktionieren, die Astrofunktionen schau ich mir noch an.
'use strict'; //const Galeriebeleuchtung = { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 60|08:00|on 0123456|{sunset(-7200,15:00,22:00)}|on 12345|{sunrise_abs+9000}|off 0123456|21:00|off 06|{sunrise_abs+15000}|off"}; const Galeriebeleuchtung = { id: "fritzdect.0.DECT200_5C:49:79:EF:51:FA.state", plan:"0123456|17:29|off 0123456|17:30|on"}; function SplitSchaltzeit(id,str) { let arr = str.split("|"); const days = arr[0].split('').join(','); if ( arr[1].match(/^\d?\d:\d\d$/) ){ let std_min = arr[1].split(':'); let sched_str = std_min[1].trim() + ' ' + std_min[0].trim() + " * * " + days; console.log("schedule( "+ sched_str); schedule(sched_str, function () { //console.log(id + ' '+arr[2]); setState(id, arr[2] === 'off' ? false : true); }); return; } // schedule((arr_std_min[1]).trim() + ' ' + (arr_std_min[0]).trim() + ' ' + '*' + ' ' + '*' + ' ' + wochen_tage.trim(), function () { // let is_feiertag = getState(id_is_feiertag).val; // if (id == cfg.id_05_45 || !is_feiertag) { // let aus_time = getAstroDate("sunrise", undefined, offset_sunrise); // FktLampeAnAus(id, aus_time, wann_str); // } // }); // for ( let a of arr) { // console.log(id+' '+a); // } } function SplitSchaltzeiten(idAndPlan) { let arr = idAndPlan.plan.split(" "); for ( let a of arr) { SplitSchaltzeit(idAndPlan.id,a); console.log("---------------"); } } SplitSchaltzeiten(Galeriebeleuchtung); -
Einfache Zeiten funktionieren, die Astrofunktionen schau ich mir noch an.
'use strict'; //const Galeriebeleuchtung = { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 60|08:00|on 0123456|{sunset(-7200,15:00,22:00)}|on 12345|{sunrise_abs+9000}|off 0123456|21:00|off 06|{sunrise_abs+15000}|off"}; const Galeriebeleuchtung = { id: "fritzdect.0.DECT200_5C:49:79:EF:51:FA.state", plan:"0123456|17:29|off 0123456|17:30|on"}; function SplitSchaltzeit(id,str) { let arr = str.split("|"); const days = arr[0].split('').join(','); if ( arr[1].match(/^\d?\d:\d\d$/) ){ let std_min = arr[1].split(':'); let sched_str = std_min[1].trim() + ' ' + std_min[0].trim() + " * * " + days; console.log("schedule( "+ sched_str); schedule(sched_str, function () { //console.log(id + ' '+arr[2]); setState(id, arr[2] === 'off' ? false : true); }); return; } // schedule((arr_std_min[1]).trim() + ' ' + (arr_std_min[0]).trim() + ' ' + '*' + ' ' + '*' + ' ' + wochen_tage.trim(), function () { // let is_feiertag = getState(id_is_feiertag).val; // if (id == cfg.id_05_45 || !is_feiertag) { // let aus_time = getAstroDate("sunrise", undefined, offset_sunrise); // FktLampeAnAus(id, aus_time, wann_str); // } // }); // for ( let a of arr) { // console.log(id+' '+a); // } } function SplitSchaltzeiten(idAndPlan) { let arr = idAndPlan.plan.split(" "); for ( let a of arr) { SplitSchaltzeit(idAndPlan.id,a); console.log("---------------"); } } SplitSchaltzeiten(Galeriebeleuchtung); -
@ch90045
Weil ich den Syntax so schön finde und das Script vielleicht auch selbst verwende:'use strict'; const Schaltplaene = [ /*Galeriebeleuchtung =*/ { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 06|08:00|on 0123456|sunset-7200,15:00,22:00|on 12345|sunrise+9000|off 0123456|21:00|off 06|sunrise+15000|off"}, /*Flurbeleuchtung =*/ { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 06|08:00|on 0123456|sunset-7200,15:00,22:00|on 12345|sunrise+9000|off 0123456|21:00|off 06|sunrise+15000|off"} ]; //const Galeriebeleuchtung = { id: "fritzdect.0.DECT200_5C:49:79:EF:51:FA.state", plan:"0123456|17:29|off 0123456|17:30|on"}; function SplitSchaltzeit(id, str) { let arr = str.split("|"); const days = arr[0].split('').join(','); const state = arr[2] === 'on' ? true : false; if (arr[1].match(/^\d?\d:\d\d$/)) { let std_min = arr[1].split(':'); let sched_str = std_min[1].trim() + ' ' + std_min[0].trim() + " * * " + days; console.log("schedule( " + sched_str + " )"); schedule(sched_str, function () { //console.log(id + ' '+arr[2]); setState(id, state); }); return; } let a = arr[1].match(/^(\w+)([+-]?\d+)?,?(\d?\d:\d\d)?,?(\d?\d:\d\d)?/); if (a != null) { const astro_fkt = a[1]; const astro_shift = a[2] != null ? parseInt(a[2])/60 : 0; const min_time = a[3]; const max_time = a[4]; console.log(a); switch (astro_fkt) { case "sunrise": case "sunriseEnd": case "goldenHourEnd": case "solarNoon": case "goldenHour": case "sunsetStart": case "sunset": case "dusk": case "nauticalDusk": case "night": case "nightEnd": case "nauticalDawn": case "dawn": case "nadir": break; default: console.error("Unknown Astro " + astro_fkt + " ignored!"); return; } console.log(astro_fkt + " shift: " + astro_shift); schedule({astro: astro_fkt, shift: astro_shift}, function () { if ( min_time != null ) { if (!compareTime(min_time,null,">=")) { // time < Min.Time return; } } if ( max_time != null ) { if (!compareTime(max_time,null,"<=")) { // time > Max.Time return; } } setState(id, state); }); } else { console.error("Cannot parse String " + arr[1] + " ignored!"); } } function SplitSchaltzeiten(idAndPlan) { let arr = idAndPlan.plan.split(" "); for ( let a of arr ) { SplitSchaltzeit(idAndPlan.id,a); console.log("---------------"); } } for ( let plan of Schaltplaene ) { SplitSchaltzeiten(plan); }; -
@ente34 sagte in FHEM hat WEEKDAYS, was hat IOBROKER?:
Übrigens war ich (auch?) zu dämlich, den adapter von github zu installieren.
Nach einer Installation von Github muss immer noch eine Instanz manuell erstellt werden.
Eine Adapterinstallation ist keine Instanziierung!https://www.iobroker.net/#de/documentation/tutorial/adapter.md
@ch90045 sagte in FHEM hat WEEKDAYS, was hat IOBROKER?:
nichts gegen IOB - aber das macht FHEM schon ganz smart.
und trotzdem wechselst du

-
@ch90045
Weil ich den Syntax so schön finde und das Script vielleicht auch selbst verwende:'use strict'; const Schaltplaene = [ /*Galeriebeleuchtung =*/ { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 06|08:00|on 0123456|sunset-7200,15:00,22:00|on 12345|sunrise+9000|off 0123456|21:00|off 06|sunrise+15000|off"}, /*Flurbeleuchtung =*/ { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 06|08:00|on 0123456|sunset-7200,15:00,22:00|on 12345|sunrise+9000|off 0123456|21:00|off 06|sunrise+15000|off"} ]; //const Galeriebeleuchtung = { id: "fritzdect.0.DECT200_5C:49:79:EF:51:FA.state", plan:"0123456|17:29|off 0123456|17:30|on"}; function SplitSchaltzeit(id, str) { let arr = str.split("|"); const days = arr[0].split('').join(','); const state = arr[2] === 'on' ? true : false; if (arr[1].match(/^\d?\d:\d\d$/)) { let std_min = arr[1].split(':'); let sched_str = std_min[1].trim() + ' ' + std_min[0].trim() + " * * " + days; console.log("schedule( " + sched_str + " )"); schedule(sched_str, function () { //console.log(id + ' '+arr[2]); setState(id, state); }); return; } let a = arr[1].match(/^(\w+)([+-]?\d+)?,?(\d?\d:\d\d)?,?(\d?\d:\d\d)?/); if (a != null) { const astro_fkt = a[1]; const astro_shift = a[2] != null ? parseInt(a[2])/60 : 0; const min_time = a[3]; const max_time = a[4]; console.log(a); switch (astro_fkt) { case "sunrise": case "sunriseEnd": case "goldenHourEnd": case "solarNoon": case "goldenHour": case "sunsetStart": case "sunset": case "dusk": case "nauticalDusk": case "night": case "nightEnd": case "nauticalDawn": case "dawn": case "nadir": break; default: console.error("Unknown Astro " + astro_fkt + " ignored!"); return; } console.log(astro_fkt + " shift: " + astro_shift); schedule({astro: astro_fkt, shift: astro_shift}, function () { if ( min_time != null ) { if (!compareTime(min_time,null,">=")) { // time < Min.Time return; } } if ( max_time != null ) { if (!compareTime(max_time,null,"<=")) { // time > Max.Time return; } } setState(id, state); }); } else { console.error("Cannot parse String " + arr[1] + " ignored!"); } } function SplitSchaltzeiten(idAndPlan) { let arr = idAndPlan.plan.split(" "); for ( let a of arr ) { SplitSchaltzeit(idAndPlan.id,a); console.log("---------------"); } } for ( let plan of Schaltplaene ) { SplitSchaltzeiten(plan); }; -
@ch90045
Weil ich den Syntax so schön finde und das Script vielleicht auch selbst verwende:'use strict'; const Schaltplaene = [ /*Galeriebeleuchtung =*/ { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 06|08:00|on 0123456|sunset-7200,15:00,22:00|on 12345|sunrise+9000|off 0123456|21:00|off 06|sunrise+15000|off"}, /*Flurbeleuchtung =*/ { id: "javascript.0.lampen.05_45", plan:"12345|08:30|on 06|08:00|on 0123456|sunset-7200,15:00,22:00|on 12345|sunrise+9000|off 0123456|21:00|off 06|sunrise+15000|off"} ]; //const Galeriebeleuchtung = { id: "fritzdect.0.DECT200_5C:49:79:EF:51:FA.state", plan:"0123456|17:29|off 0123456|17:30|on"}; function SplitSchaltzeit(id, str) { let arr = str.split("|"); const days = arr[0].split('').join(','); const state = arr[2] === 'on' ? true : false; if (arr[1].match(/^\d?\d:\d\d$/)) { let std_min = arr[1].split(':'); let sched_str = std_min[1].trim() + ' ' + std_min[0].trim() + " * * " + days; console.log("schedule( " + sched_str + " )"); schedule(sched_str, function () { //console.log(id + ' '+arr[2]); setState(id, state); }); return; } let a = arr[1].match(/^(\w+)([+-]?\d+)?,?(\d?\d:\d\d)?,?(\d?\d:\d\d)?/); if (a != null) { const astro_fkt = a[1]; const astro_shift = a[2] != null ? parseInt(a[2])/60 : 0; const min_time = a[3]; const max_time = a[4]; console.log(a); switch (astro_fkt) { case "sunrise": case "sunriseEnd": case "goldenHourEnd": case "solarNoon": case "goldenHour": case "sunsetStart": case "sunset": case "dusk": case "nauticalDusk": case "night": case "nightEnd": case "nauticalDawn": case "dawn": case "nadir": break; default: console.error("Unknown Astro " + astro_fkt + " ignored!"); return; } console.log(astro_fkt + " shift: " + astro_shift); schedule({astro: astro_fkt, shift: astro_shift}, function () { if ( min_time != null ) { if (!compareTime(min_time,null,">=")) { // time < Min.Time return; } } if ( max_time != null ) { if (!compareTime(max_time,null,"<=")) { // time > Max.Time return; } } setState(id, state); }); } else { console.error("Cannot parse String " + arr[1] + " ignored!"); } } function SplitSchaltzeiten(idAndPlan) { let arr = idAndPlan.plan.split(" "); for ( let a of arr ) { SplitSchaltzeit(idAndPlan.id,a); console.log("---------------"); } } for ( let plan of Schaltplaene ) { SplitSchaltzeiten(plan); };
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