- Home
- Deutsch
- Skripten / Logik
- Blockly
- Wochentage im Blockly script
Wochentage im Blockly script
-
Guten Morgen in die Runde,
ich will meinen Kindern das Sonos ab 21:00 abknipsen - die kleinen Teufel stehen einfach wieder auf und drücken einfach wieder "play" und weiter gehts - ich lasse mich inzwischen über Telegramm informieren und stoppe das .... es nervt aber. Effektiv ist aber:
Das Skript schiesst meist nach spätestens 2 Sekunden die Box aus - Sieg der Eltern!
Wie kann ich das aber nur Sonntag bis Donnerstag realisieren?
Gruss
Christian
-
@ch90045
vielleicht geht es auch eleganter, aber so müsste es funktionieren. (ich habe kein Sonos)
Falls Wert bedeutet, falls Dein Trigger wahr ist.
Wenn Du falsch brauchen solltest, dann nimm falls nicht Wert.<xml xmlns="https://developers.google.com/blockly/xml"> <block type="on_ext" id="SYRb|PnH=b0cFb#W|RGv" x="-88" y="-38"> <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="I$p9M?{/l+t0{t8J(Zr}"> <field name="oid">default</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="co|t#wief;ir`,@X5NjB"> <field name="COMMENT">Sonntag</field> <next> <block type="controls_if" id="{Lon+*OA-WwvLXN$Uvx;"> <value name="IF0"> <block type="logic_operation" id="5l{)AW%,LO^z9^L@+8B0" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="on_source" id="?^dDkO~m.qWH%@~`TgGc"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="logic_operation" id="(/ayxs|egmQ|dE90yVhu" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="k8IgtukG@Mnb:=@uzRTs"> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="ti$Nsym!%Q8}0PVI/[tW"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id="Ky:;RjDDdzQ6,dv#W{)?"> <field name="NUM">7</field> </block> </value> </block> </value> <value name="B"> <block type="time_compare" id="AF=Ys:[0}a_o8CA/)j^H"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false"></mutation> <field name="OPTION">></field> <field name="START_TIME">21:00</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="|PXR)X-NqLL@-{x3=SdI"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">Object ID</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="0Pcnol3BGr8mp|Wf+{dc"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <next> <block type="comment" id="%C@haS;8rSEj:bko1Ti~"> <field name="COMMENT">Montag</field> <next> <block type="controls_if" id="@Kw[BG;[[81$4c|*O@6p"> <value name="IF0"> <block type="logic_operation" id="Bj6fZ`Yl_VZDbcJ?(+so" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="on_source" id="n1txZp?X/f$?.o=J=TX*"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="logic_operation" id="G?M@~,HTF9H7cC,7I1Cd" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="tj}B;^7+Oz9:Jz{|]qc."> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="dDz]M|{JmU=E98F%*.Gc"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id="_f.%]r)N1CQXb}=LY?ME"> <field name="NUM">1</field> </block> </value> </block> </value> <value name="B"> <block type="time_compare" id="5-EF40!937?z?6y=}%@1"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false"></mutation> <field name="OPTION">></field> <field name="START_TIME">21:00</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="_A;K_T5=u+HuxQG=nOg_"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">Object ID</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="!]:{rdH}S`IFHru,?h`/"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <next> <block type="comment" id="j]g:nx)QnJps-|zCp(x2"> <field name="COMMENT">Dienstag</field> <next> <block type="controls_if" id="Rv`o0xla)C)mUM5V0/Wd"> <value name="IF0"> <block type="logic_operation" id="%BRctZ,3)8pZF/{{]JF7" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="on_source" id="a6~CW,JmyVG?:43#_GFW"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="logic_operation" id="gZ2kye3?3GG!^+/-#20)" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="aqZdff-HAUIC%V{Xs7c,"> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="#;_cS5aWXHU?567_:1v?"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id="5D+Q,InXc?]Ch-bz,+.K"> <field name="NUM">2</field> </block> </value> </block> </value> <value name="B"> <block type="time_compare" id="f-^BN*{+YG|!C$ftmoH5"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false"></mutation> <field name="OPTION">></field> <field name="START_TIME">21:00</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="mQ3N/s-}t!:X2h^uN9lv"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">Object ID</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="K;|7806HcCU^?b9WBA?h"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <next> <block type="comment" id="IJsFs#sWQLhngaxXd1i/"> <field name="COMMENT">Mittwoch</field> <next> <block type="controls_if" id="o*#s6wyepjw^p2q}Pp,4"> <value name="IF0"> <block type="logic_operation" id="j#Zj2!j!?2R=iF9.l+{@" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="on_source" id="E2W:vzxqeIZc?(oa0;@S"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="logic_operation" id="~v@(i|EruOEf6!ZA9p7n" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="MZB5L;tcvqV;}/}ONai("> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="j|k}0h|faK9Z1YR/br4R"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id=";}]Z];QSySinEoO;MJ|l"> <field name="NUM">3</field> </block> </value> </block> </value> <value name="B"> <block type="time_compare" id="0n6g^(-pxa82wr~QUh;5"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false"></mutation> <field name="OPTION">></field> <field name="START_TIME">21:00</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="G/lPH=7K!0509nd3S[$="> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">Object ID</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="5c09KY,[/AKJgUru?LGW"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <next> <block type="comment" id="jL|Au9|}(EgOF(whgsi*"> <field name="COMMENT">Donnerstag</field> <next> <block type="controls_if" id="w0p+P5bdWHSp9pz@PKR~"> <value name="IF0"> <block type="logic_operation" id="#Z3Jlc-=y^mPq(ikdYyC" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="on_source" id="ET9rC3_M-t+6h[o2qc+3"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="logic_operation" id="A}_Wa9P]M+Tg1FODH4Xs" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="ClB=;nhlyw_!!cqz6,4?"> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="H@ZPGuV9ekyP/?{KQw(7"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id="s_jXIk}v#,HRt8$1Q+$["> <field name="NUM">4</field> </block> </value> </block> </value> <value name="B"> <block type="time_compare" id="aaF]{1gRQCZdRi5.nFj`"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false"></mutation> <field name="OPTION">></field> <field name="START_TIME">21:00</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="jnp7),ZytZ0t:ElQ=B^v"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">Object ID</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="9xJ#GW-3)hvJiPaq|3xT"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
EDIT: so sollte es auch reichen
<xml xmlns="https://developers.google.com/blockly/xml"> <block type="on_ext" id="SYRb|PnH=b0cFb#W|RGv" x="-88" y="-38"> <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="I$p9M?{/l+t0{t8J(Zr}"> <field name="oid">default</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="@Kw[BG;[[81$4c|*O@6p"> <value name="IF0"> <block type="logic_operation" id="Bj6fZ`Yl_VZDbcJ?(+so" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="on_source" id="n1txZp?X/f$?.o=J=TX*"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="logic_operation" id="d6/;]x8Y{]Y~qeCs,h+=" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="time_compare" id="5-EF40!937?z?6y=}%@1"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false"></mutation> <field name="OPTION">></field> <field name="START_TIME">21:00</field> </block> </value> <value name="B"> <block type="logic_operation" id="G?M@~,HTF9H7cC,7I1Cd" inline="false"> <field name="OP">OR</field> <value name="A"> <block type="logic_compare" id="tj}B;^7+Oz9:Jz{|]qc."> <field name="OP">LTE</field> <value name="A"> <block type="time_get" id="dDz]M|{JmU=E98F%*.Gc"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id="_f.%]r)N1CQXb}=LY?ME"> <field name="NUM">4</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="|%Xjwpcp7tM/2y,j,p=m"> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="5=iybj%z6*U!$S:@l{oJ"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <value name="B"> <block type="math_number" id="/D9SgJiETsd7w$k?7uJu"> <field name="NUM">7</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="_A;K_T5=u+HuxQG=nOg_"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">Object ID</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="!]:{rdH}S`IFHru,?h`/"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> </block> </statement> </block> </xml>
-
@dslraser Super - ich suche mir gerade nen Wolf um raus zu finden, welche Nummer welchem Wochentag zugeordnet ist. Wo steht das?
Gruss
Christian
-
-
@ch90045
das passiert wenn Du das heute machst und diesen Baustein ohne Trigger einmal im Blockly startest...(erklärt sich dann auch selbst)javascript.0 (2200) script.js.99_Test.Wochentag: 7
-
@ch90045 sagte: nur Sonntag bis Donnerstag realisieren?
-
@paul53 sagte in Wochentage im Blockly script:
nur Sonntag bis Donnerstag realisieren?
ach ja, Sonntag bis Donnerstag...(ich habe Donnerstag bis Sonntag)
@ch90045 sorry, da habe ich wohl nicht richtig gelesen. Ich habe die zwei Beispiele geändert.