Hallo,
in meinem Schlafzimmer befinden sich zwei Xiaomi Bewegungsmelder.
Wenn ein Bewegungsmelder eine Bewegung erkennt, dann soll das Licht für 125 Sekunden angehen. Sollte innerhalb der 125 Sekunden der zweite Bewegungsmelder ebenfalls ausgelöst werden, dann soll der Timer wieder zurückgestellt werden und für weitere 125 Sekunden soll das Licht an bleiben.
Leider klappt mein Skript nicht so ganz, die erste Auslösung ist kein Problem, das Licht bleibt dann für 125 Sekunden an und schaltet sich dann auch aus, löst dann aber der zweite Bewegungsmelder aus, funktioniert es nicht.
Hat jemand einen Lösungsvorschlag?
Und hier der Code aus dem ioBroker:
Spoiler anzeigen
<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="on_ext" id="II(l-3pSZFj:(ZQrMO_R" x="-562" y="-137">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">any</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="p*+%v}A%lm^bk]*hn5j~">
<field name="oid">mihome.0.devices.sensor_motion_aq2_158d00054a78fd.state</field>
</shadow>
<block type="field_oid" id="nS~BG1FkbX=A+EeG4MR1">
<field name="oid">mihome.0.devices.sensor_motion_aq2_158d00054a78fd.state</field>
</block>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="155upG%6~0RrJ4EYmPT4">
<value name="IF0">
<block type="logic_operation" id="Vi,lXW_MucdpywZt4]L!">
<field name="OP">AND</field>
<value name="A">
<block type="logic_compare" id="Ec$MxgB$oh)?Sn-c~Rh9">
<field name="OP">EQ</field>
<value name="A">
<block type="logic_boolean" id="~?)f`z~3{o#r6dDGpM=~">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="B">
<block type="get_value" id="[Lnt0f_otaboX?)x2:V!">
<field name="ATTR">val</field>
<field name="OID">mihome.0.devices.sensor_motion_aq2_158d00054a78fd.state</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_compare" id="K57U=0Gkb55Aq-Wi!6.@">
<field name="OP">LT</field>
<value name="A">
<block type="get_value" id="H9(xim1JaESjqpHpuPF.">
<field name="ATTR">val</field>
<field name="OID">mihome.0.devices.sensor_motion_aq2_158d00054a78fd.lux</field>
</block>
</value>
<value name="B">
<block type="math_number" id=";-lu:d}N`I}caZTD,Amd">
<field name="NUM">7</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="timeouts_cleartimeout" id="BZ0mlmZNq;=g[0/*C`=T">
<field name="NAME">timeout</field>
<next>
<block type="control" id="q^R/wP^+Cjiw9O5,um7]">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Bettbeleuchtung.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="|F.V7J~6m6B6})Z@@S$Y">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="control" id="WOR|DZHr1uht4r#)A$mf">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Bettbeleuchtung.Color</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="text" id="cl.=%)%@/t*AT7Ty?.Gp">
<field name="TEXT">#FAFF78</field>
</block>
</value>
<next>
<block type="timeouts_settimeout" id="vPE9]DplXO6x+o6Lq-c7">
<field name="NAME">timeout</field>
<field name="DELAY">125</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="control" id="mY^9]f-JlbSIby0G5m^l">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Bettbeleuchtung.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="H-(oEWhEVF+k7s]eSfo=">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
<next>
<block type="on_ext" id="F[E11Gqq|:[5YQB[Ebcw">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">any</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid">
<field name="oid">mihome.0.devices.sensor_motion_aq2_158d00054a78fd.state</field>
</shadow>
<block type="field_oid" id="m0`*!{^Rp$`@eoJHNEz,">
<field name="oid">mihome.0.devices.sensor_motion_aq2_158d00054a7778.state</field>
</block>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="@+t`o`g@fY:kenD|@m4Z">
<value name="IF0">
<block type="logic_operation" id="//V[YdrjkqjYa28/XT}9">
<field name="OP">AND</field>
<value name="A">
<block type="logic_compare" id="NPMt9gQ4Evp%qoSyj8mI">
<field name="OP">EQ</field>
<value name="A">
<block type="logic_boolean" id="{NRM_L+X6=nCcJ2,9%6H">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="B">
<block type="get_value" id="-m3]wmF{q`!|qF^G^;7N">
<field name="ATTR">val</field>
<field name="OID">mihome.0.devices.sensor_motion_aq2_158d00054a7778.state</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_compare" id="Zhscns,!T6IrD+@g[U*_">
<field name="OP">LT</field>
<value name="A">
<block type="get_value" id="lATODmS+:t2p,!g2]c/;">
<field name="ATTR">val</field>
<field name="OID">mihome.0.devices.sensor_motion_aq2_158d00054a78fd.lux</field>
</block>
</value>
<value name="B">
<block type="math_number" id="+n?G_h$aDDm!;(e6rF04">
<field name="NUM">7</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="timeouts_cleartimeout" id="cz]l`Qm+ESGY-,^W}~M`">
<field name="NAME">timeout</field>
<next>
<block type="control" id="g25;SwmMLcQwUKJq5F^L">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Bettbeleuchtung.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="EG_qF?!mHsTB}k0|z;F5">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="control" id="3GwLjUoG)q!P,$TLnS{^">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Bettbeleuchtung.Color</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="text" id="L/;E0.l*zs;r(5|@#g;X">
<field name="TEXT">#FAFF78</field>
</block>
</value>
<next>
<block type="timeouts_settimeout" id="B9)1@rMqlqz*/JUxR4B8">
<field name="NAME">timeout2</field>
<field name="DELAY">125</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="control" id="+nL@|O(Fg-#UHG#)i[Q%">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Bettbeleuchtung.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="pCaC.f|c3YUwQ?R]ZGjM">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</next>
</block>
</xml>