Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [gelöst] Tageszeitabhängiges Blockly-Script

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] Tageszeitabhängiges Blockly-Script

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

      Hallo Zusammen,

      Ich bin jetzt dann langsam völlig am Verzweifeln. Habe nun schon einiges im Forum gefunden (und dabei auch über die 12-stunden bzw. Nicht-zwischen-Regel gestolpert), aber ich bekomm mein Script einfach nicht zum laufen.

      Beschreibung der Funktion:

      Existierende Alexa-Routine würde durch ein virtuelles Gerät (iot-Adapter) "xyzHMFlur" erweitert. Routine soll alle Steuerbaren Geräte ausschalten, die ausgeschalten werden müssen (Alles-Aus).

      Nun ist aufgefallen das es speziell im Flur ungeschickt ist, dass wenn man im Flur steht, und die Routine anwirft, eben man dann im Dunkeln steht. Also war der Plan folgendes:

      Routine Aktiviert xyzHMFlur. Im Blocklyskript wird dann Zeitgesteuert folgendes Abgefragt:

      Fall 1: Ist es denn Tagsüber (nicht zwischen Sonnenuntergang und Sonnenaufgang)? wenn ja mache setze Flurlicht auf False

      Fall 2: Ist es Nacht ( nicht zwischen Sonnenaufgang und Sonnenuntergang) dann Schalte das Licht an.

      Fall 3: ist es Nacht (wie oben) und das Licht ist an (ist es jetzt ja auf jeden fall), dann mache es verzögert aus.

      Ich teste das Skript aktuell ( 00:20 Uhr) und er springt mir in den Fall 1, und macht eben das Licht aus.
      Egal wie ich Sonnenaufgang oder Sonnenuntergang hin und hin und herwechsle macht er immer irgendwie nichts...

      Was mache ich Falsch?

      grüße

      ForumBlockly.png

      <xml xmlns="http://www.w3.org/1999/xhtml">
       <block type="comment" id="9H@^2*ZxZC}Zfqzev{[z" x="-212" y="-313">
         <field name="COMMENT">v1.0</field>
         <next>
           <block type="comment" id="xZc#_.V{Y=UU{$3Jy,?q">
             <field name="COMMENT">Getestet: 07.12.2019</field>
             <next>
               <block type="comment" id="[!4UC_`Rya{~hxv-@9i8">
                 <field name="COMMENT">Gucken ob was passiert</field>
                 <next>
                   <block type="on" id="^T5-6l?3LNzjWTZ{OVq8">
                     <field name="OID">SmartHomeMerkler.0.Flur.xyzHMFlur</field>
                     <field name="CONDITION">any</field>
                     <field name="ACK_CONDITION"></field>
                     <statement name="STATEMENT">
                       <block type="controls_if" id="~1=5?CT4)lxxREA4ScxZ">
                         <mutation elseif="2"></mutation>
                         <value name="IF0">
                           <block type="logic_operation" id="MOn;$bHb]w|:KkM$K5$7">
                             <field name="OP">AND</field>
                             <value name="A">
                               <block type="time_compare_ex" id="]j.ZwMlow%,,cE:e]}9W">
                                 <mutation end_time="true" actual_time="true"></mutation>
                                 <field name="USE_ACTUAL_TIME">TRUE</field>
                                 <field name="OPTION">not between</field>
                                 <value name="START_TIME">
                                   <shadow type="text" id="){^SoyoMx$$R*}pqmzy}">
                                     <field name="TEXT">12:00</field>
                                   </shadow>
                                   <block type="time_astro" id=":4CY8{Onq%BG3fsS`7`f">
                                     <field name="TYPE">sunsetStart</field>
                                     <field name="OFFSET">0</field>
                                   </block>
                                 </value>
                                 <value name="END_TIME">
                                   <shadow type="text" id="0-8=#zAFwIO!JD8?]kLX">
                                     <field name="TEXT">18:00</field>
                                   </shadow>
                                   <block type="time_astro" id="Rq_hSu)SYkMaq)kx*2N9">
                                     <field name="TYPE">sunriseEnd</field>
                                     <field name="OFFSET">0</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="B">
                               <block type="logic_compare" id="PR7apOB|J4hZU5m+S7f(">
                                 <field name="OP">EQ</field>
                                 <value name="A">
                                   <block type="get_value" id="#@TEDN9eRnnWjZ!:kZQ0">
                                     <field name="ATTR">val</field>
                                     <field name="OID">SmartHomeMerkler.0.Flur.xyzHMFlur</field>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="logic_boolean" id="7XUHVTZtu+r*=2Ko~{;w">
                                     <field name="BOOL">TRUE</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </value>
                         <statement name="DO0">
                           <block type="control" id="SYm-KRp|S#{DD;T`hnVV">
                             <mutation delay_input="false"></mutation>
                             <field name="OID">sonoff.0.CorridorTouchTasmota.POWER</field>
                             <field name="WITH_DELAY">FALSE</field>
                             <value name="VALUE">
                               <block type="logic_boolean" id="Y[Or)}CI26OMsh01D,Vo">
                                 <field name="BOOL">FALSE</field>
                               </block>
                             </value>
                             <next>
                               <block type="control" id="hgV}[QyLIXz]iO_b]jpS">
                                 <mutation delay_input="false"></mutation>
                                 <field name="OID">SmartHomeMerkler.0.Flur.xyzHMFlur</field>
                                 <field name="WITH_DELAY">FALSE</field>
                                 <value name="VALUE">
                                   <block type="logic_boolean" id="|QhzvxED`A;bVoaIceCQ">
                                     <field name="BOOL">FALSE</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="debug" id="Mps.Yza!X=@jrw@jUu?t">
                                     <field name="Severity">log</field>
                                     <value name="TEXT">
                                       <shadow type="text" id=";30bEgOhabl_%3k_2tE]">
                                         <field name="TEXT">keine Aktion</field>
                                       </shadow>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </statement>
                         <value name="IF1">
                           <block type="logic_operation" id="F/PdT,JQ+:Ce[!]iiGd7">
                             <field name="OP">AND</field>
                             <value name="A">
                               <block type="time_compare_ex" id="=FHgm5?c~0T`2C11f$cA">
                                 <mutation end_time="true" actual_time="true"></mutation>
                                 <field name="USE_ACTUAL_TIME">TRUE</field>
                                 <field name="OPTION">not between</field>
                                 <value name="START_TIME">
                                   <shadow type="text" id="){^SoyoMx$$R*}pqmzy}">
                                     <field name="TEXT">12:00</field>
                                   </shadow>
                                   <block type="time_astro" id="k4L~?{E!RU7[hrMZu?UP">
                                     <field name="TYPE">sunriseEnd</field>
                                     <field name="OFFSET">0</field>
                                   </block>
                                 </value>
                                 <value name="END_TIME">
                                   <shadow type="text" id="0-8=#zAFwIO!JD8?]kLX">
                                     <field name="TEXT">18:00</field>
                                   </shadow>
                                   <block type="time_astro" id=")*#}8Ws+g(@UgpGgCC+)">
                                     <field name="TYPE">sunsetStart</field>
                                     <field name="OFFSET">0</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="B">
                               <block type="logic_compare" id="$Twemu!i8cfTC.B^_{U+">
                                 <field name="OP">EQ</field>
                                 <value name="A">
                                   <block type="get_value" id="!C)XBjB9AZklmr.nA__Z">
                                     <field name="ATTR">val</field>
                                     <field name="OID">SmartHomeMerkler.0.Flur.xyzHMFlur</field>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="logic_boolean" id="p@H=7Tj/-~-o4{mtn+?C">
                                     <field name="BOOL">TRUE</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </value>
                         <statement name="DO1">
                           <block type="control" id="a9uQa+c~2.{RXs*-hXI_">
                             <mutation delay_input="false"></mutation>
                             <field name="OID">sonoff.0.CorridorTouchTasmota.POWER</field>
                             <field name="WITH_DELAY">FALSE</field>
                             <value name="VALUE">
                               <block type="logic_boolean" id="9q,2e{u5aE9nw74lzbn@">
                                 <field name="BOOL">TRUE</field>
                               </block>
                             </value>
                             <next>
                               <block type="debug" id="zgKhQ}?wFlWR5B~~{-!8">
                                 <field name="Severity">log</field>
                                 <value name="TEXT">
                                   <shadow type="text" id="Q)fXbuIZ]748%~5ln?-?">
                                     <field name="TEXT">5 min Angeworfen</field>
                                   </shadow>
                                 </value>
                               </block>
                             </next>
                           </block>
                         </statement>
                         <value name="IF2">
                           <block type="logic_operation" id="(w4]PDx_R)bFAxCu*8VT" inline="false">
                             <field name="OP">AND</field>
                             <value name="A">
                               <block type="logic_operation" id="pgkX+M*F|}7i[iKtaxPR">
                                 <field name="OP">AND</field>
                                 <value name="A">
                                   <block type="time_compare_ex" id="CSGl!fI/{G@g5)W[AtCL">
                                     <mutation end_time="true" actual_time="true"></mutation>
                                     <field name="USE_ACTUAL_TIME">TRUE</field>
                                     <field name="OPTION">not between</field>
                                     <value name="START_TIME">
                                       <shadow type="text" id="){^SoyoMx$$R*}pqmzy}">
                                         <field name="TEXT">12:00</field>
                                       </shadow>
                                       <block type="time_astro" id=",ZDx[h$)*ur4*f!9W/k]">
                                         <field name="TYPE">sunriseEnd</field>
                                         <field name="OFFSET">0</field>
                                       </block>
                                     </value>
                                     <value name="END_TIME">
                                       <shadow type="text" id="0-8=#zAFwIO!JD8?]kLX">
                                         <field name="TEXT">18:00</field>
                                       </shadow>
                                       <block type="time_astro" id="{d~4+}q9quI:L$TBLQD2">
                                         <field name="TYPE">sunsetStart</field>
                                         <field name="OFFSET">0</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="logic_compare" id="TzzpC?oHe@t{IW~tQ8T|">
                                     <field name="OP">EQ</field>
                                     <value name="A">
                                       <block type="get_value" id="(OhZMFCxDFw),eUv2Xo_">
                                         <field name="ATTR">val</field>
                                         <field name="OID">SmartHomeMerkler.0.Flur.xyzHMFlur</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <block type="logic_boolean" id="a~Unh`7iC]W;g%N{*z2W">
                                         <field name="BOOL">TRUE</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <value name="B">
                               <block type="logic_compare" id="M|=6?e^NF|z1@e4xh_TB">
                                 <field name="OP">EQ</field>
                                 <value name="A">
                                   <block type="get_value" id="%.lpW2j,W)DkxO]S_5TO">
                                     <field name="ATTR">val</field>
                                     <field name="OID">sonoff.0.CorridorTouchTasmota.POWER</field>
                                   </block>
                                 </value>
                                 <value name="B">
                                   <block type="logic_boolean" id="?98+iIeFMfYS4M9o|Wm~">
                                     <field name="BOOL">TRUE</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                           </block>
                         </value>
                         <statement name="DO2">
                           <block type="control" id="@l=9PP#@uptYzX8}Q@-/">
                             <mutation delay_input="true"></mutation>
                             <field name="OID">sonoff.0.CorridorTouchTasmota.POWER</field>
                             <field name="WITH_DELAY">TRUE</field>
                             <field name="DELAY_MS">3</field>
                             <field name="UNIT">min</field>
                             <field name="CLEAR_RUNNING">FALSE</field>
                             <value name="VALUE">
                               <block type="logic_boolean" id="uz1R(kPx8|U8XCJ#=.G/">
                                 <field name="BOOL">FALSE</field>
                               </block>
                             </value>
                             <next>
                               <block type="control" id="zq`m_zv|(Qv=C+d2K-+.">
                                 <mutation delay_input="false"></mutation>
                                 <field name="OID">SmartHomeMerkler.0.Flur.xyzHMFlur</field>
                                 <field name="WITH_DELAY">FALSE</field>
                                 <value name="VALUE">
                                   <block type="logic_boolean" id="oP.n6i4+9kj2^pWM#0H)">
                                     <field name="BOOL">FALSE</field>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="debug" id="5Vg^IwRMZNv]P#n)0lR@">
                                     <field name="Severity">log</field>
                                     <value name="TEXT">
                                       <shadow type="text" id="#?~f2]6*/QNr[x=55m;m">
                                         <field name="TEXT">5 min ausgelaufen</field>
                                       </shadow>
                                     </value>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </statement>
                       </block>
                     </statement>
                   </block>
                 </next>
               </block>
             </next>
           </block>
         </next>
       </block>
      </xml>
      

      1 Reply Last reply Reply Quote 0
      • M
        Marco78 last edited by

        Einen ähnlich komplizierten Ansatz habe ich auch mal erfolglos versucht.
        Ich weiß nicht mehr was das Problem war, ob es Datumsübergreifend nicht so geht wie man sich es vorstellt oder so ähnlich...

        Gelöst habe ich es mit einen neuen Datenpunkt, welches einfach geändert wird und angebit ob es hell oder dunkel ist.

        c91deecf-ceab-4025-8bb6-e8cb797b380a-image.png

        Das vereinfacht den Aufwand auch, da ich diesen Datenpunkt an vielen Stellen einsetze.
        Auch wenn ich gerne gewusst hätte, wo der Denkfehler ist, hiermit komme ich gut zurecht, und wie gesagt ist es einfacher als eine lange Auswertungszeile.

        4540a809-a487-4e1a-a91b-f543fde2ec81-image.png

        Hier bitte nicht wundern, die Relais sind low-activ

        F 1 Reply Last reply Reply Quote 0
        • F
          freak1051 @Marco78 last edited by

          @Marco78

          Na Perfekt. In dem Fall mach ich es auch so. bzw mache ein Allgemeines Skript wo mir, wie bei dir, Angeibt ob es Hell oder dunkel ist und Nutze des an anderen Stellen. Super Idee 🙂

          Danke dir

          ===========================================
          Ich setze das Thema auf gelöst. Wenn jemand Weiß Warum das im ersten Schritt nicht getan hat, kann gerne beitragen 🙂

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

          Support us

          ioBroker
          Community Adapters
          Donate

          694
          Online

          31.9k
          Users

          80.1k
          Topics

          1.3m
          Posts

          2
          3
          271
          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