Weiter zum Inhalt
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Hell
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dunkel
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Blockly
  5. FHEM hat WEEKDAYS, was hat IOBROKER?

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    705

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    5.8k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.5k

FHEM hat WEEKDAYS, was hat IOBROKER?

Geplant Angeheftet Gesperrt Verschoben Blockly
23 Beiträge 7 Kommentatoren 1.4k Aufrufe 3 Beobachtet
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • ch90045C ch90045

    @FredF Wie installiere ich den .... klappt nicht so, wie ich mir das denke ....
    40838aa5-2cb3-4670-9d1f-706aa62456fa-image.png

    Aber passieren tut nichts :(

    E Offline
    E Offline
    ente34
    schrieb am zuletzt editiert von
    #10

    @ch90045
    Übrigens war ich (auch?) zu dämlich, den adapter von github zu installieren.
    Ich musste noch die Kommandozeile bemühen, um eine Instanz zu erzeugen.

    pi@raspi-iobroker:~ $ iobroker add  time-switch
    Adapter "system.adapter.vis.0" restarted.
    host.raspi-iobroker create instance time-switch
    host.raspi-iobroker object system.adapter.time-switch.0.sigKill created
    host.raspi-iobroker object system.adapter.time-switch.0.eventLoopLag created
    host.raspi-iobroker object system.adapter.time-switch.0.outputCount created
    host.raspi-iobroker object system.adapter.time-switch.0.inputCount created
    host.raspi-iobroker object system.adapter.time-switch.0.uptime created
    host.raspi-iobroker object system.adapter.time-switch.0.memRss created
    host.raspi-iobroker object system.adapter.time-switch.0.memHeapTotal created
    host.raspi-iobroker object system.adapter.time-switch.0.memHeapUsed created
    host.raspi-iobroker object system.adapter.time-switch.0.cputime created
    host.raspi-iobroker object system.adapter.time-switch.0.cpu created
    host.raspi-iobroker object system.adapter.time-switch.0.compactMode created
    host.raspi-iobroker object system.adapter.time-switch.0.connected created
    host.raspi-iobroker object system.adapter.time-switch.0.alive created
    host.raspi-iobroker object system.adapter.time-switch.0 created
    pi@raspi-iobroker:~ $
    
    ch90045C HomoranH 2 Antworten Letzte Antwort
    0
    • E ente34

      @ch90045
      Übrigens war ich (auch?) zu dämlich, den adapter von github zu installieren.
      Ich musste noch die Kommandozeile bemühen, um eine Instanz zu erzeugen.

      pi@raspi-iobroker:~ $ iobroker add  time-switch
      Adapter "system.adapter.vis.0" restarted.
      host.raspi-iobroker create instance time-switch
      host.raspi-iobroker object system.adapter.time-switch.0.sigKill created
      host.raspi-iobroker object system.adapter.time-switch.0.eventLoopLag created
      host.raspi-iobroker object system.adapter.time-switch.0.outputCount created
      host.raspi-iobroker object system.adapter.time-switch.0.inputCount created
      host.raspi-iobroker object system.adapter.time-switch.0.uptime created
      host.raspi-iobroker object system.adapter.time-switch.0.memRss created
      host.raspi-iobroker object system.adapter.time-switch.0.memHeapTotal created
      host.raspi-iobroker object system.adapter.time-switch.0.memHeapUsed created
      host.raspi-iobroker object system.adapter.time-switch.0.cputime created
      host.raspi-iobroker object system.adapter.time-switch.0.cpu created
      host.raspi-iobroker object system.adapter.time-switch.0.compactMode created
      host.raspi-iobroker object system.adapter.time-switch.0.connected created
      host.raspi-iobroker object system.adapter.time-switch.0.alive created
      host.raspi-iobroker object system.adapter.time-switch.0 created
      pi@raspi-iobroker:~ $
      
      ch90045C Offline
      ch90045C Offline
      ch90045
      schrieb am zuletzt editiert von
      #11

      @ente34 DANKE - CLI ist mir meist auch lieber (ausser bei 36 Schaltzeiten definieren)

      E 1 Antwort Letzte Antwort
      0
      • ch90045C ch90045

        Frohes Neues allen IOBroklern,

        ich ziehe gerade auf Grund des WAFs von FHEM zum IOB um und vermisse eine Sache schmerzlich, den Weekdaytimer. Hier ein Beispiel:

        	
        DEF	
        Galeriebeleuchtung 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
        

        Was mir folgenden einfachen Zeitplan für mein Device Galeriebeleuchtung gibt:

        Profil 0: Sonntag
        08:00:00 on, 12:06:57 off, 15:20:38 on, 21:00:00 off,
        Profil 1: Montag
        08:30:00 on, 10:26:57 off, 15:20:38 on, 21:00:00 off,
        Profil 2: Dienstag
        08:30:00 on, 10:26:57 off, 15:20:38 on, 21:00:00 off,
        Profil 3: Mittwoch
        08:30:00 on, 10:26:57 off, 15:20:38 on, 21:00:00 off,
        Profil 4: Donnerstag
        08:30:00 on, 10:26:57 off, 15:20:38 on, 21:00:00 off,
        Profil 5: Freitag
        08:30:00 on, 10:26:57 off, 15:20:38 on, 21:00:00 off,
        Profil 6: Samstag
        08:00:00 on, 12:06:57 off, 15:20:38 on, 21:00:00 off,
        

        Also on/off ganz einfach in EINER Zeile definiert. Gibt es so etwas auch im IOB?

        Gruss

        Christian

        Dominik F.D Offline
        Dominik F.D Offline
        Dominik F.
        schrieb am zuletzt editiert von
        #12

        @ch90045

        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

        ch90045C 1 Antwort Letzte Antwort
        0
        • E ente34

          @ch90045
          Übrigens war ich (auch?) zu dämlich, den adapter von github zu installieren.
          Ich musste noch die Kommandozeile bemühen, um eine Instanz zu erzeugen.

          pi@raspi-iobroker:~ $ iobroker add  time-switch
          Adapter "system.adapter.vis.0" restarted.
          host.raspi-iobroker create instance time-switch
          host.raspi-iobroker object system.adapter.time-switch.0.sigKill created
          host.raspi-iobroker object system.adapter.time-switch.0.eventLoopLag created
          host.raspi-iobroker object system.adapter.time-switch.0.outputCount created
          host.raspi-iobroker object system.adapter.time-switch.0.inputCount created
          host.raspi-iobroker object system.adapter.time-switch.0.uptime created
          host.raspi-iobroker object system.adapter.time-switch.0.memRss created
          host.raspi-iobroker object system.adapter.time-switch.0.memHeapTotal created
          host.raspi-iobroker object system.adapter.time-switch.0.memHeapUsed created
          host.raspi-iobroker object system.adapter.time-switch.0.cputime created
          host.raspi-iobroker object system.adapter.time-switch.0.cpu created
          host.raspi-iobroker object system.adapter.time-switch.0.compactMode created
          host.raspi-iobroker object system.adapter.time-switch.0.connected created
          host.raspi-iobroker object system.adapter.time-switch.0.alive created
          host.raspi-iobroker object system.adapter.time-switch.0 created
          pi@raspi-iobroker:~ $
          
          HomoranH Nicht stören
          HomoranH Nicht stören
          Homoran
          Global Moderator Administrators
          schrieb am zuletzt editiert von
          #13

          @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 😂

          kein Support per PN! - Fragen im Forum stellen -
          Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
          Das Forum freut sich über eine Spende. Benutzt dazu den Spendenbutton oben rechts. Danke!
          der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

          ch90045C E 2 Antworten Letzte Antwort
          0
          • Dominik F.D Dominik F.

            @ch90045

            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

            ch90045C Offline
            ch90045C Offline
            ch90045
            schrieb am zuletzt editiert von
            #14

            @Dominik-F said in FHEM hat WEEKDAYS, was hat IOBROKER?:

            https://forum.iobroker.net/topic/33228/vorlage-flexibles-timerskript-vis

            Schaue ich mir an!

            1 Antwort Letzte Antwort
            0
            • ch90045C ch90045

              @FredF Wie installiere ich den .... klappt nicht so, wie ich mir das denke ....
              40838aa5-2cb3-4670-9d1f-706aa62456fa-image.png

              Aber passieren tut nichts :(

              FredFF Online
              FredFF Online
              FredF
              Most Active Forum Testing
              schrieb am zuletzt editiert von
              #15

              @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.

              1 Antwort Letzte Antwort
              0
              • HomoranH Homoran

                @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 😂

                ch90045C Offline
                ch90045C Offline
                ch90045
                schrieb am zuletzt editiert von
                #16

                @Homoran Ja, Visualisierung ist nicht gerade die Stärke von FHEM ... ganz schlecht für den WAF

                1 Antwort Letzte Antwort
                0
                • ch90045C ch90045

                  @ente34 DANKE - CLI ist mir meist auch lieber (ausser bei 36 Schaltzeiten definieren)

                  E Offline
                  E Offline
                  ente34
                  schrieb am zuletzt editiert von
                  #17

                  @ch90045

                  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);
                  
                  
                  ch90045C 1 Antwort Letzte Antwort
                  0
                  • E ente34

                    @ch90045

                    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);
                    
                    
                    ch90045C Offline
                    ch90045C Offline
                    ch90045
                    schrieb am zuletzt editiert von
                    #18

                    @ente34 Danke, vergiss den Schnickschnack mit den Astrofunktionen ;)

                    E 1 Antwort Letzte Antwort
                    0
                    • ch90045C ch90045

                      @ente34 Danke, vergiss den Schnickschnack mit den Astrofunktionen ;)

                      E Offline
                      E Offline
                      ente34
                      schrieb am zuletzt editiert von
                      #19

                      @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);
                      };
                      
                      ch90045C 2 Antworten Letzte Antwort
                      0
                      • HomoranH Homoran

                        @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 😂

                        E Offline
                        E Offline
                        ente34
                        schrieb am zuletzt editiert von
                        #20

                        @Homoran
                        Danke für den Link. Ich habe es mir noch mal angeschaut.
                        Bisher habe ich (selten) bestehende Adapter über Githup ge-upgraded. Eine komplette Neuinstallation von Github hatte ich noch nicht

                        1 Antwort Letzte Antwort
                        0
                        • E ente34

                          @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);
                          };
                          
                          ch90045C Offline
                          ch90045C Offline
                          ch90045
                          schrieb am zuletzt editiert von
                          #21

                          @ente34 Hammer!

                          1 Antwort Letzte Antwort
                          0
                          • E ente34

                            @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);
                            };
                            
                            ch90045C Offline
                            ch90045C Offline
                            ch90045
                            schrieb am zuletzt editiert von
                            #22

                            @ente34 Kannst du mir kurz mal sagen, wo ich mein "Device" in dem JS hinterlegen muss?

                            1 Antwort Letzte Antwort
                            0
                            • E Offline
                              E Offline
                              ente34
                              schrieb am zuletzt editiert von
                              #23

                              @ch90045
                              Gerne, bei id den zu schaltenden state angeben:

                              const Galeriebeleuchtung = { id: "fritzdect.0.DECT200_5C:49:79:EF:51:FA.state", plan:"0123456|17:29|off 0123456|17:30|on"};
                              
                              1 Antwort Letzte Antwort
                              0

                              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
                              Antworten
                              • In einem neuen Thema antworten
                              Anmelden zum Antworten
                              • Älteste zuerst
                              • Neuste zuerst
                              • Meiste Stimmen


                              Support us

                              ioBroker
                              Community Adapters
                              Donate

                              575

                              Online

                              32.7k

                              Benutzer

                              82.6k

                              Themen

                              1.3m

                              Beiträge
                              Community
                              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                              ioBroker Community 2014-2025
                              logo
                              • Anmelden

                              • Du hast noch kein Konto? Registrieren

                              • Anmelden oder registrieren, um zu suchen
                              • Erster Beitrag
                                Letzter Beitrag
                              0
                              • Home
                              • Aktuell
                              • Tags
                              • Ungelesen 0
                              • Kategorien
                              • Unreplied
                              • Beliebt
                              • GitHub
                              • Docu
                              • Hilfe