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.
    • paul53
      paul53 @Michael Schmitt last edited by paul53

      @michael-schmitt sagte: der Wert ist auf über 80

      Trotzdem schaltet die smarte Lampe bei Bewegung mit 60 % ein?

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

        @paul53 ja

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

          @michael-schmitt
          Das kann laut Skript nicht sein, wenn der richtige Datenpunkt verglichen wird. Bau mal eine Debug-Ausgabe des Lux-Wertes ein.

          Damit das Licht nicht bei Bewegung ausgeschaltet wird, wenn die smarte Lampe > 30 Lux erzeugt, mache es besser so:

          Bild_2021-04-03_191054.png

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

            @paul53 So hab das mal umgebaut und anstatt der Luxwerte den Wert "daylight" genommen, der ändert sich bei Licht von false auf true. Scheint zu funktionieren
            1.jpg

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

              Leider scheint das zu langsam zu reagieren. Sprich wenn man den Lichtschalter drückt, öffnet man ja fast gleichzeitig die Tür und der Wert braucht ca. 3-6 Sek bis er geändert ist.

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

                Hallo,
                mein Script für den Flur (weiter oben im Thread) habe ich nun nochmal geändert und anstatt das nur zu bestimmten Zeiten zu steuern soll nun auch noch mit Lux gesteuert werden. Der Flur ist bei teilweise geschlossenen Zimmertüren recht dunkel. Das was ich nun habe sieht so aus, kann man da noch was optimieren/verbessern ?
                flur.jpg

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

                  Hallo,
                  ich würde gerne mein Blockly dahingehend ändern, dass 30 Sekunden vor Ablauf des Timeouts (301Sek) das Licht ein wenig gedimmt wird. Damit man die Möglichkeit hat sich nochmal kurz zu bewegen, damit das Licht nicht ausgeht.

                  <xml xmlns="https://developers.google.com/blockly/xml">
                    <variables>
                      <variable id="qrCfu6RSlbXJjjCPf/P-">manuell_ein</variable>
                      <variable type="timeout" id="timeout">timeout</variable>
                      <variable type="timeout" id="timeout2">timeout2</variable>
                    </variables>
                    <block type="on_ext" id="XZShE%!^7aSwliAf9~Rx" x="-137" y="-87">
                      <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="L{OHfK*J*RCS6SxTvn.W">
                          <field name="oid">alias.0.Bewegungsmelder.BWM_Bad_1</field>
                        </shadow>
                      </value>
                      <value name="OID1">
                        <shadow type="field_oid" id="G/Yr4W}YyjpF]+|%z/EC">
                          <field name="oid">alias.0.Bewegungsmelder.BWM_Bad_2</field>
                        </shadow>
                      </value>
                      <statement name="STATEMENT">
                        <block type="timeouts_cleartimeout" id="/RL0jba2]_3:HxV/l8Ew">
                          <field name="NAME">timeout</field>
                          <next>
                            <block type="controls_if" id="Vwd`yH-?dfX(g?Yz#vYe">
                              <value name="IF0">
                                <block type="logic_negate" id=",LLLwoaashRhQLF/$id:">
                                  <value name="BOOL">
                                    <block type="variables_get" id="inbzB=3u.=59#v8Z=b=6">
                                      <field name="VAR" id="qrCfu6RSlbXJjjCPf/P-">manuell_ein</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="controls_if" id="e@LN;c0-3IiQ3mPlWpKL">
                                  <mutation else="1"></mutation>
                                  <value name="IF0">
                                    <block type="logic_operation" id="8e(k771IWU7%#IjR{c5a" inline="false">
                                      <field name="OP">AND</field>
                                      <value name="A">
                                        <block type="on_source" id="cRq(*e^$wwz39yls}{S-">
                                          <field name="ATTR">state.val</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <block type="logic_compare" id="*ZCE)GOz2,J$~hQIU5oz">
                                          <field name="OP">LT</field>
                                          <value name="A">
                                            <block type="get_value" id="6wR+e).a1]VM%0Xi/8Wb">
                                              <field name="ATTR">val</field>
                                              <field name="OID">deconz.0.Sensors.53.lux</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="math_number" id=")WR61J+C}769J}O3dm]:">
                                              <field name="NUM">20</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="control" id="$XZ-=YslQG]u-p;EEF#U">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">deconz.0.Groups.8.on</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="logic_boolean" id="w~mMGbfeV-X~0!%vn`c.">
                                          <field name="BOOL">TRUE</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="control" id="*SPNj7{@=N{N%oO!3H~]">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">deconz.0.Groups.8.level</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="math_number" id="t}=aW)^Z`;h+qCZbF2XT">
                                              <field name="NUM">60</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="debug" id="/}Lh|M^gv9R|glZ_S1#S">
                                              <field name="Severity">log</field>
                                              <value name="TEXT">
                                                <shadow type="text" id="Kjf7:mgncC3)9VTO/OC]">
                                                  <field name="TEXT">Bewegung Bad 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">301</field>
                                      <field name="UNIT">sec</field>
                                      <statement name="STATEMENT">
                                        <block type="control" id="*^7bIYM3vHC69N7p1xbg">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">deconz.0.Groups.8.on</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="logic_boolean" id="qboY~;^nMM6jj;+3$MC/">
                                              <field name="BOOL">FALSE</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="debug" id="e?zC_:GX/.@u!`}SQ7P4">
                                              <field name="Severity">log</field>
                                              <value name="TEXT">
                                                <shadow type="text" id="HfoKib*o7AG:EM$;dKxK">
                                                  <field name="TEXT">Keine Bewegung Bad erkannt und Licht aus</field>
                                                </shadow>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </statement>
                                    </block>
                                  </statement>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                    <block type="on_ext" id="6Ep1xYZhs;fE6{ULi%Jt" x="612" y="-87">
                      <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="AE4kvQEZVO!/B=Wlkv4T">
                          <field name="oid">deconz.0.Sensors.33.buttonpressed</field>
                        </shadow>
                      </value>
                      <value name="OID1">
                        <shadow type="field_oid" id="La(|naQX?J|zf8Q^n5VV">
                          <field name="oid">deconz.0.Sensors.43.buttonpressed</field>
                        </shadow>
                      </value>
                      <statement name="STATEMENT">
                        <block type="controls_if" id="Fkmp#,:[](:u|m1#rZ_M">
                          <mutation elseif="1"></mutation>
                          <value name="IF0">
                            <block type="logic_compare" id="^)G:O?pb#Tbd271bURO$">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="?6-BDA}x4o%Aln2|96fd">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="math_number" id="@%Ajr9?},raMKRV!(=/=">
                                  <field name="NUM">1002</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO0">
                            <block type="variables_set" id="F{0JN,.1_g`wZWYrw.pR">
                              <field name="VAR" id="qrCfu6RSlbXJjjCPf/P-">manuell_ein</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="*wTIZ1^W|{M;oGnj3Q0+">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="._;caH:!d941]JJqQ)Bq">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">deconz.0.Groups.8.on</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="`16Y0trSNFT_B7k@{9BC">
                                      <field name="BOOL">TRUE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="control" id="+aG3-VAYoW0pMMChPL1?">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">deconz.0.Groups.8.level</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_number" id="A3zgfihO$uonYS1s~`O=">
                                          <field name="NUM">90</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="debug" id="s27(YkT^AGc`83_%J3Zd">
                                          <field name="Severity">log</field>
                                          <value name="TEXT">
                                            <shadow type="text" id="Q||#DNqJ/[9n5RS[6PP2">
                                              <field name="TEXT">Bad Licht ein</field>
                                            </shadow>
                                          </value>
                                          <next>
                                            <block type="timeouts_cleartimeout" id="m:`.KX;MDj^|ED^4z4aW">
                                              <field name="NAME">timeout2</field>
                                              <next>
                                                <block type="timeouts_settimeout" id="0:sb5p?!eZ!znzO[1(69">
                                                  <field name="NAME">timeout2</field>
                                                  <field name="DELAY">30</field>
                                                  <field name="UNIT">min</field>
                                                  <statement name="STATEMENT">
                                                    <block type="variables_set" id="-s[lpxk5doij*w1,UvMA">
                                                      <field name="VAR" id="qrCfu6RSlbXJjjCPf/P-">manuell_ein</field>
                                                      <value name="VALUE">
                                                        <block type="logic_boolean" id="w?GQqiy04Q492pLC(nU)">
                                                          <field name="BOOL">FALSE</field>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="control" id="sM[^@W|+zd]m9ARP?-gD">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                          <field name="OID">deconz.0.Groups.8.on</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <block type="logic_boolean" id="eD@WOW(a|3-0(ry1xknq">
                                                              <field name="BOOL">FALSE</field>
                                                            </block>
                                                          </value>
                                                          <next>
                                                            <block type="debug" id="/4|EcQ]TynC4o+noB;3a">
                                                              <field name="Severity">log</field>
                                                              <value name="TEXT">
                                                                <shadow type="text" id=";PqhWZ5LTye-)S}yNyT8">
                                                                  <field name="TEXT">Bad Licht aus</field>
                                                                </shadow>
                                                              </value>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </statement>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </statement>
                          <value name="IF1">
                            <block type="logic_compare" id=";4#O$q`D[B#=f,^9NGI*">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="H.t!a2Lu/rQwl^GKA1u#">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="math_number" id="YLPM8pOSPN|R3K2~Mfma">
                                  <field name="NUM">2002</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO1">
                            <block type="variables_set" id="Gn_Ru)Jnrgbqz6q7oVxn">
                              <field name="VAR" id="qrCfu6RSlbXJjjCPf/P-">manuell_ein</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="f-CJ_Jv6Vs%FG!m-1V_r">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                              <next>
                                <block type="control" id="8rIG})y1{r`bWzJaxSfc">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">deconz.0.Groups.8.on</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="logic_boolean" id="kS1@UaWUS.|}:!En8EjD">
                                      <field name="BOOL">FALSE</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="debug" id="k)[PJ.|/R~/N#P#WB`Ix">
                                      <field name="Severity">log</field>
                                      <value name="TEXT">
                                        <shadow type="text" id="]vzf`[9YDH~Mx(_k=!cT">
                                          <field name="TEXT">Bad Licht aus</field>
                                        </shadow>
                                      </value>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </statement>
                        </block>
                      </statement>
                    </block>
                  </xml>
                  
                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @Michael Schmitt last edited by

                    @michael-schmitt sagte: 30 Sekunden vor Ablauf des Timeouts (301Sek) das Licht ein wenig gedimmt wird.

                    Bild_2022-07-10_155448761.png

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

                      @paul53 Danke läuft 👍

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

                        @paul53 Hab mich zu früh gefreut. Wenn ich nun das Licht per Schalter manuell ausschalte, dann wird nachdem die Zeit abgelaufen ist das licht mit 40% eingeschalten und nach 30Sek ausgeschalten.

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

                          @michael-schmitt
                          Den zusätzlichen Timer-Stop hast Du oben eingebaut?

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

                            @paul53 ja habe ich

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

                              @michael-schmitt
                              Dann muss nach dem manuellen Ausschalten ein BWM angesprochen haben.

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

                                @paul53 Nein, es wird dann auch mit 40% eingeschalten (für 30 Sek). Wenn der BWM reagiert dann mit 60%.

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

                                  @michael-schmitt
                                  Ohne BWM-Trigger wird kein Timer gestartet. Wenn nur der sonst-Zweig abgearbeitet wird: Trigger auf keine Bewegung oder Lux >= 20.

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

                                    @paul53
                                    ich gehe ins Bad - BWM schaltet Licht ein
                                    ich gehe aus dem Bad und schalte per Schalter das Licht aus - Licht aus

                                    aber scheinbar läuft der Timer weiter und schaltet das Licht nach der eingestellten Zeit mit 40% an und 30 Sekunden später wieder aus.

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

                                      @michael-schmitt sagte: scheinbar läuft der Timer weiter

                                      Stoppe mal alle Timer bei Tastenbetätigung.

                                      Bild_2022-07-10_230419940.png

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

                                        @paul53 selbes Ergebnis. Habe auch mal Javascript Instanz neu gestartet.

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

                                          @michael-schmitt sagte: ich gehe aus dem Bad und schalte per Schalter das Licht aus

                                          In dem Moment liefert mind. ein BWM noch true und wechselt erst verzögert auf false. Deshalb muss man die Automatik-Freigabe verzögern.

                                          Bild_2022-07-11_084751881.png

                                          Die richtige Verzögerungszeit musst Du selbst ermitteln:

                                          Bild_2022-07-11_112725404.png

                                          Ohne den Dimmer 30 s vor Ausschalten ist es nicht aufgefallen, dass nach ca. 5 Minuten nochmal ausgeschaltet wurde.

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

                                            @paul53 Ich habe von 20-90 Sekunden in 10 Sek. Schritten probiert aber es funktioniert nicht. Die BWMs haben eine Duration von 30 Sekunden und schalten dann auf "false".

                                            2022-07-11 13:45:51.194 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: alias.0.Bewegungsmelder.BWM_Bad_1:true
                                            2022-07-11 13:45:51.195 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: Bewegung Bad erkannt und Licht ein
                                            2022-07-11 13:45:51.614 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: alias.0.Bewegungsmelder.BWM_Bad_2:true
                                            2022-07-11 13:45:51.615 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: Bewegung Bad erkannt und Licht ein
                                            2022-07-11 13:45:57.579 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: Bad Licht aus
                                            2022-07-11 13:46:21.468 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: alias.0.Bewegungsmelder.BWM_Bad_1:false
                                            2022-07-11 13:46:22.108 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: alias.0.Bewegungsmelder.BWM_Bad_2:false
                                            2022-07-11 13:48:29.329 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.FLUR_BEWEGUNG: Keine Bewegung im Flur erkannt und Licht aus
                                            2022-07-11 13:48:52.111 - info: javascript.0 (13166) script.js.common.Bewegungsmelder.BAD_BEWEGUNG_NEU_2: Keine Bewegung Bad erkannt und Licht aus
                                            
                                            paul53 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            477
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

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