@grace13
Sofern sich die Lampen mit dem Dimmwert 0 ausschalten, dann könnte es so gelöst werden.
[image: 1646247090146-397ed99c-1c55-48de-bc45-327f96ec1331-image.png]
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="w$,5eohj54+sLUicSMBm">Lampe 1</variable>
<variable id=",UwtB-e~WJ7)BJ$W@:}*">Lampe 2</variable>
<variable id="Szs/v50CXOqEe@/69%l6">Taste</variable>
</variables>
<block type="comment" id="oju=07HwUA6b8lwV25[O" x="12" y="-87">
<field name="COMMENT">Counter Taste 1</field>
<next>
<block type="on_ext" id="-At(yzVr53|/*DG@C$t8">
<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="oolYED60n8[dt*-J/cvH">
<field name="oid">default</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id="XA#uI7bJ3d-*iaWiE)Vk">
<mutation name="Taste gedrückt">
<arg name="Taste"></arg>
</mutation>
<value name="ARG0">
<block type="get_value" id="SRz4_1mmfv7)!jFhdl/y">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.aa_-_Licht.T1_-_Event</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
<block type="procedures_defnoreturn" id="z3tkIeTxS*fx:Pr=5Tl)" x="537" y="-62">
<mutation>
<arg name="Taste" varid="Szs/v50CXOqEe@/69%l6"></arg>
</mutation>
<field name="NAME">Taste gedrückt</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="logic_switch_case" id="SDzJ6fh`#o}_i4x2-5,^">
<mutation xmlns="http://www.w3.org/1999/xhtml" case="2"></mutation>
<value name="CONDITION">
<block type="variables_get" id="v:@+;cYH$C!lmuW~.M(B">
<field name="VAR" id="Szs/v50CXOqEe@/69%l6">Taste</field>
</block>
</value>
<value name="CASECONDITION0">
<block type="text" id="wof%+tLmyn^6|HYJNuUe">
<field name="TEXT">S</field>
</block>
</value>
<statement name="CASE0">
<block type="controls_if" id=".CGRHUKjat!i2pOmtKG.">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_operation" id="7:;F?rI+jqA3Z:=S3lKd" inline="false">
<field name="OP">OR</field>
<value name="A">
<block type="get_value" id="wa3WmVaFa.wJ$kntpQ!.">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.aa_-_Licht.L1_Switch</field>
</block>
</value>
<value name="B">
<block type="get_value" id="yT_Xc_@(Y=/Y,q-,6jeh">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.aa_-_Licht.L2_Switch</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="comment" id="wEuma7]u]Ie)7ihOp+@)">
<field name="COMMENT">ausschalten wenn mind. 1 Lampe eingeschaltet</field>
<next>
<block type="procedures_callnoreturn" id="!Mzez+)K^@^`A()e25jr">
<mutation name="Licht steuern">
<arg name="Lampe 1"></arg>
<arg name="Lampe 2"></arg>
</mutation>
<value name="ARG0">
<block type="math_number" id="`t;N2JJFZH__-/P$XiHN">
<field name="NUM">0</field>
</block>
</value>
<value name="ARG1">
<block type="math_number" id="pBAe/UHe01K$My7;Ol_I">
<field name="NUM">0</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="comment" id="%kj!::$LaPd!q^W`=Xh8">
<field name="COMMENT">ansonsten Lampe 1 einschalten</field>
<next>
<block type="procedures_callnoreturn" id="Ua@+]P3K7HRw;(NH[YtM">
<mutation name="Licht steuern">
<arg name="Lampe 1"></arg>
<arg name="Lampe 2"></arg>
</mutation>
<value name="ARG0">
<block type="math_number" id="+[[_]%AS}RLQ2y{*KN|(">
<field name="NUM">100</field>
</block>
</value>
<value name="ARG1">
<block type="math_number" id="6.?L8ImF@@lo|Cuv6;|W">
<field name="NUM">0</field>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</statement>
<value name="CASECONDITION1">
<block type="text" id="=?Vr)TF^f5PO8[.l,:uS">
<field name="TEXT">SS</field>
</block>
</value>
<statement name="CASE1">
<block type="procedures_callnoreturn" id="hfp$%TybxDO5jpi7wsj:">
<mutation name="Licht steuern">
<arg name="Lampe 1"></arg>
<arg name="Lampe 2"></arg>
</mutation>
<value name="ARG0">
<block type="math_number" id="dGTH~*ezQfvT(W!V`e5H">
<field name="NUM">0</field>
</block>
</value>
<value name="ARG1">
<block type="math_number" id="~H([Oj~+TNF68,K`tMlv">
<field name="NUM">100</field>
</block>
</value>
</block>
</statement>
<value name="CASECONDITION2">
<block type="text" id="+J4b.u^=Je^}/wF{sPH*">
<field name="TEXT">L</field>
</block>
</value>
<statement name="CASE2">
<block type="procedures_callnoreturn" id="9kp,/F9MN|F]gC;DT/]?">
<mutation name="Licht steuern">
<arg name="Lampe 1"></arg>
<arg name="Lampe 2"></arg>
</mutation>
<value name="ARG0">
<block type="math_number" id="b5DK7vv,=}-n4Pd?6nDF">
<field name="NUM">100</field>
</block>
</value>
<value name="ARG1">
<block type="math_number" id="be*sHHP=}(SUKCiK%-lE">
<field name="NUM">100</field>
</block>
</value>
</block>
</statement>
</block>
</statement>
</block>
<block type="comment" id="X!A:wB13iz#=^t7=8@Zy" x="12" y="113">
<field name="COMMENT">Counter Taste 2</field>
<next>
<block type="on_ext" id="]bS!0]ZideX|8N{16U]L">
<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="kodbXh:{ufHsU17(cdaf">
<field name="oid">default</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id="!VQ2=wTwt$_i4@$BfB)^">
<mutation name="Taste gedrückt">
<arg name="Taste"></arg>
</mutation>
<value name="ARG0">
<block type="get_value" id="=hfX:|]I(B3l!vb0Nzm{">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.aa_-_Licht.T2_-_Event</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
<block type="comment" id="mOX~D@O+6C!G$o36bYQY" x="12" y="313">
<field name="COMMENT">Counter Taste 3</field>
<next>
<block type="on_ext" id="~S|QTMlBb[B5{oXLwiiD">
<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="KrNUw?G9FRG-aC]l7-y5">
<field name="oid">default</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id="p7Wa8BJPw#m#t3%4Z3}Q">
<mutation name="Taste gedrückt">
<arg name="Taste"></arg>
</mutation>
<value name="ARG0">
<block type="get_value" id="F@gR0!GT7ZGRs_}x[!vT">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.aa_-_Licht.T3_-_Event</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
<block type="procedures_defnoreturn" id="+`$SStF:o,WtYrlV69M7" x="537" y="588">
<mutation>
<arg name="Lampe 1" varid="w$,5eohj54+sLUicSMBm"></arg>
<arg name="Lampe 2" varid=",UwtB-e~WJ7)BJ$W@:}*"></arg>
</mutation>
<field name="NAME">Licht steuern</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="control" id="oQ[xo3#VVYqMorYULV!v">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">0_userdata.0.aa_-_Licht.L1_Brightness</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="M[!qW(]]Mq!6zKOL1atP">
<field name="VAR" id="w$,5eohj54+sLUicSMBm">Lampe 1</field>
</block>
</value>
<next>
<block type="control" id="%B^mOp5hU=p,3[f1AHi#">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">0_userdata.0.aa_-_Licht.L2_Brightness</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="n99aHxM{M*Zw`[F15+R_">
<field name="VAR" id=",UwtB-e~WJ7)BJ$W@:}*">Lampe 2</field>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</xml>