@paul53 sagte in Steuerung WLAN Lampe mit BWM und Alexa :
@smarthome2020
Mit einer zusätzlichen Verzögerung sollte sich auch erreichen lassen, dass man mit Alexa nachträglich das Ausschalten verhindern kann.
Spoiler
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="`F$W^to?v_+Mu_sf53:N">Lampe_manuell_eingeschaltet</variable>
<variable type="timeout" id="Timer">Timer</variable>
<variable type="timeout" id="timeout">timeout</variable>
<variable type="timeout" id="sperre">sperre</variable>
</variables>
<block type="on_ext" id="*+LWvR9x0(v4w60=to?1" x="138" y="-162">
<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="#0Pe?QmkrwGg;@a)yTBh">
<field name="oid">zigbee.0.00158d00047b9993.occupancy</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="Tp1k`tjdQjZard`)iZEp">
<value name="IF0">
<block type="logic_negate" id="j4MgM)}nn]hu{(Db[|d)">
<value name="BOOL">
<block type="variables_get" id="5f$){THuc4/Eb9k-q{gF">
<field name="VAR" id="`F$W^to?v_+Mu_sf53:N">Lampe_manuell_eingeschaltet</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="controls_if" id="lNu~B^QbjXmM(vE)5(;+">
<mutation else="1"></mutation>
<value name="IF0">
<block type="on_source" id="GI(yPzZ$4s.)eqe~{GhR">
<field name="ATTR">state.val</field>
</block>
</value>
<statement name="DO0">
<block type="timeouts_cleartimeout" id="UBp2f8jER$h~~WOVohp-">
<field name="NAME">Timer</field>
<next>
<block type="control" id="0rkfos]M(Iz9yOiOJ2]-">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Kinderzimmerlampe.Dimmer</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="Y~QCC3q4.#;5@`KV8TH`">
<field name="NUM">60</field>
</block>
</value>
<next>
<block type="control" id="mlKt=@ZHH9C$twZog5M@">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
<field name="OID">sonoff.0.Kinderzimmerlampe.POWER</field>
<field name="WITH_DELAY">TRUE</field>
<field name="DELAY_MS">100</field>
<field name="UNIT">ms</field>
<field name="CLEAR_RUNNING">TRUE</field>
<value name="VALUE">
<block type="logic_boolean" id="dNH7K{%E,s;r7f=GM_n/">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="timeouts_settimeout" id="o=wP0PZM]mCAg8sUou?O">
<field name="NAME">Timer</field>
<field name="DELAY">15</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="control" id="Zm$7J4:?m1v:cRULh@7y">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">sonoff.0.Kinderzimmerlampe.POWER</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="q,}[{Vs4sT7^i|ZUFIsk">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
</block>
</statement>
</block>
</statement>
</block>
</statement>
<next>
<block type="on_ext" id="wX1WJnlnjny^_[e:7nen">
<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=",U-sYv_4R!-e3dX8x_Bt">
<field name="oid">sonoff.0.Kinderzimmerlampe.POWER</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="controls_if" id="o$C)KB=il6xv,F(ervF9">
<mutation else="1"></mutation>
<value name="IF0">
<block type="on_source" id="@oNqJ:3:`!p6cL3bONY~">
<field name="ATTR">state.val</field>
</block>
</value>
<statement name="DO0">
<block type="controls_if" id=";6vsXSD{(ALi`!4o5n,T">
<mutation elseif="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="niC]_crc_4`]d2qdbKY`">
<field name="OP">EQ</field>
<value name="A">
<block type="on_source" id="G4cYNnn6W*bI^f-zlnNk">
<field name="ATTR">state.from</field>
</block>
</value>
<value name="B">
<block type="text" id="cy^(;3Aa,1gooWK}I_q-">
<field name="TEXT">system.adapter.javascript.0</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="timeouts_cleartimeout" id="6?Dy!-?SqNrN$FAzHC#r">
<field name="NAME">timeout</field>
</block>
</statement>
<value name="IF1">
<block type="logic_negate" id="zMFLfxuUL-PX?(;R:bUX">
<value name="BOOL">
<block type="variables_get" id="xtcFx63g`mqCNvir9V5D">
<field name="VAR" id="sperre" variabletype="timeout">sperre</field>
</block>
</value>
</block>
</value>
<statement name="DO1">
<block type="timeouts_settimeout" id="^FYtV({%+Q03;uE@A^8_">
<field name="NAME">timeout</field>
<field name="DELAY">150</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="variables_set" id="8oi6M;,Ms8vX(@Savk/u">
<field name="VAR" id="`F$W^to?v_+Mu_sf53:N">Lampe_manuell_eingeschaltet</field>
<value name="VALUE">
<block type="logic_boolean" id=",ut1I0/Q=F#gKM*@=j`q">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="timeouts_cleartimeout" id="XlRhaV;z0T8A6`_?r-V.">
<field name="NAME">Timer</field>
</block>
</next>
</block>
</statement>
</block>
</statement>
<next>
<block type="controls_if" id="mYuFsDl5([p8enIRJdaW">
<value name="IF0">
<block type="logic_negate" id="6pAlh;.}.wrIo(7o2bce">
<value name="BOOL">
<block type="variables_get" id=";vfD/RPB=C)e_[|lIx{/">
<field name="VAR" id="sperre" variabletype="timeout">sperre</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="timeouts_settimeout" id="@)DCOI1Sk3o3#n-G,O;z">
<field name="NAME">sperre</field>
<field name="DELAY">300</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="variables_set" id="ZHkTO+B%PEujHe3Aj)$;">
<field name="VAR" id="sperre" variabletype="timeout">sperre</field>
<value name="VALUE">
<block type="logic_null" id="_A;q}fUmhB??ry%!Hl_K"></block>
</value>
</block>
</statement>
</block>
</statement>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="variables_set" id="(0TmLV~o6x;z5/mzVV#P">
<field name="VAR" id="`F$W^to?v_+Mu_sf53:N">Lampe_manuell_eingeschaltet</field>
<value name="VALUE">
<block type="logic_boolean" id="#w+v-Gtx}MJnS*4v#J)u">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
<next>
<block type="debug" id="?*[#%ev=0dk;?{hHM;BE">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="=%iyyg|9YIgwYwX@J{m*">
<field name="TEXT">test</field>
</shadow>
<block type="text_join" id="r?#.g0F0-3J2.Jm.viEA">
<mutation items="6"></mutation>
<value name="ADD0">
<block type="text" id="nSK!os%Y_q01Ild=FJ}E">
<field name="TEXT">Lampe ein: </field>
</block>
</value>
<value name="ADD1">
<block type="on_source" id="|0m8F4.)5bcLeql`ew-M">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="phz=TXZef4!Dko8n=G!j">
<field name="TEXT">, bestätigt: </field>
</block>
</value>
<value name="ADD3">
<block type="on_source" id="?)3?GVa~=_`UT6j6.Lm9">
<field name="ATTR">state.ack</field>
</block>
</value>
<value name="ADD4">
<block type="text" id="Es.W2Onvi60Yjn#jEc57">
<field name="TEXT">, Quelle: </field>
</block>
</value>
<value name="ADD5">
<block type="on_source" id="f:fC_mmIa%6noJp]Qd=(">
<field name="ATTR">state.from</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</xml>
Anmerkung: Das beobachtete Verhalten kann ich mir nur dadurch erklären, dass der BWM direkt mit der Lampe kommuniziert - es ist ja beides Zigbee?
Einschalten durch BWM und ausschalten geht wieder:
12:39:07.122 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: true, bestätigt: false, Quelle: system.adapter.javascript.0
12:39:07.126 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: true, bestätigt: true, Quelle: system.adapter.sonoff.0
12:39:07.214 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: true, bestätigt: true, Quelle: system.adapter.sonoff.0
12:39:37.031 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: false, bestätigt: false, Quelle: system.adapter.javascript.0
12:39:37.058 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: false, bestätigt: true, Quelle: system.adapter.sonoff.0
Ein- und Ausschalten durch Alexa ebenso:
12:41:12.364 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: true, bestätigt: true, Quelle: system.adapter.sonoff.0
12:41:46.140 info javascript.0 (842) script.js.Peripherie.Lampen.Maras_Zimmer.Test: Lampe ein: false, bestätigt: true, Quelle: system.adapter.sonoff.0