Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. FHEM hat WEEKDAYS, was hat IOBROKER?

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    FHEM hat WEEKDAYS, was hat IOBROKER?

    This topic has been deleted. Only users with topic management privileges can see it.
    • Dominik F.
      Dominik F. @ch90045 last edited by

      @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

      ch90045 1 Reply Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @ente34 last edited by

        @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 E 2 Replies Last reply Reply Quote 0
        • ch90045
          ch90045 @Dominik F. last edited by

          @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 Reply Last reply Reply Quote 0
          • FredF
            FredF Most Active Forum Testing @ch90045 last edited by

            @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 Reply Last reply Reply Quote 0
            • ch90045
              ch90045 @Homoran last edited by

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

              1 Reply Last reply Reply Quote 0
              • E
                ente34 @ch90045 last edited by

                @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);
                
                
                ch90045 1 Reply Last reply Reply Quote 0
                • ch90045
                  ch90045 @ente34 last edited by

                  @ente34 Danke, vergiss den Schnickschnack mit den Astrofunktionen 😉

                  E 1 Reply Last reply Reply Quote 0
                  • E
                    ente34 @ch90045 last edited by

                    @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 2 Replies Last reply Reply Quote 0
                    • E
                      ente34 @Homoran last edited by

                      @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 Reply Last reply Reply Quote 0
                      • ch90045
                        ch90045 @ente34 last edited by

                        @ente34 Hammer!

                        1 Reply Last reply Reply Quote 0
                        • ch90045
                          ch90045 @ente34 last edited by

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

                          1 Reply Last reply Reply Quote 0
                          • E
                            ente34 last edited by

                            @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 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            879
                            Online

                            32.0k
                            Users

                            80.4k
                            Topics

                            1.3m
                            Posts

                            7
                            23
                            1100
                            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