- Home
- Deutsch
- Skripten / Logik
- Blockly
- Multimediasystem steuern
Multimediasystem steuern
-
Hallo,
folgendes Szenario soll durchgeführt werden:Wenn ich TV schaue, soll das Ambilight und die Musikanlage angehen. Wenn ich den Fernseher ausschalte, dann soll beides ausgehen.
Wenn ich Musik (per MPD) höre, soll die Musikanlage angehen bzw. ausgehen.
Der Fernseher und Raspberry (MPD) hängen beide an der Denon Anlage.Nun habe ich folgendes Blockly gebaut. Damit funktioniert Szenario 1 (TV an, Musikanlage an...).
Jetzt gibt es aber folgendes Problem: Wenn ich den Fernseher aus habe, dann triggert mir das Blockly permanent die Befehle, sodass die Musikanlage auch ausgeht, wenn ich Musik höre.
Es müsste nun ein zweites Blockly geben oder in diesem integriert werden, dass sobald ein Wert sich bei MPD ändert, die Musikanlage nicht ausgeschaltet wird, bzw. die Musikanlage angeschaltet wird.
Bei MPD gibt es den Wert "elapsed" (hier wird die Zeit des Liedes in Sekunden in Echtzeit ausgegeben (Wert ist in Zahlen).
Meine Idee war nun, daran anzuknüpfen:
Sollte sich der Zahlenwert ändern, dann sollte die Musikanlage sich anschalten. Sollte der Zahlenwert gleich bleiben, dann wird die Musikanlage ausgeschaltet.
Wie kann ich nun beides miteinander verbinden?Hier nun mein blockly zum ersten Teil. Am zweiten Teil scheitere ich:
<xml xmlns="https://developers.google.com/blockly/xml"> <block type="on_ext" id="Fx|_D%=B(QPoNHFkNhEj" x="163" y="63"> <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="m.T|Vgh#cPW`fxYx9$!D"> <field name="oid">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="S(R:!8@:Zp[M]3a~Le`?"> <value name="IF0"> <block type="logic_compare" id="FY1.28aBxqD|Crw6m/e@"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="{n11RGVaQQ0jvJs~fuIj"> <field name="ATTR">val</field> <field name="OID">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </block> </value> <value name="B"> <block type="math_number" id="i@DH2MXkG1-~jZ]~yCYD"> <field name="NUM">1</field> </block> </value> </block> </value> <statement name="DO0"> <block type="exec" id=",YpKq*wGc*yeba5@g(1d"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG">log</field> <value name="COMMAND"> <shadow type="text" id="OPsxKe4KPq[{bH4U6R_u"> <field name="TEXT">python /home/iobroker/DreamScreenComander.py -m 0</field> </shadow> </value> <next> <block type="control" id="?k/m#uwpTWP!vvWw*/nq"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.settings.powerSystem</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="^!VoEym1-xs#L5@j9@Oz"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </statement> <next> <block type="controls_if" id="x)Gz-(4[{E1vI3gHQJ$!"> <value name="IF0"> <block type="logic_compare" id="|T:klgkOuV3gJkn_+)Y`"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="aF,gZeVq!?nI[Y)Ah6oh"> <field name="ATTR">val</field> <field name="OID">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </block> </value> <value name="B"> <block type="math_number" id="W3BfDdN/prR}_r7}#cL/"> <field name="NUM">1</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id=".fx*pMS|^Y#|W4]R9e4@"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.settings.powerSystem</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="(c_FG{QO)`zjk0*8sn*x"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="Y(lCWcKSdjMOK7I4W4)/"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.zoneMain.selectInput</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="P.oP+Y*B!;-g*X0^3zFd"> <field name="TEXT">SAT/CBL</field> </block> </value> <next> <block type="exec" id="[K!H9I_UMc39$^/a}h/0"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG">log</field> <value name="COMMAND"> <shadow type="text" id="iEK`A$_)Ww5dJl0N/9]S"> <field name="TEXT">python /home/iobroker/DreamScreenComander.py -m 1</field> </shadow> </value> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> <block type="comment" id="@`s,ARMz+*DZ*ns;z2m_" x="413" y="238"> <field name="COMMENT">schaltet DreamScreen und </field> <next> <block type="comment" id="`QrHR4){y0D-$H`Cb4jZ"> <field name="COMMENT">Musikanlage aus</field> </block> </next> </block> <block type="on_ext" id="%4Mq78sNXry$5+%eP{WQ" disabled="true" x="863" y="288"> <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=")umAgr)+p`]Px}ybe-ui"> <field name="oid">mpd.0.elapsed</field> </shadow> </value> </block> <block type="comment" id="nNJ8BG7M~@beAj{9o0,h" x="413" y="538"> <field name="COMMENT">schaltet DreamScreen ein</field> <next> <block type="comment" id="u1ce#wS)o^E@*zvKa`lv"> <field name="COMMENT">Musikanlage ein</field> </block> </next> </block> </xml>
-
bin nun einen Schritt weiter gekommen:
Szenario 1 funktioniert weiterhin, Szenario 2 funktioniert für das Einschalten (wenn ich ein Lied starte, geht die Hifianlage an).
Mein Problem ist nun, das die Anlage aber nicht ausgeht, wenn die Sekunden des Liedes sich nicht mehr aktualisieren (indem z.B. das Lied fertig ist bzw. ich auf stoppe drücke).
Kann mir bitte jemand beim letzen Baustein helfen? Mit diesen Einstellungen geht es leider nicht....
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="mmv]z.8YLbMtrQaYikL!">Musikanlage</variable> </variables> <block type="on_ext" id="Fx|_D%=B(QPoNHFkNhEj" x="163" y="63"> <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="m.T|Vgh#cPW`fxYx9$!D"> <field name="oid">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="S(R:!8@:Zp[M]3a~Le`?"> <value name="IF0"> <block type="logic_operation" id="(-t@?9~r(H-Z~iZD:^FU" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="FY1.28aBxqD|Crw6m/e@"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="{n11RGVaQQ0jvJs~fuIj"> <field name="ATTR">val</field> <field name="OID">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </block> </value> <value name="B"> <block type="math_number" id="i@DH2MXkG1-~jZ]~yCYD"> <field name="NUM">1</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="Z#2{]0!?T2WA,_(T/bo("> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="nGVfYfcxXzXHQI8QA{#h"> <field name="ATTR">val</field> <field name="OID">denon.0.zoneMain.selectInput</field> </block> </value> <value name="B"> <block type="text" id="x1X,(eWop1!H~TC_Q`Mh"> <field name="TEXT">SAT/CBL</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="exec" id=",YpKq*wGc*yeba5@g(1d"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG">log</field> <value name="COMMAND"> <shadow type="text" id="OPsxKe4KPq[{bH4U6R_u"> <field name="TEXT">python /home/iobroker/DreamScreenComander.py -m 0</field> </shadow> </value> <next> <block type="control" id="?k/m#uwpTWP!vvWw*/nq"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.settings.powerSystem</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="^!VoEym1-xs#L5@j9@Oz"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </statement> <next> <block type="controls_if" id="x)Gz-(4[{E1vI3gHQJ$!"> <value name="IF0"> <block type="logic_compare" id="|T:klgkOuV3gJkn_+)Y`"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="aF,gZeVq!?nI[Y)Ah6oh"> <field name="ATTR">val</field> <field name="OID">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </block> </value> <value name="B"> <block type="math_number" id="W3BfDdN/prR}_r7}#cL/"> <field name="NUM">1</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id=".fx*pMS|^Y#|W4]R9e4@"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.settings.powerSystem</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="(c_FG{QO)`zjk0*8sn*x"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="Y(lCWcKSdjMOK7I4W4)/"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.zoneMain.selectInput</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="P.oP+Y*B!;-g*X0^3zFd"> <field name="TEXT">SAT/CBL</field> </block> </value> <next> <block type="exec" id="[K!H9I_UMc39$^/a}h/0"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG">log</field> <value name="COMMAND"> <shadow type="text" id="iEK`A$_)Ww5dJl0N/9]S"> <field name="TEXT">python /home/iobroker/DreamScreenComander.py -m 1</field> </shadow> </value> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> <next> <block type="on_ext" id="%4Mq78sNXry$5+%eP{WQ"> <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=")umAgr)+p`]Px}ybe-ui"> <field name="oid">mpd.0.elapsed</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id=":6M+eB{S2[Kw;Ii#^5hB"> <field name="VAR" id="mmv]z.8YLbMtrQaYikL!">Musikanlage</field> <value name="VALUE"> <block type="on_source" id="~K0FW}/iy[5*q:+t$uJO"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="controls_if" id="drx%pg(zTh!FY.XmLH;/"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="variables_get" id="4C:FRhcd[@layfR_p3:g"> <field name="VAR" id="mmv]z.8YLbMtrQaYikL!">Musikanlage</field> </block> </value> <statement name="DO0"> <block type="control" id="5OVIMe*7Nw/QFc]Dhw*A"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.settings.powerSystem</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="ao_7cSl_3ybA~`%+iNZH"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="b.$2WncU3v9S24?KjhW)"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.zoneMain.selectInput</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="-n+x0WYu^,O8DxGk^fam"> <field name="TEXT">DVD</field> </block> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_operation" id="3l:0ME3@Gwf5]0iw+]co" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_negate" id="L)#E]ljQYt]a:sje3Gpv"> <value name="BOOL"> <block type="variables_get" id="lqI6.OC!*uCW9,2:5T}2"> <field name="VAR" id="mmv]z.8YLbMtrQaYikL!">Musikanlage</field> </block> </value> </block> </value> <value name="B"> <block type="logic_negate" id="8slv5,8/@tYb%g~2HO[W"> <value name="BOOL"> <block type="logic_compare" id="sF^0#SSYJf|v(fjTs+H5"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="?Kr2-/]7@O-Env0SF]DH"> <field name="ATTR">val</field> <field name="OID">hm-rpc.1.0001DBE9915A4A.6.POWER</field> </block> </value> <value name="B"> <block type="math_number" id="i#?-VE@Ea=E~[YyCC.%z"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="control" id="gnl}{s5:oPKfm??M1a4v"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">denon.0.settings.powerSystem</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="`DfaZ4PB7tqtLT#hlR}Y"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> <block type="comment" id="@`s,ARMz+*DZ*ns;z2m_" x="412" y="287"> <field name="COMMENT">schaltet DreamScreen und </field> </block> <block type="comment" id="`QrHR4){y0D-$H`Cb4jZ" x="613" y="287"> <field name="COMMENT">Musikanlage aus</field> </block> <block type="comment" id="nNJ8BG7M~@beAj{9o0,h" x="413" y="562"> <field name="COMMENT">schaltet DreamScreen und</field> </block> <block type="comment" id="u1ce#wS)o^E@*zvKa`lv" x="613" y="563"> <field name="COMMENT">Musikanlage ein</field> </block> </xml>
-
Keiner eine Idee? Mir würde es schon reichen, wenn mir jemand sagen könnte, wie ich den Baustein "wurde aktualisiert" zu "wurde nicht aktualisiert" verändern kann...