Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Kombinieren von Zeit und Lichwert (LUX)

NEWS

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

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

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

Kombinieren von Zeit und Lichwert (LUX)

Scheduled Pinned Locked Moved Skripten / Logik
8 Posts 2 Posters 928 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PeoplesP Offline
    PeoplesP Offline
    Peoples
    wrote on last edited by
    #1

    Hallo,

    ich möchte meine Rollos via script in Abhängigkeit des Lichtwertes und der Uhrzeit steuern, mit folgenden Bedingungen:

    • Immer auf 15% wenn Helligkeit kleiner als 150 Lux.

    • Immer um 22:30 geschlossen auf 0%

    • Werktags auf 100% wenn nach 6:30 Uhr und Helligkeit > 150 Lux.

    • Wochenende auf 100% wenn nach 9:00 Uhr und Helligkeit > 150 Lux.

    Nun mein Problem, mir ist klar wie ich die Helligkeit abfrage und auch wie ich die Uhrzeit abfrage, nur nicht wie ich beides kombiniere.

    Ich verwende folgendes:

    // Helligkeit über Bewegungsmelder
    on('hm-rpc.0.DEIN_BM.BRIGHTNESS', function (obj) {
        if (obj.newState.val > 150) jalousie_fahren("100");
    });
    
    // Über schedule Abragen der Uhrzeit 22:30 Uhr
    schedule("30 22 * * 1-7", function () {
        //log('Nachts zu');
        jalousie_fahren("0");
    });
    

    Kann mir mal einer auf die Sprünge helfen wie ich das kombinieren muss?

    Danke schonmal

    Peoples

    Ich beantworte keine Fragen zu Themen via PN

    1 Reply Last reply
    0
    • lobomauL Offline
      lobomauL Offline
      lobomau
      wrote on last edited by
      #2

      Könnte folgenderweise funktionieren:

      on({id: 'hm-rpc.0.MEQ0692930.1.BRIGHTNESS', change: "ne"}, function (obj) {
        var value = obj.state.val;
        var oldValue = obj.oldState.val;
        if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val < 150) {
          setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 15);
        }
      });
      
      schedule("30 22 * * *", function () {
        setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 0);
      });
      
      schedule("30 6 * * 1-5", function () {
        if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val > 150) {
          setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 100);
        }
      });
      
      schedule("0 9 * * 0,6", function () {
        if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val > 150) {
          setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 100);
        }
      });
      

      Javascript kann ich aber nicht. Hab es aus Blockly exportiert:

      ! <xml 1999/xmlns="<URL url=" http:/www.w3.org/xhtml"="">http://www.w3.org/1999/xhtml">
      ! <block type="on_ext" id="ZV69-!2CL@Mg=[%r(Y3=" x="38" y="38"><mutation items="1"></mutation>
      ! <field name="CONDITION">ne</field>
      ! <value name="OID0"><shadow type="field_oid" id="?S{^%^hpp,ORi[aZN_#?"><field name="oid">hm-rpc.0.MEQ0692930.1.BRIGHTNESS</field></shadow></value>
      ! <statement name="STATEMENT"><block type="controls_if" id="mHYL#at4mE#%|Tj)vdHq"><value name="IF0"><block type="logic_compare" id="OZ6]h2O~zwOpI~.yCSKh"><field name="OP">LT</field>
      ! <value name="A"><block type="get_value" id="Gi=d5hTTXCVZLUPabro5"><field name="ATTR">val</field>
      ! <field name="OID">hm-rpc.0.MEQ0692930.1.BRIGHTNESS</field></block></value>
      ! <value name="B"><block type="math_number" id="L/Xi~FQoK=jqMp/7Nyg"><field name="NUM">150</field></block></value></block></value>
      ! <statement name="DO0"><block type="control" id=")/}!~:]dw]IwCZVuzI"><mutation delay_input="false"></mutation>
      ! <field name="OID">hm-rpc.0.JEQ0116457.1.LEVEL</field>
      ! <field name="WITH_DELAY">FALSE</field>
      ! <value name="VALUE"><block type="math_number" id="N#.]WRNw;gzP5NBtt6y"><field name="NUM">15</field></block></value></block></statement></block></statement> ! <next><block type="schedule" id="WuD1NXjzZpW-jy?wM}X"><field name="SCHEDULE">30 22 * * </field>
      ! <statement name="STATEMENT"><block type="control" id="?Lyi
      Miz/wi}Zk-O+1RF"><mutation delay_input="false"></mutation>
      ! <field name="OID">hm-rpc.0.JEQ0116457.1.LEVEL</field>
      ! <field name="WITH_DELAY">FALSE</field>
      ! <value name="VALUE"><block type="math_number" id="J-2h6:w?LzV
      6/SX.!K?"><field name="NUM">0</field></block></value></block></statement>
      ! <next><block type="schedule" id="OXs]0.X9vWkHLVt69b|A"><field name="SCHEDULE">30 6 * * 1-5</field>
      ! <statement name="STATEMENT"><block type="controls_if" id="[5Rb2?qCi4:9X}Ac/K6^"><value name="IF0"><block type="logic_compare" id="n*;7eR7Xhzs[KQIZ;["><field name="OP">GT</field>
      ! <value name="A"><block type="get_value" id="iz]S{uT};,@HIF|s=4z"><field name="ATTR">val</field> ! <field name="OID">hm-rpc.0.MEQ0692930.1.BRIGHTNESS</field></block></value> ! <value name="B"><block type="math_number" id="RyUIMTc1u(nCT1L3k[Ip"><field name="NUM">150</field></block></value></block></value> ! <statement name="DO0"><block type="control" id="Vg];wO_s:Z47SSc5WP)"><mutation delay_input="false"></mutation>
      ! <field name="OID">hm-rpc.0.JEQ0116457.1.LEVEL</field>
      ! <field name="WITH_DELAY">FALSE</field>
      ! <value name="VALUE"><block type="math_number" id="^daj]F9Rt,9*r%:gh1i|"><field name="NUM">100</field></block></value></block></statement></block></statement>
      ! <next><block type="schedule" id="l8F6Gayrsa]JE_!CVZ!["><field name="SCHEDULE">0 9 * * 0,6</field>
      ! <statement name="STATEMENT"><block type="controls_if" id="tHze[:P%0]?f!9d_h7XX"><value name="IF0"><block type="logic_compare" id="`2x/eLZh]jT:*8Skz1}V"><field name="OP">GT</field>
      ! <value name="A"><block type="get_value" id="T:-Ke4@j_5cJuz[b%Awq"><field name="ATTR">val</field>
      ! <field name="OID">hm-rpc.0.MEQ0692930.1.BRIGHTNESS</field></block></value>
      ! <value name="B"><block type="math_number" id="{5NW@J^b46SJ^@7sQl)G"><field name="NUM">150</field></block></value></block></value>
      ! <statement name="DO0"><block type="control" id="B=S[;!IKb0cN)e(Ogggb"><mutation delay_input="false"></mutation>
      ! <field name="OID">hm-rpc.0.JEQ0116457.1.LEVEL</field>
      ! <field name="WITH_DELAY">FALSE</field>
      ! <value name="VALUE"><block type="math_number" id="pOhm/*VvIn{=F2PtPww,"><field name="NUM">100</field></block></value></block></statement></block></statement></block></next></block></next></block></next></block></xml>
      1146_unbenannt.jpg

      Host: NUC8i3 mit Proxmox:

      • ioBroker CT Debian 13, npm 10.9.4, nodejs 22.21.0
      • Slave: Pi4
      1 Reply Last reply
      0
      • PeoplesP Offline
        PeoplesP Offline
        Peoples
        wrote on last edited by
        #3

        Diesen Ansatz hatte ich auch schon aber ich denke dass das so nicht funktioniert weil:

        Wenn -> nach 6:30 Uhr -> und -> Helligkeit über 150 Lux -> dann Rollo hoch

        Aber was ist wenn es um 6:30 Uhr noch nicht hell genug ist, dann wäre die Bedingung ja falsch und somit passiert nichts.

        Die Frage die sich mir nun stellt, wird die schedule Funktion erneut ausgeführt nach 6:30 und somit die if-Bedingung erneut ausgeführt oder nur um 6:30 Uhr und dann nicht mehr?

        Ich beantworte keine Fragen zu Themen via PN

        1 Reply Last reply
        0
        • lobomauL Offline
          lobomauL Offline
          lobomau
          wrote on last edited by
          #4

          @peoples:

          Diesen Ansatz hatte ich auch schon aber ich denke dass das so nicht funktioniert weil:

          Wenn -> nach 6:30 Uhr -> und -> Helligkeit über 150 Lux -> dann Rollo hoch

          Aber was ist wenn es um 6:30 Uhr noch nicht hell genug ist, dann wäre die Bedingung ja falsch und somit passiert nichts.

          Die Frage die sich mir nun stellt, wird die schedule Funktion erneut ausgeführt nach 6:30 und somit die if-Bedingung erneut ausgeführt oder nur um 6:30 Uhr und dann nicht mehr? `
          Nur um 6:30 Uhr und dann nicht mehr.

          Host: NUC8i3 mit Proxmox:

          • ioBroker CT Debian 13, npm 10.9.4, nodejs 22.21.0
          • Slave: Pi4
          1 Reply Last reply
          0
          • lobomauL Offline
            lobomauL Offline
            lobomau
            wrote on last edited by
            #5

            @lobomau:

            @peoples:

            Diesen Ansatz hatte ich auch schon aber ich denke dass das so nicht funktioniert weil:

            Wenn -> nach 6:30 Uhr -> und -> Helligkeit über 150 Lux -> dann Rollo hoch

            Aber was ist wenn es um 6:30 Uhr noch nicht hell genug ist, dann wäre die Bedingung ja falsch und somit passiert nichts.

            Die Frage die sich mir nun stellt, wird die schedule Funktion erneut ausgeführt nach 6:30 und somit die if-Bedingung erneut ausgeführt oder nur um 6:30 Uhr und dann nicht mehr? Nur um 6:30 Uhr und dann nicht mehr.
            Dann so:

            on({id: 'hm-rpc.0.MEQ0692930.1.BRIGHTNESS', change: "ne"}, function (obj) {
              var value = obj.state.val;
              var oldValue = obj.oldState.val;
              if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val < 150) {
                setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 15);
              }
            });
            schedule("30 22 * * *", function () {
              setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 0);
            });
            on({id: 'hm-rpc.0.MEQ0692930.1.BRIGHTNESS', change: "ne"}, function (obj) {
              var value = obj.state.val;
              var oldValue = obj.oldState.val;
              if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val > 150 && compareTime("06:30", "22:30", "between")) {
                setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 100);
              }
            });
            on({id: 'hm-rpc.0.MEQ0692930.1.BRIGHTNESS', change: "ne"}, function (obj) {
              var value = obj.state.val;
              var oldValue = obj.oldState.val;
              if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val > 150 && compareTime("09:00", "22:30", "between")) {
                setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 100);
              }
            });
            

            1146_unbenannt.jpg

            Host: NUC8i3 mit Proxmox:

            • ioBroker CT Debian 13, npm 10.9.4, nodejs 22.21.0
            • Slave: Pi4
            1 Reply Last reply
            0
            • PeoplesP Offline
              PeoplesP Offline
              Peoples
              wrote on last edited by
              #6

              Super Lösung!

              Hier fehlt aber noch die Wochentag bzw. Wochenende Abfrage oder?

              Wenn man es um:

              daytype = new Date().getDay();
                  if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val > 150 && compareTime("06:30", "22:30", "between") && (daytype !== 0 || daytype != 6 )) {
                  setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 100);
              
              

              erweitert solle es funktionieren.

              Vielen Dank auf jeden Fall, ich werde es später mal probieren und berichten.

              Peoples

              Ich beantworte keine Fragen zu Themen via PN

              1 Reply Last reply
              0
              • PeoplesP Offline
                PeoplesP Offline
                Peoples
                wrote on last edited by
                #7

                So die endgültige Version sieht jetzt so aus:

                var Wohnz_Tuerkontakt = getState("hm-rpc.0.NEQXXX.1.STATE").val;/*Drehgriffkontakt.Wohnz.Tuer.NEQXXX:1.STATE*/
                
                function jalousie_fahren(Wunsch_Level) {
                    if(getState("hm-rpc.0.NEQXXX.1.LEVEL").val != Wunsch_Level)
                    {
                        setTimeout(function(){setState("hm-rpc.0.NEQXXX.1.LEVEL", Wunsch_Level);}, 1000);/*Jalousieaktor.Kueche.Fenster.NEQXXX:1.LEVEL*/
                    }
                    if(getState("hm-rpc.0.NEQXXX.1.LEVEL").val != Wunsch_Level)
                    {
                        setTimeout(function(){setState("hm-rpc.0.NEQXXX.1.LEVEL", Wunsch_Level);}, 2000);/*Jalousieaktor.Kueche.Fenster.NEQXXX:1.LEVEL*/
                    }
                    if(getState("hm-rpc.0.NEQXXX.1.LEVEL").val != Wunsch_Level) 
                    {
                        setTimeout(function(){setState("hm-rpc.0.NEQXXX.1.LEVEL", Wunsch_Level);}, 3000);/*Jalosieaktor.Wohnz.Fenster.NEQXXX:1.LEVEL*/
                    }
                    if(getState("hm-rpc.0.NEQXXX.1.LEVEL").val != Wunsch_Level) 
                    {
                        setTimeout(function(){setState("hm-rpc.0.NEQXXX.1.LEVEL", Wunsch_Level);}, 4000);/*Jalousieaktor.Wohnz.NEQXXX:1.LEVEL*/
                    }
                    if((getState("hm-rpc.0.NEQXXX.1.LEVEL").val != Wunsch_Level) && (Wohnz_Tuerkontakt == "0")) 
                    {
                        setTimeout(function(){setState("hm-rpc.0.NEQXXX.1.LEVEL", Wunsch_Level);}, 5000);/*Jalousieaktor.Wohnz.Terrassentuere.NEQXXX:1.LEVEL*/
                    }
                }
                
                on("hm-rpc.0.XXX.1.LUX", function (obj) {/*Lichtsensor.Aussen.NEQXXX:1.LUX*/
                    daytype = new Date().getDay();
                    if (  (getState("hm-rpc.0.NEQXXX.1.LUX").val > 150  && (daytype !== 0 || daytype != 6 ) && compareTime("06:30", "22:30", "between")) 
                       || (getState("hm-rpc.0.NEQXXX.1.LUX").val > 150  && (daytype === 0 || daytype == 6 ) && compareTime("09:00", "22:30", "between")) )
                    {
                        jalousie_fahren("100");
                    }
                    if (getState("hm-rpc.0.NEQXXX.1.LUX").val < 150)
                    {
                        jalousie_fahren("15");
                    }
                });
                
                // Über schedule Abragen der Uhrzeit 22:30 Uhr
                schedule("30 22 * * 1-7", function () {
                    //log('Nachts zu');
                    jalousie_fahren("0");
                });
                

                Werde im Lauf des nächsten Tages sehen ob das funktioniert :D

                Ich beantworte keine Fragen zu Themen via PN

                1 Reply Last reply
                0
                • lobomauL Offline
                  lobomauL Offline
                  lobomau
                  wrote on last edited by
                  #8

                  @peoples:

                  Super Lösung!

                  Hier fehlt aber noch die Wochentag bzw. Wochenende Abfrage oder?

                  Wenn man es um:

                  daytype = new Date().getDay();
                      if (getState("hm-rpc.0.MEQ0692930.1.BRIGHTNESS").val > 150 && compareTime("06:30", "22:30", "between") && (daytype !== 0 || daytype != 6 )) {
                      setState("hm-rpc.0.JEQ0116457.1.LEVEL"/*Rollo_Kueche:1.LEVEL*/, 100);
                  
                  

                  erweitert solle es funktionieren.

                  Vielen Dank auf jeden Fall, ich werde es später mal probieren und berichten.

                  Peoples `
                  Ja, stimmt. Aus Versehen rausgeworfen. Aber in Kombination sollte es dann gehen. Viel Erfolg beim Testen :)

                  Host: NUC8i3 mit Proxmox:

                  • ioBroker CT Debian 13, npm 10.9.4, nodejs 22.21.0
                  • Slave: Pi4
                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  594

                  Online

                  32.8k

                  Users

                  82.7k

                  Topics

                  1.3m

                  Posts
                  Community
                  Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                  ioBroker Community 2014-2025
                  logo
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Home
                  • Recent
                  • Tags
                  • Unread 0
                  • Categories
                  • Unreplied
                  • Popular
                  • GitHub
                  • Docu
                  • Hilfe