- Home
- Deutsch
- Skripten / Logik
- Blockly
- Nachtlampe über Sensor und Taster steuern
Nachtlampe über Sensor und Taster steuern
-
@paul53
Hoi Paul
Danke für dein Ansatz:
Lampe manuell ein aus funktioniert
BWM schaltet ein aber nicht mehr aus
So sieht mein script aus:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</variable> <variable type="timeout" id="timeout">timeout</variable> </variables> <block type="comment" id=":u.dX05IWI,be};L=IPY" x="-1312" y="-1762"> <field name="COMMENT">Click</field> <next> <block type="on" id="KQ*8.ox:OvD7*-L=MFM("> <field name="OID">zigbee.0.00158d000407e31a.click</field> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="q{jeb|uyZ[57cIZ$poJU"> <field name="NAME">timeout</field> <next> <block type="variables_set" id="1sMJi5*=g=AjtZ]DoHx$"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> <value name="VALUE"> <block type="logic_negate" id="k-7I8H^]YJVJFWN.,[Kf"> <value name="BOOL"> <block type="get_value" id="rlW+ako/K{Y$GQR8oT:@"> <field name="ATTR">val</field> <field name="OID">zigbee.0.00158d000407e31a.click</field> </block> </value> </block> </value> <next> <block type="comment" id="c5!~7R{Ml2+gvYqHn,%)"> <field name="COMMENT">Nachtlicht</field> <next> <block type="toggle" id="rV#O!Q1RhueZ]dZqGuX="> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <next> <block type="control" id="fT{Q3gE(27rtV^gU6Nu0"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.active_bright</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">100</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="_zE/JrMFpq;BZ3G[)$oH"> <field name="NUM">20</field> </block> </value> <next> <block type="control" id="BuQ_]H~ElFUUlEPKM^M@"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.rgb</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">200</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="text" id="I=e3]aC5H!ul7Jc{bmRm"> <field name="TEXT">#eb8934</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="Pa-rB@81*`CuS!f3V0hf"> <field name="COMMENT">Motion</field> <next> <block type="on" id="lF{Oa!DmK.4-.WoKU:NE"> <field name="OID">zigbee.0.00158d0001e0d4fe.occupancy</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="comment" id="x#%#V_yErP_3yrY-{d+y"> <field name="COMMENT">Nachtlicht über motion</field> <next> <block type="controls_if" id="3#^9G[-b+zkV)r8?r@?y"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_negate" id="99Kv0cDU.zPBt_@VV.Is"> <value name="BOOL"> <block type="variables_get" id="T^EHo3Ju[@-JN3nzV65a"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> </block> </value> </block> </value> <statement name="DO0"> <block type="timeouts_cleartimeout" id="}P?BJ5G;n?90,p1M}dxo"> <field name="NAME">timeout</field> <next> <block type="control" id="BA|4UT276)8u3;+KuI0,"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="z2h4yC`oe)))ma?k!/Ic"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="9%McAKp.?{;RB-)-IaK."> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.active_bright</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">100</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="S^~bC8_dc:}$wdxK6*Tq"> <field name="NUM">20</field> </block> </value> <next> <block type="control" id="EWKKLn.}e2`!WXhYFiz!"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.rgb</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">200</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="text" id="@iN}e1jA=M)u%fu=,i$:"> <field name="TEXT">#eb8934</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="timeouts_settimeout" id=".|uwn/q+L=H1rib1gaL="> <field name="NAME">timeout</field> <field name="DELAY">2</field> <field name="UNIT">min</field> <statement name="STATEMENT"> <block type="control" id="?D28qe`qU~brep+{LD7P"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="aye^PJner)]E`fJuISf_"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </xml>
Wo liegt mein Fehler? -
@crunchip
Hy
Ich hatte alle Varianten durchgespielt von wurde geändert, aktualisiert, ist wahr, ist unwahr, Ergebnis: true-false; true-false; true; false
Wie kriege ich das hin dass der Datenpunkt auf true stehen bleibt und bei einem weiteren klick wieder auf false geht? -
@albi_63 said: Wo liegt mein Fehler?
Die Variable manuell_ein muss mit dem negierten Wert von power (Licht) gesetzt werden.
-
@paul53
es will nicht klappen......
-
@paul53
die variable manuell wird mit dem wert auf true gestzt obwohl "nicht" davor steht
Lampe an variable true
Lampe aus variable false22:33:18.553 warn javascript.0 (20198) script.js.common.Xiaomi.Nachtlicht_Schlafen: true 22:34:44.060 warn javascript.0 (20198) script.js.common.Xiaomi.Nachtlicht_Schlafen: false
Der Wert wird nicht negiert
-
@albi_63 said: Der Wert wird nicht negiert
Doch der Wert wird negiert: Wenn die Lampe aus ist und der Tastendruck erfolgt, wird die Variable auf true gesetzt, anschließend wird mit "umschalten" die Lampe eingeschaltet, ist also manuell ein.
Der Motion-Teil ist falsch:<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</variable> <variable type="timeout" id="timeout">timeout</variable> </variables> <block type="comment" id=":u.dX05IWI,be};L=IPY" x="-1312" y="-1762"> <field name="COMMENT">Click</field> <next> <block type="on" id="KQ*8.ox:OvD7*-L=MFM("> <field name="OID">zigbee.0.00158d000407e31a.click</field> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="q{jeb|uyZ[57cIZ$poJU"> <field name="NAME">timeout</field> <next> <block type="variables_set" id="1sMJi5*=g=AjtZ]DoHx$"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> <value name="VALUE"> <block type="logic_negate" id="k-7I8H^]YJVJFWN.,[Kf"> <value name="BOOL"> <block type="get_value_var" id="/5nwrO$H{/j;]AN#Vk4o"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="$dH8YdEIVx,/~FI_M+~d"> <field name="TEXT">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="comment" id="c5!~7R{Ml2+gvYqHn,%)"> <field name="COMMENT">Nachtlicht</field> <next> <block type="toggle" id="rV#O!Q1RhueZ]dZqGuX="> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <next> <block type="controls_if" id="4k{mgF_!#2`fZbY5+`0|"> <value name="IF0"> <block type="variables_get" id=",;AAh|.czd2*ADKq/W[Y"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> </block> </value> <statement name="DO0"> <block type="control" id="fT{Q3gE(27rtV^gU6Nu0"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.active_bright</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">100</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="_zE/JrMFpq;BZ3G[)$oH"> <field name="NUM">20</field> </block> </value> <next> <block type="control" id="BuQ_]H~ElFUUlEPKM^M@"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.rgb</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">200</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="text" id="I=e3]aC5H!ul7Jc{bmRm"> <field name="TEXT">#eb8934</field> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="Pa-rB@81*`CuS!f3V0hf"> <field name="COMMENT">Motion</field> <next> <block type="on" id="lF{Oa!DmK.4-.WoKU:NE"> <field name="OID">zigbee.0.00158d0001e0d4fe.occupancy</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="controls_if" id="r;s$c|ImC2M9pxs.@OOr"> <value name="IF0"> <block type="logic_negate" id="99Kv0cDU.zPBt_@VV.Is"> <value name="BOOL"> <block type="variables_get" id="T^EHo3Ju[@-JN3nzV65a"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> </block> </value> </block> </value> <statement name="DO0"> <block type="comment" id="x#%#V_yErP_3yrY-{d+y"> <field name="COMMENT">Nachtlicht über motion</field> <next> <block type="controls_if" id="3#^9G[-b+zkV)r8?r@?y"> <mutation else="1"></mutation> <value name="IF0"> <block type="on_source" id="8]6][2AQ`3:RC=jLj4W!"> <field name="ATTR">state.val</field> </block> </value> <statement name="DO0"> <block type="timeouts_cleartimeout" id="}P?BJ5G;n?90,p1M}dxo"> <field name="NAME">timeout</field> <next> <block type="control" id="BA|4UT276)8u3;+KuI0,"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="z2h4yC`oe)))ma?k!/Ic"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="9%McAKp.?{;RB-)-IaK."> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.active_bright</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">100</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="S^~bC8_dc:}$wdxK6*Tq"> <field name="NUM">20</field> </block> </value> <next> <block type="control" id="EWKKLn.}e2`!WXhYFiz!"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.rgb</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">200</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="text" id="@iN}e1jA=M)u%fu=,i$:"> <field name="TEXT">#eb8934</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="timeouts_settimeout" id=".|uwn/q+L=H1rib1gaL="> <field name="NAME">timeout</field> <field name="DELAY">2</field> <field name="UNIT">min</field> <statement name="STATEMENT"> <block type="control" id="?D28qe`qU~brep+{LD7P"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="aye^PJner)]E`fJuISf_"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </xml>
-
@paul53
Die Lampe geht mit Sensor ein aber nicht mehr aus.
Mein Xiaomi Sensor hat einen fixen Nachlauf von 60 Sek. Das heisst Bewegung true nach 60 Sek. false
Hat das einen Einfluss, meines Erachtens nicht..
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</variable> <variable type="timeout" id="timeout">timeout</variable> </variables> <block type="comment" id=":u.dX05IWI,be};L=IPY" x="-1312" y="-1762"> <field name="COMMENT">Click</field> <next> <block type="on" id="KQ*8.ox:OvD7*-L=MFM("> <field name="OID">zigbee.0.00158d000407e31a.click</field> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="timeouts_cleartimeout" id="q{jeb|uyZ[57cIZ$poJU"> <field name="NAME">timeout</field> <next> <block type="variables_set" id="1sMJi5*=g=AjtZ]DoHx$"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> <value name="VALUE"> <block type="logic_negate" id="3ki44jMVao7kIBGHy^F%"> <value name="BOOL"> <block type="get_value" id="rlW+ako/K{Y$GQR8oT:@"> <field name="ATTR">val</field> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> </block> </value> </block> </value> <next> <block type="comment" id="c5!~7R{Ml2+gvYqHn,%)"> <field name="COMMENT">Nachtlicht</field> <next> <block type="toggle" id="rV#O!Q1RhueZ]dZqGuX="> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <next> <block type="control" id="fT{Q3gE(27rtV^gU6Nu0"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.active_bright</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">100</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="_zE/JrMFpq;BZ3G[)$oH"> <field name="NUM">20</field> </block> </value> <next> <block type="control" id="BuQ_]H~ElFUUlEPKM^M@"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.rgb</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">200</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="text" id="I=e3]aC5H!ul7Jc{bmRm"> <field name="TEXT">#eb8934</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="comment" id="Pa-rB@81*`CuS!f3V0hf"> <field name="COMMENT">Motion</field> <next> <block type="on" id="lF{Oa!DmK.4-.WoKU:NE"> <field name="OID">zigbee.0.00158d0001e0d4fe.occupancy</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="comment" id="x#%#V_yErP_3yrY-{d+y"> <field name="COMMENT">Nachtlicht über motion</field> <next> <block type="controls_if" id="3#^9G[-b+zkV)r8?r@?y"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_negate" id="99Kv0cDU.zPBt_@VV.Is"> <value name="BOOL"> <block type="variables_get" id="T^EHo3Ju[@-JN3nzV65a"> <field name="VAR" id="hvwDAq^LjR-M(p:pnAqs">manuell_ein</field> </block> </value> </block> </value> <statement name="DO0"> <block type="timeouts_cleartimeout" id="}P?BJ5G;n?90,p1M}dxo"> <field name="NAME">timeout</field> <next> <block type="control" id="BA|4UT276)8u3;+KuI0,"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="z2h4yC`oe)))ma?k!/Ic"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="9%McAKp.?{;RB-)-IaK."> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.active_bright</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">100</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="math_number" id="S^~bC8_dc:}$wdxK6*Tq"> <field name="NUM">20</field> </block> </value> <next> <block type="control" id="EWKKLn.}e2`!WXhYFiz!"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.rgb</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">200</field> <field name="UNIT">ms</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"> <block type="text" id="@iN}e1jA=M)u%fu=,i$:"> <field name="TEXT">#eb8934</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="timeouts_settimeout" id=".|uwn/q+L=H1rib1gaL="> <field name="NAME">timeout</field> <field name="DELAY">10</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="control" id="?D28qe`qU~brep+{LD7P"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">yeelight-2.0.YeelightColorPulb-Schlafen.control.power</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="aye^PJner)]E`fJuISf_"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </xml>
-
@paul53
Habe script jetzt angepasst, teste es jetzt
Feedback kommt demnächst
Danke dir -
@paul53
Das Script läuft, super.
Vielen vielen Dank dir. -
Sollte es nicht auch einfach reichen ins "Occupancy" "falls" ein "und wenn power=false" zu packen? Dann reagiert der BWM nur bei ausgeschlteter Lampe.
Bild ist vom Original des TO.