NEWS
Blockly Script anhalten wenn sich Anwesenheit ändert
-
Hallo,
ich habe ein Script, welches bei dem Trigger "Astro" und der Bedingung Abwesenheit eine Beleuchtungsszene abspielt, welche die Wohnung als belebt wirken lassen soll. Die Beleuchtung einzelner Zimmer wird hierbei mit unterschiedlichen Verzögerungen geschalten.
Jetzt wollte ich, dass wenn sich, während das Script läuft, die Abwesenheit ändert das gesamte Script beendet wird, damit diese Beleuchtungsszenerie abgeschaltet wird. Dazu hatte ich eine Interval Abfrage meines Abwesenheits Datenpunktes angelegt, welcher bei Anwesenheit alle Lampen ausschaltet.
Der Nachteil: wenn ich dann aktiv Lampen einschalten will, werden diese immer wieder ausgeschalten, weil ich ja anwesend bin.
Am besten wäre also wenn ich das gesamte Script bei Änderung der Abwesenheit beenden könnte. Leider habe ich auch im Netz nichts dazu gefunden.
Habt ihr evtl. eine Idee.
Danke -
@bigbretl
man beendet keine skripte. nimm in dein Skript die Anwesenheit schaltung mit rein. -
Danke schon mal. Ich hatte bereits die Anwesenheit mit im Script, sodass die Lampen dann ausgeschaltet wurden. Aber die mit Verzögerung eingestellten Lampen haben weiterhin reagiert.
Gruß bb -
screenshot sind mies :))
du musst die Timeouts oder intervalle dann stopp wenn du anwesend=true schaltest.
Edit: das machst du am besten immer wenn du intervall oder timeout benutzt um nicht 10fach das ding losrollen zu lassen
-
@bigbretl sagte in Blockly Script anhalten wenn sich Anwesenheit ändert:
lche die Wohnung als belebt wirken lassen soll.
https://forum.iobroker.net/topic/1671/vorlage-anwesenheitssimulation-script
gibt auch was fertiges dazu
-
Danke für die Anregungen. Könnte es so funktionieren?
Ist der untere Intervall Anwesenheitsabfrage überhaupt erforderlich, oder würde dieser "falls mache" Block auch ohne dem Intervall funktionieren?
-
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable type="interval" id="Intervall">Intervall</variable> <variable type="timeout" id="anwensenheitan">anwensenheitan</variable> <variable type="timeout" id="anwensenheitaus">anwensenheitaus</variable> <variable type="timeout" id="anwensenheitan2">anwensenheitan2</variable> <variable type="timeout" id="anwensenheitaus2">anwensenheitaus2</variable> </variables> <block type="astro" id="+S#C)yw_?vN!(qgNj3=!" x="-113" y="312"> <field name="TYPE">sunrise</field> <field name="OFFSET">0</field> <statement name="STATEMENT"> <block type="comment" id="+5@q6bGlc0f+Wm-@DVWR"> <field name="COMMENT">lampen dauer an</field> </block> </statement> </block> <block type="procedures_defnoreturn" id="xO`O]lBc4U@v47j|?L56" x="538" y="288"> <field name="NAME">anwesenheitssimulation</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="timeouts_clearinterval" id="(UXS(UaMUe5Co454JBmK"> <field name="NAME">Intervall</field> <next> <block type="timeouts_setinterval" id="*B51C./pT8WwEnk^|}CO"> <field name="NAME">Intervall</field> <field name="INTERVAL">25</field> <field name="UNIT">min</field> <statement name="STATEMENT"> <block type="timeouts_settimeout" id="3p|Wb{r#X,oaB4|!Mc|O"> <field name="NAME">anwensenheitan</field> <field name="DELAY">1</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="i/6%g:Q8.(]W:(ROU[MF"> <field name="COMMENT">lampe an</field> </block> </statement> <next> <block type="timeouts_settimeout" id="[Y%6_t%^9ak8kp3T%b)|"> <field name="NAME">anwensenheitaus</field> <field name="DELAY">60</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="n(]-wO0`k3a{[Z8kS8aZ"> <field name="COMMENT">lampe aus</field> </block> </statement> <next> <block type="timeouts_settimeout" id="],%!B`r_?%xt_Of1ulXs"> <field name="NAME">anwensenheitan2</field> <field name="DELAY">1</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="YDU,FU:u_4(!CxYH#`${"> <field name="COMMENT">lampe 2 an</field> </block> </statement> <next> <block type="timeouts_settimeout" id="JLRcd(ALsW;iZ]!p5Dk["> <field name="NAME">anwensenheitaus2</field> <field name="DELAY">60</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="comment" id="s}@W4E2sq2l}dsm}^G)}"> <field name="COMMENT">lampe 2 aus</field> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> <block type="comment" id="T9r2CU5/E9%nY^g`#HI^" x="-113" y="437"> <field name="COMMENT">anwesenheit state als trigger</field> <next> <block type="on_ext" id="Pn0$AOxj;tJe+1[I$K$U"> <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="xzx-QLtW,pa!})Gpmr}w"> <field name="oid">default</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="f:3yqoU.%e[QV@;:[QBQ"> <mutation else="1"></mutation> <value name="IF0"> <block type="on_source" id="o+$zZYo2SrJJiBF~Bogs"> <field name="ATTR">state.val</field> </block> </value> <statement name="DO0"> <block type="controls_if" id="2CA?q(D4eU)jrIy|1cqA"> <value name="IF0"> <block type="time_compare_ex" id="}2_p|nd{|16aHCZJVo@L"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">></field> <value name="START_TIME"> <shadow type="text" id="efb:Q/]]LY68ACwaCfK8"> <field name="TEXT">21:00</field> </shadow> </value> </block> </value> <statement name="DO0"> <block type="procedures_callnoreturn" id="`=LE!-T7FkaJ@EfiXLEW"> <mutation name="anwesenheitssimulation"></mutation> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="timeouts_cleartimeout" id="]FOF(g=*FGQ-62vt9J`d"> <field name="NAME">anwensenheitan</field> <next> <block type="timeouts_cleartimeout" id="7c.!vnD,fx|XdQF8POfv"> <field name="NAME">anwensenheitaus</field> <next> <block type="timeouts_cleartimeout" id="U1o9MgEgQ~^.yad]/6Ix"> <field name="NAME">anwensenheitan2</field> <next> <block type="timeouts_cleartimeout" id="xi~^2fTnb.|r|`m?trTf"> <field name="NAME">anwensenheitaus2</field> <next> <block type="timeouts_clearinterval" id="OK:2_teeG(:nSDxJiaVt"> <field name="NAME">Intervall</field> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </xml>
-
würde eher so ran gehen an die sache.