NEWS
Zeitfenster in dem Script ausgeführt werden soll
-
Hi,
ich bin neu in der Blockly Programmierung und möchte das ein Script nur in einem bestimmten Zeitfenster ausgeführt wird. Und zwar in der Woche von 17:00 Uhr bis 20:00 Uhr und am Wochenende von 10:00 Uhr bis 22:00 Uhr. Einen Trigger kann ich nicht verwenden. Mit "aktuelle Zeit ist kleiner bzw grösser" könnte ich die Zeit zwischen 17:00 Uhr bis 20 Uhr abfackeln. Aber wie mache ich das mit dem Wochenende, das ist mir noch nicht ganz klar. Ich könnte noch ein falls sonst einfügen und oben neben dem falls noch das "aktuelle Zeit ist kleiner bzw grösser" hinzufügen aber weiter komme ich gerade nicht.
Jemand eine Idee ?
Hier einmal das Script wie es im Moment ist:<xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="3d}EB@SqB|hB+,zAp}%K">Zufall</variable> <variable type="undefined" id="timeout2">timeout2</variable> <variable type="undefined" id="timeout">timeout</variable> <variable type="undefined" id="timeout3">timeout3</variable> </variables> <block type="comment" id="b!|pe^OFH/rH,4^g-#%+" x="-162" y="-188"> <field name="COMMENT">Sonos im Bad über Pir ( Steckdose ) einschalten und Musik abspielenn </field> <next> <block type="on_ext" id="~lMbB0:Q*jP#]=nk?Gn2"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="wA*u?Z)9(r%N`CB={YyB"> <field name="oid">tuya.0.0120036768c63a8690e1.1</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="%DyjIDZ=o5oI~S)mcT5R"> <field name="COMMENT">Prüfe ob die Änderung die Dose ein oder aus geschaltet hat.</field> <next> <block type="controls_if" id="%_JMBf~%RB,U7hvJPSro"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id=",K/J@/~_3,|w-$hujonP"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="rRsD?zs7I7xPzS#5dYoj"> <field name="ATTR">val</field> <field name="OID">tuya.0.0120036768c63a8690e1.1</field> </block> </value> <value name="B"> <block type="logic_boolean" id="JA[VZwmH:T)t=:r!f%sT"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="comment" id="tNK.LFOipiXt=ka)]o0,"> <field name="COMMENT">Wähle eine von drei Playlisten</field> <next> <block type="variables_set" id="UJ4*^Ms.t4xXA}e5+gGQ"> <field name="VAR" id="3d}EB@SqB|hB+,zAp}%K" variabletype="">Zufall</field> <value name="VALUE"> <block type="math_random_int" id="M^S)YBi_[T#YlweQqYN`"> <value name="FROM"> <shadow type="math_number" id="3g0-fSTB;}+YaTw]a9DI"> <field name="NUM">1</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id="QF)fsNwM][mV]x[(^QkC"> <field name="NUM">3</field> </shadow> </value> </block> </value> <next> <block type="debug" id="iY`wo=F02sG=Tn3i|M)["> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="@DVofOcXZk@PnTjN4yZ5"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="-q#[,s~|J?aNb^?~2AR]"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="h7]?0SOylTL]b`ggQH5k"> <field name="TEXT">Zufallszahl ist: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="oxL73oh[p)bc6EDYQhEn"> <field name="VAR" id="3d}EB@SqB|hB+,zAp}%K" variabletype="">Zufall</field> </block> </value> </block> </value> <next> <block type="comment" id="zS.B29tn^G!}|5U@h{@B"> <field name="COMMENT">Warte 45 Sek. bis Play One fertig mit booten ist. </field> <next> <block type="timeouts_settimeout" id="N.Zi:Z;-D33=!0DG5#Vd"> <field name="NAME">timeout2</field> <field name="DELAY">45</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="go/7rv@xc]^18T7R$w6d"> <field name="COMMENT">Setze ausgewählte Playlist</field> <next> <block type="controls_if" id="Qb0=j:cXfp%TH1G%:I=F"> <value name="IF0"> <block type="logic_compare" id="#]:^ZgN{}wS7muvJYQ.I"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="!.zW%7Y?M-3_9FpP}IBJ"> <field name="VAR" id="3d}EB@SqB|hB+,zAp}%K" variabletype="">Zufall</field> </block> </value> <value name="B"> <block type="math_number" id="WO^a|evF2CR@HgiAYh-S"> <field name="NUM">1</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="jDt:n8DD^NlQ3i^DdU]z"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.favorites_set</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="HGj3X=hh=0i.SZyYw?VY"> <field name="TEXT">Soundeo Latest Uploads</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="R438`n-MJ:pn0;K,S`W@"> <value name="IF0"> <block type="logic_compare" id=":*6%AW~C|iwJWpD*saaN"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="Iob~pV;+6t(tgb7BUqhy"> <field name="VAR" id="3d}EB@SqB|hB+,zAp}%K" variabletype="">Zufall</field> </block> </value> <value name="B"> <block type="math_number" id=":)K6X|d2rOR$.m^n)Wom"> <field name="NUM">2</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="It@G^~kq@jIOhOp:lfbp"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.favorites_set</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="c[ujuGYUt^`~.]`6|E;p"> <field name="TEXT">Sax4Love</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="9kEJp*e);]^n`|N,wkVe"> <value name="IF0"> <block type="logic_compare" id="2(g#B?$4w=cAsXz:v9Z{"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="HF|p(uwAnEd!2f1%B$L0"> <field name="VAR" id="3d}EB@SqB|hB+,zAp}%K" variabletype="">Zufall</field> </block> </value> <value name="B"> <block type="math_number" id="^fW$`8+-#W9$SLZ6S7lr"> <field name="NUM">3</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="6ucPT6:(wt`)ve}[l}O2"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.favorites_set</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="r}1@#}8:($3U@M|9]+u?"> <field name="TEXT">80 Verschiedenes</field> </block> </value> </block> </statement> <next> <block type="comment" id="U(nj#85emc.fPwHj(x/v"> <field name="COMMENT">Play Button drücken und Zufallswiedergabe einschalten</field> <next> <block type="control" id="7Ha=#+jIwIv@WIQ,dpTe"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.state</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="O,Cgm-[?73_7.e,,Kawg"> <field name="TEXT">Play</field> </block> </value> <next> <block type="control" id="Vj|M=jqHN2Vw;ldl|1}q"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.shuffle</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="b!OyfmSS@hb*^%g-Bja*"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="~W,)6;jC%L6v}H}E19vi"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.play</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="p@Tq4NGT_+`ZDz9OmxG?"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="control" id="WT|N}iScao.)0C_fmw0l"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.stop</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="+DQ#k_:Fc/$4Wx,@w3sb"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="]i?*`tzPK8Q1G)Ax#Kjh"> <field name="NAME">timeout</field> <field name="DELAY">25</field> <field name="UNIT">min</field> <statement name="STATEMENT"> <block type="comment" id="ept9::Rg-9s.[S8EeZE]"> <field name="COMMENT">Einstellungen zurück setzten</field> <next> <block type="control" id="$A{l6=9dWC7_+uoc]2dC"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.state</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id=",uKPRE_tI2MG|xNU(F2p"> <field name="TEXT">Stop</field> </block> </value> <next> <block type="control" id="3=j[ET#(yu~nkt*be[Xi"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.play</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="W@q$#~nA$oZ[@,ht8GL6"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="control" id="Xj?P}6q?rLh|@~U_M7nP"> <mutation delay_input="false"></mutation> <field name="OID">sonos.0.root.192_168_168_125.stop</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="nH$L.VhS?|.jh$aL3F_#"> <field name="BOOL">TRUE</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="timeouts_settimeout" id="7SOnzWgj4to;E{`mGM+_"> <field name="NAME">timeout3</field> <field name="DELAY">26</field> <field name="UNIT">min</field> <statement name="STATEMENT"> <block type="comment" id="njZoiNzr71$8Bbnrf|w?"> <field name="COMMENT">Strom der Play One ausschalten</field> <next> <block type="control" id="DdS9,DFxM}r92DB,~{+]"> <mutation delay_input="false"></mutation> <field name="OID">tuya.0.0120036768c63a8690e1.1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="z(Q-|1XuV*G:y4l)p*NA"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="debug" id="{9O.pL-u+9SQQS9jPVKa"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="!hH#.aoebG)35y0~vMCR"> <field name="TEXT">test</field> </shadow> <block type="text" id="s:i]N[!E_Q(dr})-b:MH"> <field name="TEXT">Bedezimmer Sonos Script wurde richtig beendet</field> </block> </value> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </xml>
-
@Spitfire4all
was soll denn passieren wenn der Schalter auf "aus" gestellt wird?So wie derzeit dein Script aufgebaut ist, wird gnadenlos nun 25 (24) Minuten Musik abgespielt, ganz gleich was zwischendurch passiert ...eine Unterbrechung ist nicht vorgesehen(??)
ich würde es wohl mit einer Funktion versuchen.
so in etwa
-
@BBTown
Wenn der Schalter auf aus geht dann läuft das Script einfach aus, habe ich eingebaut damit es keine Fehlermeldung im Log gibt. Ja der Lautsprecher läuft 24 Minuten. Wüsste nicht was er zwischendurch machen sollte. Ist halt das erste Script das ich gemacht habe , irgendwie muss man ja einmal an fangen. Stricke bestimmt auch noch eine Präsenz Funktion hinzu. Deine Funktio schaue ich mir einmal an, vielen Dank.HDM
-
@Spitfire4all sagte:
in der Woche von 17:00 Uhr bis 20:00 Uhr und am Wochenende von 10:00 Uhr bis 22:00 Uhr.