Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] Licht mit Verzögerung ausschalten.

    NEWS

    • influxdb/sql/history Major Updates Beta

    • Status Node.js 18

    • js-controller 4.0.x im STABLE!

    [gelöst] Licht mit Verzögerung ausschalten.

    This topic has been deleted. Only users with topic management privileges can see it.
    • Uli977
      Uli977 @paul53 last edited by Uli977

      @paul53

      <xml xmlns="http://www.w3.org/1999/xhtml">
       <variables>
         <variable type="undefined" id="timeout">timeout</variable>
       </variables>
       <block type="on_ext" id="()rF8eg~_nv|@%r_t@l!" x="63" y="-362">
         <mutation items="1"></mutation>
         <field name="CONDITION">any</field>
         <field name="ACK_CONDITION"></field>
         <value name="OID0">
           <shadow type="field_oid" id="6Y;9D}Z!PiPyc#BVC3Sn">
             <field name="oid">hm-rpc.2.000C18A991E745.1.PRESENCE_DETECTION_STATE</field>
           </shadow>
         </value>
         <statement name="STATEMENT">
           <block type="comment" id="6C}}Nm0LdWg`qBcPQs=l">
             <field name="COMMENT">Licht bei Bewegung einschalten Tag</field>
             <next>
               <block type="controls_if" id="Em6VP]DMX0)j`HBDpn4T">
                 <mutation elseif="1"></mutation>
                 <value name="IF0">
                   <block type="logic_operation" id="^ZL=)#)EKrjkmXK00oRv" inline="false">
                     <field name="OP">AND</field>
                     <value name="A">
                       <block type="logic_operation" id="{rX]/J_h|59@ox7qfK[$" inline="false">
                         <field name="OP">AND</field>
                         <value name="A">
                           <block type="logic_compare" id="wUIsoy,AK2(cNuSO?:a_">
                             <field name="OP">EQ</field>
                             <value name="A">
                               <block type="get_value" id="3Iy!J4J+7P~{0:p_k+%?">
                                 <field name="ATTR">val</field>
                                 <field name="OID">hm-rpc.2.000C18A991E745.1.PRESENCE_DETECTION_STATE</field>
                               </block>
                             </value>
                             <value name="B">
                               <block type="logic_boolean" id="%-sy1^e#(#}(aZn^f+-p">
                                 <field name="BOOL">TRUE</field>
                               </block>
                             </value>
                           </block>
                         </value>
                         <value name="B">
                           <block type="logic_compare" id="y]OGHe(0aA@juG^Ya:!D">
                             <field name="OP">LT</field>
                             <value name="A">
                               <block type="get_value" id="+rgDI=(Y$VNuU@mpT+Vd">
                                 <field name="ATTR">val</field>
                                 <field name="OID">hm-rpc.2.000C18A991E745.1.ILLUMINATION</field>
                               </block>
                             </value>
                             <value name="B">
                               <block type="math_number" id=",aU`$,~n2^$Cxv?yRcno">
                                 <field name="NUM">12</field>
                               </block>
                             </value>
                           </block>
                         </value>
                       </block>
                     </value>
                     <value name="B">
                       <block type="time_compare" id="$:W{[kvL_XyIW7-X;L:;">
                         <mutation end_time="true"></mutation>
                         <field name="OPTION">between</field>
                         <field name="START_TIME">06:00</field>
                         <field name="END_TIME">19:00</field>
                       </block>
                     </value>
                   </block>
                 </value>
                 <statement name="DO0">
                   <block type="timeouts_cleartimeout" id="0(i*XD0y2d,]1{(;G$)b">
                     <field name="NAME">timeout</field>
                     <next>
                       <block type="control" id="=ElWff*!BnA64}B1JLo`">
                         <mutation delay_input="false"></mutation>
                         <field name="OID">hue.0.Philips_hue.1OG_Lampe_Flur.level</field>
                         <field name="WITH_DELAY">FALSE</field>
                         <value name="VALUE">
                           <block type="math_number" id="RpNNcLxvmS[dn0;|/Q]E">
                             <field name="NUM">100</field>
                           </block>
                         </value>
                       </block>
                     </next>
                   </block>
                 </statement>
                 <value name="IF1">
                   <block type="logic_compare" id="EYc7^_gFV:mgQRq.G:57">
                     <field name="OP">EQ</field>
                     <value name="A">
                       <block type="get_value" id="TK*~!wE#hFcWwb9/pYld">
                         <field name="ATTR">val</field>
                         <field name="OID">hm-rpc.2.000C18A991E745.1.PRESENCE_DETECTION_STATE</field>
                       </block>
                     </value>
                     <value name="B">
                       <block type="logic_boolean" id="ZA%V(4G3.C=,9Ib6M-`A">
                         <field name="BOOL">FALSE</field>
                       </block>
                     </value>
                   </block>
                 </value>
                 <statement name="DO1">
                   <block type="timeouts_cleartimeout" id="U0GS}.C;?+oNLWN|:s@k">
                     <field name="NAME">timeout</field>
                     <next>
                       <block type="timeouts_settimeout" id="ZQyqnK5^zAhZ40EK@:5/">
                         <field name="NAME">timeout</field>
                         <field name="DELAY">15</field>
                         <field name="UNIT">sec</field>
                         <statement name="STATEMENT">
                           <block type="control" id="-AtLf/t|*#vd|E.,qBee">
                             <mutation delay_input="false"></mutation>
                             <field name="OID">hue.0.Philips_hue.1OG_Lampe_Flur.level</field>
                             <field name="WITH_DELAY">FALSE</field>
                             <value name="VALUE">
                               <block type="math_number" id="yq9lSwl`3xH|~)P]`HE%">
                                 <field name="NUM">0</field>
                               </block>
                             </value>
                           </block>
                         </statement>
                       </block>
                     </next>
                   </block>
                 </statement>
                 <next>
                   <block type="comment" id="U`QzH4,$UBmgN:Onq8bU">
                     <field name="COMMENT">Licht bei Bewegung einschalten Abend/Nacht </field>
                     <next>
                       <block type="controls_if" id="G#7j+4p*6X5I)EgPSe7o" disabled="true">
                         <mutation elseif="1"></mutation>
                         <value name="IF0">
                           <block type="logic_operation" id="h;QYoLN,wlf*m7M9$n@g" inline="false">
                             <field name="OP">AND</field>
                             <value name="A">
                               <block type="logic_operation" id="@UZ#[9SQeHpf~{DQ$@vq" inline="false">
                                 <field name="OP">AND</field>
                                 <value name="A">
                                   <block type="logic_compare" id="k^*EEGuZ@Ys*Flv}Pi*Y">
                                     <field name="OP">EQ</field>
                                     <value name="A">
                                       <block type="get_value" id="l-KLVt/oOJzV}ie{jBu:">
                                         <field name="ATTR">val</field>
                                         <field name="OID">hm-rpc.2.000C18A991E745.1.PRESENCE_DETECTION_STATE</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="logic_boolean" id="-yYPD79uVS{:*1@#CKlJ">
                                         <field name="BOOL">TRUE</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="logic_compare" id="{HU|6+mrJNU[G3UEvkRu">
                                     <field name="OP">LT</field>
                                     <value name="A">
                                       <block type="get_value" id="2eqZT]V=4Udz8.^)vwN%">
                                         <field name="ATTR">val</field>
                                         <field name="OID">hm-rpc.2.000C18A991E745.1.ILLUMINATION</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="math_number" id="Mw7e=y$)Qp={Ux8ZnDC}">
                                         <field name="NUM">12</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="B">
                               <block type="time_compare" id=";;k7MTbQBQ[lD@Y@GXd{">
                                 <mutation end_time="true"></mutation>
                                 <field name="OPTION">between</field>
                                 <field name="START_TIME">19:00</field>
                                 <field name="END_TIME">06:00</field>
                               </block>
                             </value>
                           </block>
                         </value>
                         <statement name="DO0">
                           <block type="control" id="D{##|aadKs?qFL,ze6F1">
                             <mutation delay_input="false"></mutation>
                             <field name="OID">hue.0.Philips_hue.1OG_Lampe_Flur.level</field>
                             <field name="WITH_DELAY">FALSE</field>
                             <value name="VALUE">
                               <block type="math_number" id="Fx:IGDK7r{K[WJbL(]0!">
                                 <field name="NUM">20</field>
                               </block>
                             </value>
                           </block>
                         </statement>
                         <value name="IF1">
                           <block type="logic_compare" id="sUq2oX0H!kIwDnEd,EH7">
                             <field name="OP">EQ</field>
                             <value name="A">
                               <block type="get_value" id="P6v8v(_|yjET?[+NMG7k">
                                 <field name="ATTR">val</field>
                                 <field name="OID">hm-rpc.2.000C18A991E745.1.PRESENCE_DETECTION_STATE</field>
                               </block>
                             </value>
                             <value name="B">
                               <block type="logic_boolean" id="_FsRA}fj6l+M01s|^N]w">
                                 <field name="BOOL">FALSE</field>
                               </block>
                             </value>
                           </block>
                         </value>
                         <statement name="DO1">
                           <block type="control" id="q{8M]`hv|(=?hBzTJmMF">
                             <mutation delay_input="true"></mutation>
                             <field name="OID">hue.0.Philips_hue.1OG_Lampe_Flur.level</field>
                             <field name="WITH_DELAY">TRUE</field>
                             <field name="DELAY_MS">2</field>
                             <field name="UNIT">min</field>
                             <field name="CLEAR_RUNNING">FALSE</field>
                             <value name="VALUE">
                               <block type="math_number" id="Y8@gEWP0J`s_D]3d5z*Q">
                                 <field name="NUM">0</field>
                               </block>
                             </value>
                           </block>
                         </statement>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </next>
           </block>
         </statement>
       </block>
      </xml>
      

      Wärst du so nett und würdest mir das einbauen? Bin mir nicht ganz sicher was ich bei Wert reinschreiben soll.

      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @Uli977 last edited by paul53

        @Uli977 sagte in Licht mit Verzögerung ausschalten.:

        würdest mir das einbauen?

        Blockly_temp.JPG

        <xml xmlns="http://www.w3.org/1999/xhtml">
         <variables>
           <variable type="undefined" id="timeout">timeout</variable>
           <variable type="" id=":b!]mT(G8+2qJr28xm4P">level</variable>
         </variables>
         <block type="on_ext" id="()rF8eg~_nv|@%r_t@l!" x="63" y="-362">
           <mutation items="1"></mutation>
           <field name="CONDITION">any</field>
           <field name="ACK_CONDITION"></field>
           <value name="OID0">
             <shadow type="field_oid" id="6Y;9D}Z!PiPyc#BVC3Sn">
               <field name="oid">hm-rpc.2.000C18A991E745.1.PRESENCE_DETECTION_STATE</field>
             </shadow>
           </value>
           <statement name="STATEMENT">
             <block type="controls_if" id="!JnD^0Ewo)kn)QyRIbe(">
               <mutation else="1"></mutation>
               <value name="IF0">
                 <block type="on_source" id="7NOw9x%V^NuU/,9(jc^T">
                   <field name="ATTR">state.val</field>
                 </block>
               </value>
               <statement name="DO0">
                 <block type="timeouts_cleartimeout" id="0(i*XD0y2d,]1{(;G$)b">
                   <field name="NAME">timeout</field>
                   <next>
                     <block type="controls_if" id="gm6X;rB(s48~*/jqX1kn">
                       <value name="IF0">
                         <block type="logic_compare" id="n3TwH{?%CECmT.nR=X;w">
                           <field name="OP">LT</field>
                           <value name="A">
                             <block type="get_value" id="+rgDI=(Y$VNuU@mpT+Vd">
                               <field name="ATTR">val</field>
                               <field name="OID">hm-rpc.2.000C18A991E745.1.ILLUMINATION</field>
                             </block>
                           </value>
                           <value name="B">
                             <block type="math_number" id="E(`)H5dp7SSBc%qDteYn">
                               <field name="NUM">12</field>
                             </block>
                           </value>
                         </block>
                       </value>
                       <statement name="DO0">
                         <block type="controls_if" id="}nwGWFGb53(be%W(:}#X">
                           <mutation else="1"></mutation>
                           <value name="IF0">
                             <block type="time_compare" id="$:W{[kvL_XyIW7-X;L:;">
                               <mutation end_time="true"></mutation>
                               <field name="OPTION">between</field>
                               <field name="START_TIME">06:00</field>
                               <field name="END_TIME">19:00</field>
                             </block>
                           </value>
                           <statement name="DO0">
                             <block type="comment" id="6C}}Nm0LdWg`qBcPQs=l">
                               <field name="COMMENT">Licht bei Bewegung einschalten Tag</field>
                               <next>
                                 <block type="variables_set" id=")83N1BI-L4JgVia^,M`{">
                                   <field name="VAR" id=":b!]mT(G8+2qJr28xm4P" variabletype="">level</field>
                                   <value name="VALUE">
                                     <block type="math_number" id="RpNNcLxvmS[dn0;|/Q]E">
                                       <field name="NUM">100</field>
                                     </block>
                                   </value>
                                 </block>
                               </next>
                             </block>
                           </statement>
                           <statement name="ELSE">
                             <block type="comment" id="U`QzH4,$UBmgN:Onq8bU">
                               <field name="COMMENT">Licht bei Bewegung einschalten Abend/Nacht </field>
                               <next>
                                 <block type="variables_set" id="h=v;M`OKtH`xUHXjPj6J">
                                   <field name="VAR" id=":b!]mT(G8+2qJr28xm4P" variabletype="">level</field>
                                   <value name="VALUE">
                                     <block type="math_number" id="`3{)dBR2eTSZPi0L}gv|">
                                       <field name="NUM">20</field>
                                     </block>
                                   </value>
                                 </block>
                               </next>
                             </block>
                           </statement>
                           <next>
                             <block type="control" id="=ElWff*!BnA64}B1JLo`">
                               <mutation delay_input="false"></mutation>
                               <field name="OID">hue.0.Philips_hue.1OG_Lampe_Flur.level</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="variables_get" id="TBR1}otKBZ{tC}pS;M9K">
                                   <field name="VAR" id=":b!]mT(G8+2qJr28xm4P" variabletype="">level</field>
                                 </block>
                               </value>
                             </block>
                           </next>
                         </block>
                       </statement>
                     </block>
                   </next>
                 </block>
               </statement>
               <statement name="ELSE">
                 <block type="timeouts_settimeout" id="ZQyqnK5^zAhZ40EK@:5/">
                   <field name="NAME">timeout</field>
                   <field name="DELAY">15</field>
                   <field name="UNIT">sec</field>
                   <statement name="STATEMENT">
                     <block type="control" id="-AtLf/t|*#vd|E.,qBee">
                       <mutation delay_input="false"></mutation>
                       <field name="OID">hue.0.Philips_hue.1OG_Lampe_Flur.level</field>
                       <field name="WITH_DELAY">FALSE</field>
                       <value name="VALUE">
                         <block type="math_number" id="yq9lSwl`3xH|~)P]`HE%">
                           <field name="NUM">0</field>
                         </block>
                       </value>
                     </block>
                   </statement>
                 </block>
               </statement>
             </block>
           </statement>
         </block>
        </xml>
        

        Uli977 1 Reply Last reply Reply Quote 0
        • Uli977
          Uli977 @paul53 last edited by Uli977

          @paul53 Danke dir! funktioniert.
          Kannst du mir noch sagen wobei es sich bei dem ersten "Wert" handelt? Ist das eine Variable? Oder wo hast du das hergeholt?

          ba83b1e0-0135-4d0e-a811-c57b3c527a19-image.png

          paul53 2 Replies Last reply Reply Quote 0
          • paul53
            paul53 @Uli977 last edited by

            @Uli977 sagte:

            "Wert" handelt? Ist das eine Variable?

            Nein, das ist eine Eigenschaft (der Wert) des Trigger-Datenpunktes. Wenn Du auf den Selektor-Pfeil klickst, siehst Du es.

            Uli977 1 Reply Last reply Reply Quote 0
            • Uli977
              Uli977 @paul53 last edited by

              @paul53 Ah, verstanden und gefunden... Danke!

              1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @Uli977 last edited by

                @Uli977 sagte:

                funktioniert.

                Dann markiere bitte das Thema in der Überschrift des ersten Beitrags als [gelöst].

                Uli977 2 Replies Last reply Reply Quote 0
                • Uli977
                  Uli977 @paul53 last edited by

                  @paul53 Mir ist gerade nach 19 Uhr etwas aufgefallen.
                  Das Licht geht nicht mehr an, auch nicht auf 20.

                  Beschreibt die Bedingung dass dies nur zwischen 06:00 und 19:00 Uhr geschehen soll, oder beschreibt die Bedingung dass zwischen 06:00 und 19:00 Uhr 100 gesetzt werden soll und außerhalb der Zeit 20?

                  Viele Grüße!

                  paul53 1 Reply Last reply Reply Quote 0
                  • Uli977
                    Uli977 @paul53 last edited by

                    @paul53 ne, daran liegt es nicht. Bewegung wird erkannt, aber Licht wird nicht eingeschaltet.... komisch

                    1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 @Uli977 last edited by

                      @Uli977 sagte:

                      beschreibt die Bedingung dass zwischen 06:00 und 19:00 Uhr 100 gesetzt werden soll und außerhalb der Zeit 20?

                      Ja.

                      Uli977 1 Reply Last reply Reply Quote 0
                      • Uli977
                        Uli977 @paul53 last edited by

                        @paul53 Aber warum geht die Lampe, trotz dessen dass eine Bewegung erkannt wurde, nicht an?

                        paul53 1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @Uli977 last edited by paul53

                          @Uli977 sagte:

                          Aber warum geht die Lampe, trotz dessen dass eine Bewegung erkannt wurde, nicht an?

                          Keine Ahnung, ich kenne das Verhalten von Hue nicht. Geht der Datenpunkt "level" auf 20 % ?
                          Oder geht das Licht an, wenn der Datenpunkt manuell im Tab "Objekte" auf 20 gesetzt wird ?

                          Uli977 3 Replies Last reply Reply Quote 0
                          • Uli977
                            Uli977 @paul53 last edited by

                            @paul53
                            Der Datenpunkt geht nicht aus 20% und wenn ich ihn manuell auf auf 20% setzt dann geht das Licht an.

                            1 Reply Last reply Reply Quote 0
                            • Uli977
                              Uli977 @paul53 last edited by

                              @paul53
                              Vergiss wieder alles was ich gesagt habe. Ich hatte das falsche Skript eingeschalten bzw. dieses Skript aus.....

                              Da packt man sich echt an den Kopf! Sorry!

                              1 Reply Last reply Reply Quote 0
                              • Uli977
                                Uli977 @paul53 last edited by Uli977

                                @paul53

                                Ich möchte das Skript nochmal verstehen und versuche mal herzuleiten.
                                Vielleicht kannst du mir zu meiner Erklärung was sagen.

                                8a7ee325-c8a6-4413-abb0-15544d81e870-image.png

                                Pfad 1 - Einschalten

                                • TRIGGER: Wenn Presence-Detection geändert wurde
                                  Bedingung
                                  FALLS "Wert" (Also wenn der Trigger irgendeinen Wert hat false/true/0/1, ganz egal)
                                  MACHE falls Zeit zwischen 06:00 und 19:30 Uhr Level 100
                                  MACHE sonst Level 20
                                  STEUERE PhilippHue Level mit Wert vom Level (20 oder 100)

                                Pfad 2 - Ausschalten

                                • TRIGGER: Wenn Presence-Detection geändert wurde
                                  Bedingung
                                  FALLS "Wert" (Also wenn der Trigger irgendeinen Wert hat false/true/0/1, ganz egal)
                                  SONST STEUERE PhilippHue Level mit Wert vom Level 0, nach 10 Sekunden

                                Und wenn ich innerhlab des Timeouts erneut eine Bewegung auslöse, dann greift STOP TIMEOUT und das Programm wird erneut abgefahren.
                                Je nach Bedingungen, wird Level auf 100 gesetzt (es kann aber auch sein dass er noch bei 100 stand) oder aber auf 0 wenn die Helligkeit größer 12 ist.

                                Ist das so korrekt beschrieben?

                                paul53 1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 @Uli977 last edited by paul53

                                  @Uli977 sagte:

                                  FALLS "Wert" (Also wenn der Trigger irgendeinen Wert hat false/true/0/1, ganz egal)

                                  Nein, falls Wert prüft für den mache-Zweig, ob der Wert true (Bewegung erkannt) ist. Entsprechend wird der sonst-Zweig ausgeführt, wenn keine Bewegung mehr erkannt wird. Siehe Javascript-Equality-Table, Tab If().

                                  @Uli977 sagte in [gelöst] Licht mit Verzögerung ausschalten.:

                                  Und wenn ich innerhlab des Timeouts erneut eine Bewegung auslöse, dann greift STOP TIMEOUT und das Programm wird erneut abgefahren.

                                  Es greift stop timeout, womit der Timer gestoppt wird und so das Ausschalten verhindert wird (Licht bleibt ein).

                                  @Uli977 sagte in [gelöst] Licht mit Verzögerung ausschalten.:

                                  Je nach Bedingungen, wird Level auf 100 gesetzt (es kann aber auch sein dass er noch bei 100 stand) oder aber auf 0 wenn die Helligkeit größer 12 ist.

                                  Level wird in Abhängigkeit der Uhrzeit auf 100 bzw. 20 gesetzt. Helligkeit < 12 ist nur eine zusätzliche Einschaltbedingung, sie hat keinen Einfluss auf das Ausschalten.

                                  Uli977 1 Reply Last reply Reply Quote 0
                                  • Uli977
                                    Uli977 @paul53 last edited by Uli977

                                    @paul53

                                    Also ginge statt "falls Wert" auch folgendes ?

                                    700e9e4e-a1cf-44ed-a157-9a4021c1df05-image.png

                                    paul53 1 Reply Last reply Reply Quote 0
                                    • paul53
                                      paul53 @Uli977 last edited by

                                      @Uli977 sagte:

                                      Also ginge statt "falls Wert" auch folgendes ?

                                      Ja, ist aber aufwändiger und benötigt daher mehr Ressourcen.

                                      Uli977 1 Reply Last reply Reply Quote 0
                                      • Uli977
                                        Uli977 @paul53 last edited by

                                        @paul53
                                        Danke!

                                        1 Reply Last reply Reply Quote 0
                                        • First post
                                          Last post

                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        1.3k
                                        Online

                                        47.4k
                                        Users

                                        54.7k
                                        Topics

                                        803.9k
                                        Posts

                                        blockly javascript
                                        4
                                        22
                                        511
                                        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-2021
                                        logo