Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Bewegungsmelder 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

    Bewegungsmelder script

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

      Gibt es denn da keine Möglichkeit? Es soll ja nur eine zusätzliche Sicherheit, falls das stoppen mit der Tür nicht funktioniert

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

        @lustig29 sagte: Gibt es denn da keine Möglichkeit?

        Funktioniert es mit dem zusätzlichen Timeout nicht?

        Michael Schmitt 1 Reply Last reply Reply Quote 1
        • Michael Schmitt
          Michael Schmitt @paul53 last edited by Michael Schmitt

          @paul53 ich habs mal wieder mit einem Bewegungsmelder.

          Das Licht soll nach einer bestimmten Zeit dimmen, damit man erkennt das dieses gleich aus geht.
          Das Problem wenn es hell ist geht das Licht wie gewollt nicht an, aber der Timer läuft und schaltet dann auf 60%.

          <xml xmlns="https://developers.google.com/blockly/xml">
            <variables>
              <variable type="timeout" id="timeout">timeout</variable>
              <variable type="timeout" id="timeout2">timeout2</variable>
            </variables>
            <block type="comment" id="M#Itf%?w)g;W_NV:LrCD" x="247" y="-196">
              <field name="COMMENT">Küche</field>
              <next>
                <block type="on_ext" id="XZShE%!^7aSwliAf9~Rx">
                  <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
                  <field name="CONDITION">ne</field>
                  <field name="ACK_CONDITION"></field>
                  <value name="OID0">
                    <shadow type="field_oid" id="_eW).)0ak/qQ]I)8oZf+">
                      <field name="oid">alias.0.Bewegungsmelder.BWM_Küche_1</field>
                    </shadow>
                  </value>
                  <value name="OID1">
                    <shadow type="field_oid" id=")0^n!lxls~t=zH$c#xBk">
                      <field name="oid">alias.0.Bewegungsmelder.BWM_Küche_2</field>
                    </shadow>
                  </value>
                  <statement name="STATEMENT">
                    <block type="timeouts_cleartimeout" id="Cp4}tZsbrS.Mr]/dX*WU">
                      <field name="NAME">timeout</field>
                      <next>
                        <block type="timeouts_cleartimeout" id="-o[:H+Vc~AA]-;M?d`fq">
                          <field name="NAME">timeout2</field>
                          <next>
                            <block type="controls_if" id="e@LN;c0-3IiQ3mPlWpKL">
                              <mutation else="1"></mutation>
                              <value name="IF0">
                                <block type="logic_operation" id="1izx-;Zex-%rg*o;pEfg" inline="false">
                                  <field name="OP">AND</field>
                                  <value name="A">
                                    <block type="on_source" id="YF0p~HYg^fvS2:AAqffX">
                                      <field name="ATTR">state.val</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <block type="logic_compare" id="z=%N/{7Y)XQ@XBzBakY[">
                                      <field name="OP">LT</field>
                                      <value name="A">
                                        <block type="get_value" id="uN-R/ufjXJbjRX_6g6:Q">
                                          <field name="ATTR">val</field>
                                          <field name="OID">deconz.0.Sensors.62.lux</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <block type="math_number" id="8:zQPz!8:^SgCK|EZI,8">
                                          <field name="NUM">8</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="control" id="nxly#K96X$mp@Gi#@,gy">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">deconz.0.Lights.26.on</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="n2{fjUsZBnz7b)`R+PJ~">
                                      <field name="BOOL">TRUE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="control" id="v2.kUwM)QLSCY*s;a.a%">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">deconz.0.Lights.26.level</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_number" id="WA)KR!t7M6g-?2:99ic~">
                                          <field name="NUM">100</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="debug" id="t{tcabMV%zgl:VxJ{+U;">
                                          <field name="Severity">log</field>
                                          <value name="TEXT">
                                            <shadow type="text" id="2ef,,:9LWc*WJdg@di*I">
                                              <field name="TEXT">Bewegung in Küche erkannt und Licht ein</field>
                                            </shadow>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                              <statement name="ELSE">
                                <block type="timeouts_settimeout" id="yCutu!$pMQ|(uT+cjX(N">
                                  <field name="NAME">timeout</field>
                                  <field name="DELAY">60</field>
                                  <field name="UNIT">sec</field>
                                  <statement name="STATEMENT">
                                    <block type="control" id="|48:}Q!T`_w%Q7H^8UR6">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">deconz.0.Lights.26.level</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_number" id="~(.Mo;nX5QT$c8qg*N~$">
                                          <field name="NUM">60</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="debug" id="Gl=/gGlpBZb|z?2(uk@W">
                                          <field name="Severity">log</field>
                                          <value name="TEXT">
                                            <shadow type="text" id="]*s_**1STaopKhmRh/zw">
                                              <field name="TEXT">Küche BWM Lampe 60%</field>
                                            </shadow>
                                          </value>
                                          <next>
                                            <block type="timeouts_settimeout" id="q8w4fioamocb#(LaHw{$">
                                              <field name="NAME">timeout2</field>
                                              <field name="DELAY">45</field>
                                              <field name="UNIT">sec</field>
                                              <statement name="STATEMENT">
                                                <block type="control" id="rX--zGLj0prOJT**!1uz">
                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                  <field name="OID">deconz.0.Lights.26.on</field>
                                                  <field name="WITH_DELAY">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="logic_boolean" id="Vj+C/7Mhb/b,8J=RJW8R">
                                                      <field name="BOOL">FALSE</field>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="debug" id="B;Fu-[8*LH=H,y-5LbxU">
                                                      <field name="Severity">log</field>
                                                      <value name="TEXT">
                                                        <shadow type="text" id="c0BU#W5fq{/!wccf|O[V">
                                                          <field name="TEXT">Keine Bewegung in Küche erkannt und Licht aus</field>
                                                        </shadow>
                                                      </value>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </statement>
                </block>
              </next>
            </block>
          </xml>
          
          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Michael Schmitt last edited by

            @michael-schmitt sagte: wenn es hell ist geht das Licht wie gewollt nicht an, aber der Timer läuft und schaltet dann auf 60%.

            Mache eine zusätzliche Abfrage:

            Bild_2022-08-11_170132223.png

            Michael Schmitt 1 Reply Last reply Reply Quote 1
            • Michael Schmitt
              Michael Schmitt @paul53 last edited by

              @paul53 @paul53 leider sind dann die Lux höher als sie es sein dürfen damit das Licht an geht

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

                @michael-schmitt sagte: leider sind dann die Lux höher als sie es sein dürfen damit das Licht an geht

                Was hat die Abfrage im sonst-Zweig mit dem Einschalten zu tun?

                Da zwei BWM triggern, kann man nicht Wert auswerten, sondern man benötigt eine Oder-Verknüpfung beider Bewegungen:

                Bild_2022-08-11_171404881.png

                Michael Schmitt 1 Reply Last reply Reply Quote 1
                • Michael Schmitt
                  Michael Schmitt @paul53 last edited by

                  @paul53 das Licht wird nun auf 60% gedimmt aber bei erneuter Bewegung wird nicht auf 100% erhöht

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

                    @michael-schmitt sagte: bei erneuter Bewegung wird nicht auf 100% erhöht

                    Wenn "level mit 100" aus der zweiten falls-Klammer raus genommen wird?

                    Bild_2022-08-11_174833824.png

                    Michael Schmitt 1 Reply Last reply Reply Quote 1
                    • Michael Schmitt
                      Michael Schmitt @paul53 last edited by Michael Schmitt

                      @paul53 jetzt geht das Licht auch an wenn es hell ist >8

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

                        @michael-schmitt sagte: jetzt geht das Licht auch an wenn es hell ist >8

                        Dann schaltet es per "level > 0" ein, "on" muss also nicht auf true gesetzt werden?

                        Bild_2022-08-11_180931091.png

                        Hoffentlich erzeugt die Beleuchtung mit 60 % nicht mehr als 8 lux.
                        Geht "on" automatisch auf true, wenn ein Level > 0 gesetzt wird?

                        Michael Schmitt 1 Reply Last reply Reply Quote 1
                        • Michael Schmitt
                          Michael Schmitt @paul53 last edited by

                          Hoffentlich erzeugt die Beleuchtung mit 60 % nicht mehr als 8 lux.
                          Doch 😲

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

                            @michael-schmitt sagte: nicht mehr als 8 lux.
                            Doch

                            Dann versuche es mal so:

                            Bild_2022-08-11_181934167.png

                            Michael Schmitt 2 Replies Last reply Reply Quote 1
                            • Michael Schmitt
                              Michael Schmitt @paul53 last edited by

                              @paul53 das scheint zu funktionieren 👍 👏

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

                                @paul53 das Script läuft soweit sehr gut. Ich habe jedoch eine Frage. Zur Zeit kommt die Meldung "Bewegung im Flur erkannt und Licht ein 90%" bei jedem Auslösen der BWM, dass ist mir dann doch zu viel im Log. Ich habe das nun so gelöst, ist das OK oder hab ich mal wieder Mist gebaut ?

                                Anmerkung 2022-08-12 192313.jpg

                                EDIT:Hab die Pause entfernt

                                <xml xmlns="https://developers.google.com/blockly/xml">
                                  <variables>
                                    <variable id="Ki;~ht{XC[36A7nTpX).">Licht</variable>
                                    <variable type="timeout" id="timeout">timeout</variable>
                                    <variable type="timeout" id="timeout2">timeout2</variable>
                                  </variables>
                                  <block type="comment" id="M#Itf%?w)g;W_NV:LrCD" x="-88" y="-338">
                                    <field name="COMMENT">Flur</field>
                                    <next>
                                      <block type="on_ext" id="XZShE%!^7aSwliAf9~Rx">
                                        <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
                                        <field name="CONDITION">ne</field>
                                        <field name="ACK_CONDITION"></field>
                                        <value name="OID0">
                                          <shadow type="field_oid" id="_eW).)0ak/qQ]I)8oZf+">
                                            <field name="oid">alias.0.Bewegungsmelder.BWM_Flur_1</field>
                                          </shadow>
                                        </value>
                                        <value name="OID1">
                                          <shadow type="field_oid" id="e5R|Fz:I{^S^I#^du1vO">
                                            <field name="oid">alias.0.Bewegungsmelder.BWM_Flur_2</field>
                                          </shadow>
                                        </value>
                                        <statement name="STATEMENT">
                                          <block type="timeouts_cleartimeout" id="-o[:H+Vc~AA]-;M?d`fq">
                                            <field name="NAME">timeout</field>
                                            <next>
                                              <block type="timeouts_cleartimeout" id="c-fK;]?st(uLsht=EZmG">
                                                <field name="NAME">timeout2</field>
                                                <next>
                                                  <block type="variables_set" id="X~~()0b4f5^g-@=;e]r=">
                                                    <field name="VAR" id="Ki;~ht{XC[36A7nTpX).">Licht</field>
                                                    <value name="VALUE">
                                                      <block type="get_value" id="U8%fW,6].@.#:{gTj7hI">
                                                        <field name="ATTR">val</field>
                                                        <field name="OID">deconz.0.Lights.17.on</field>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="controls_if" id="e@LN;c0-3IiQ3mPlWpKL">
                                                        <mutation elseif="1"></mutation>
                                                        <value name="IF0">
                                                          <block type="logic_operation" id="z;D)/5u|-o-N}_N|ndX7" inline="false">
                                                            <field name="OP">OR</field>
                                                            <value name="A">
                                                              <block type="get_value" id="WZUFWc?0xqDDjauMNm7?">
                                                                <field name="ATTR">val</field>
                                                                <field name="OID">alias.0.Bewegungsmelder.BWM_Flur_1</field>
                                                              </block>
                                                            </value>
                                                            <value name="B">
                                                              <block type="get_value" id="VxmjwsU7=sU/5=tLA+|U">
                                                                <field name="ATTR">val</field>
                                                                <field name="OID">alias.0.Bewegungsmelder.BWM_Flur_2</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                        <statement name="DO0">
                                                          <block type="controls_if" id="Gtwhg_5_[.Q3lEy[1xJF">
                                                            <value name="IF0">
                                                              <block type="logic_operation" id="u.br91Z]Z+):/-SH.%OC" inline="false">
                                                                <field name="OP">OR</field>
                                                                <value name="A">
                                                                  <block type="variables_get" id="-58,11$JZhGLH1FQ_n:E">
                                                                    <field name="VAR" id="Ki;~ht{XC[36A7nTpX).">Licht</field>
                                                                  </block>
                                                                </value>
                                                                <value name="B">
                                                                  <block type="logic_operation" id="lAs1ZtwzRH*wrOb7./k6" inline="false">
                                                                    <field name="OP">OR</field>
                                                                    <value name="A">
                                                                      <block type="logic_compare" id="%T/s}$FaX/uFYFc0LC[v">
                                                                        <field name="OP">LT</field>
                                                                        <value name="A">
                                                                          <block type="get_value" id="FCFLcJR}^XbHwn~JC9Ss">
                                                                            <field name="ATTR">val</field>
                                                                            <field name="OID">deconz.0.Sensors.56.lux</field>
                                                                          </block>
                                                                        </value>
                                                                        <value name="B">
                                                                          <block type="math_number" id=")NyCG[9Ipr1v|1W5BECh">
                                                                            <field name="NUM">4</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <value name="B">
                                                                      <block type="logic_compare" id="]=28h`rTm$3f{q:+;l+4">
                                                                        <field name="OP">LT</field>
                                                                        <value name="A">
                                                                          <block type="get_value" id="|gl@dK7IzR^K=THAf698">
                                                                            <field name="ATTR">val</field>
                                                                            <field name="OID">deconz.0.Sensors.57.lux</field>
                                                                          </block>
                                                                        </value>
                                                                        <value name="B">
                                                                          <block type="math_number" id="4(9}7g/r,W7JD5A,1tF5">
                                                                            <field name="NUM">5</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                            <statement name="DO0">
                                                              <block type="control" id="Q*`*h)o:/SGiva1Za0|-">
                                                                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                <field name="OID">deconz.0.Lights.17.level</field>
                                                                <field name="WITH_DELAY">FALSE</field>
                                                                <value name="VALUE">
                                                                  <block type="math_number" id="x~/-RaK}$!}O-GD!W;{@">
                                                                    <field name="NUM">90</field>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </statement>
                                                          </block>
                                                        </statement>
                                                        <value name="IF1">
                                                          <block type="variables_get" id=".GW6/2x,|s.%U{NB@NJ)">
                                                            <field name="VAR" id="Ki;~ht{XC[36A7nTpX).">Licht</field>
                                                          </block>
                                                        </value>
                                                        <statement name="DO1">
                                                          <block type="timeouts_settimeout" id="yCutu!$pMQ|(uT+cjX(N">
                                                            <field name="NAME">timeout</field>
                                                            <field name="DELAY">120</field>
                                                            <field name="UNIT">sec</field>
                                                            <statement name="STATEMENT">
                                                              <block type="control" id="3F$zNDNTUs96o?l2yPd9">
                                                                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                <field name="OID">deconz.0.Lights.17.level</field>
                                                                <field name="WITH_DELAY">FALSE</field>
                                                                <value name="VALUE">
                                                                  <block type="math_number" id="kojHU,.ECX=6`@6~f+9;">
                                                                    <field name="NUM">60</field>
                                                                  </block>
                                                                </value>
                                                                <next>
                                                                  <block type="debug" id="Gl=/gGlpBZb|z?2(uk@W">
                                                                    <field name="Severity">log</field>
                                                                    <value name="TEXT">
                                                                      <shadow type="text" id="]*s_**1STaopKhmRh/zw">
                                                                        <field name="TEXT">Flur Level 60%</field>
                                                                      </shadow>
                                                                    </value>
                                                                    <next>
                                                                      <block type="timeouts_settimeout" id="nxgzo.Tbn9DT_26m*7ic">
                                                                        <field name="NAME">timeout2</field>
                                                                        <field name="DELAY">30</field>
                                                                        <field name="UNIT">sec</field>
                                                                        <statement name="STATEMENT">
                                                                          <block type="control" id="thUBa[KJYQESB.xnvQRi">
                                                                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                            <field name="OID">deconz.0.Lights.17.on</field>
                                                                            <field name="WITH_DELAY">FALSE</field>
                                                                            <value name="VALUE">
                                                                              <block type="logic_boolean" id="DV!:2{702SQ/wlV;8P:T">
                                                                                <field name="BOOL">FALSE</field>
                                                                              </block>
                                                                            </value>
                                                                            <next>
                                                                              <block type="debug" id="^)xQO:[DFWEzgGy-N.Qq">
                                                                                <field name="Severity">log</field>
                                                                                <value name="TEXT">
                                                                                  <shadow type="text" id="(%kz+5#ovVDvdf67O@Mk">
                                                                                    <field name="TEXT">Keine Bewegung im Flur erkannt und Licht aus</field>
                                                                                  </shadow>
                                                                                </value>
                                                                              </block>
                                                                            </next>
                                                                          </block>
                                                                        </statement>
                                                                      </block>
                                                                    </next>
                                                                  </block>
                                                                </next>
                                                              </block>
                                                            </statement>
                                                          </block>
                                                        </statement>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                      </block>
                                    </next>
                                  </block>
                                  <block type="on_ext" id="8$a}c%5@D9k-eJ|Rga$M" x="688" y="-313">
                                    <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                    <field name="CONDITION">ne</field>
                                    <field name="ACK_CONDITION"></field>
                                    <value name="OID0">
                                      <shadow type="field_oid" id="Ve8M8-Vr7Zz+Z!(oDt}G">
                                        <field name="oid">deconz.0.Lights.17.level</field>
                                      </shadow>
                                    </value>
                                    <statement name="STATEMENT">
                                      <block type="timeouts_wait" id="JiPJ=D^{{jECzyffQURP">
                                        <field name="DELAY">2</field>
                                        <field name="UNIT">sec</field>
                                        <next>
                                          <block type="controls_if" id="3QbUytwsjrWnF14SN8Qz">
                                            <value name="IF0">
                                              <block type="logic_compare" id="iRb;!hZ+Gf;!tp~;$xS$">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="get_value" id="=WuT{|{*u;}4bVsNJKK#">
                                                    <field name="ATTR">val</field>
                                                    <field name="OID">deconz.0.Lights.17.level</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="math_number" id="73-4)}!4O?qqFp?~2Muf">
                                                    <field name="NUM">90</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="debug" id="t{tcabMV%zgl:VxJ{+U;">
                                                <field name="Severity">log</field>
                                                <value name="TEXT">
                                                  <shadow type="text" id="2ef,,:9LWc*WJdg@di*I">
                                                    <field name="TEXT">Bewegung im Flur erkannt und Licht ein 90%</field>
                                                  </shadow>
                                                </value>
                                              </block>
                                            </statement>
                                          </block>
                                        </next>
                                      </block>
                                    </statement>
                                  </block>
                                </xml>
                                
                                paul53 1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 @Michael Schmitt last edited by

                                  @michael-schmitt sagte: das Script läuft soweit sehr gut.
                                  ... ist mir dann doch zu viel im Log.

                                  Wenn das Skript funktioniert wie gewünscht, kann man die Debug-Blöcke deaktivieren / löschen, denn sie dienen eigentlich dazu, Fehler zu finden und zu beseitigen.

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

                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate

                                  691
                                  Online

                                  31.7k
                                  Users

                                  79.8k
                                  Topics

                                  1.3m
                                  Posts

                                  4
                                  84
                                  5738
                                  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