Moin zusammen,
Vielen Dank für den Hinweis. Der war goldrichtig.
Ich hab das fertige Blockly hier einmal angehängt. So kann man das eventuell auch als Vorlage für sich selbst nutzen. Ist nochmal etwas generalüberholt worden und funktioniert nun einwandfrei.
Was macht das Script nun konkret:
Bei Bewegung unter der Voraussetzung das es bereits nach Sonnenuntergang ist geht das licht an.
Solange Bewegung erkannt wird, bleibt das licht an.
Nach 45 Sekunden wird das Licht gedimmt. Nun weiß man das es gleich aus geht. Wird in der gedimmten Phase wieder Bewegung erkannt geht das licht wieder an. Sollte man zwischenzeitlich das Licht selbst ausgeschaltet haben bleibt es auch aus.
Code
<xml xmlns="http://www.w3.org/1999/xhtml">
<variables>
<variable type="undefined" id="timeoutFL">timeoutFL</variable>
<variable type="undefined" id="timeoutFL1">timeoutFL1</variable>
</variables>
<block type="on" id="c{#aUqKT6-DZ+Q@5*a8)" x="-87" y="38">
<field name="OID">hue.0.Flur_Lampe_Sensor.presence</field>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<statement name="STATEMENT">
<block type="controls_if" id="y(oh=Hkiy]MxlVM#$+v7">
<mutation elseif="1"></mutation>
<value name="IF0">
<block type="logic_operation" id="EL:oRgSpOF}m#||tCmhf">
<field name="OP">AND</field>
<value name="A">
<block type="logic_compare" id="T%ma39cLS!ltmX+|%JW{">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="jLfE_l|-5ibGG]_mJpLI">
<field name="ATTR">val</field>
<field name="OID">hue.0.Flur_Lampe_Sensor.presence</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="^KRXhf@rh%x8zJ}lXK]b">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_compare" id="gyUl5@G^g(pC]$pXlVSj">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="?aPu^d]/!0rE;bK~*W8D">
<field name="ATTR">val</field>
<field name="OID">User.0.Sonnenuntzergang</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="eMmqa3k-5EN3dD/%P5Q7">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="timeouts_cleartimeout" id="T4-miNK60{McjJ=M:lB!">
<field name="NAME">timeoutFL</field>
<next>
<block type="timeouts_cleartimeout" id="7:m7%Y~4cS)Za||j)zz=">
<field name="NAME">timeoutFL1</field>
<next>
<block type="controls_if" id="[=6R1P/yHj*+:20]MhtD">
<value name="IF0">
<block type="logic_compare" id="hMT-O%qc6O!kEkV=?2y,">
<field name="OP">LTE</field>
<value name="A">
<block type="get_value" id="mn.T]NnXxP!fgv;zU(k:">
<field name="ATTR">val</field>
<field name="OID">hue.0.Flur.level</field>
</block>
</value>
<value name="B">
<block type="math_number" id="-Uy6_pW.$!+:,@~!L1[Z">
<field name="NUM">50</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="gQui}L3/UQT6dYT@KCpz">
<mutation delay_input="false"></mutation>
<field name="OID">hue.0.Flur.level</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="#eFD,fLYP,5rWLrKj-87">
<field name="NUM">50</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
<value name="IF1">
<block type="logic_compare" id="v+yvoEC3h(odi-BoJp#J">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="0Y}e9@zHfJ!YDw7Y-a:S">
<field name="ATTR">val</field>
<field name="OID">hue.0.Flur_Lampe_Sensor.presence</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="WVP~#NbS0KT=2/JF(J^i">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO1">
<block type="timeouts_cleartimeout" id="ZE-Jil$aNOsANxd3KHF#">
<field name="NAME">timeoutFL</field>
<next>
<block type="timeouts_settimeout" id="=i-v?hHvekRkZpQ]k(PA">
<field name="NAME">timeoutFL</field>
<field name="DELAY">45</field>
<field name="UNIT">sec</field>
<statement name="STATEMENT">
<block type="controls_if" id="k8bbow/Gx?mE`5Xppm2T">
<value name="IF0">
<block type="logic_compare" id="P-d;LJk71|,ujkXq8m9n">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="(ke`$Ra*;X!nn#FAQE!/">
<field name="ATTR">val</field>
<field name="OID">hue.0.Flur_Lampe.on</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="$~t;4|,4PT-T8NGSO1vD">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="(gokN.__2HNxS!.]N5dd">
<mutation delay_input="false"></mutation>
<field name="OID">hue.0.Flur.level</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="I#8!-p|1Hcqeum2M@iZl">
<field name="NUM">10</field>
</block>
</value>
</block>
</statement>
</block>
</statement>
<next>
<block type="timeouts_cleartimeout" id="v:D]5SNX0Igaw9?HKY85">
<field name="NAME">timeoutFL1</field>
<next>
<block type="timeouts_settimeout" id="1M0!(.3z?++]$3n0~4Mh">
<field name="NAME">timeoutFL1</field>
<field name="DELAY">1</field>
<field name="UNIT">min</field>
<statement name="STATEMENT">
<block type="control" id="u3n(jk@i[f}?l`FqAf%O">
<mutation delay_input="false"></mutation>
<field name="OID">hue.0.Flur_Lampe.on</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_boolean" id="}B/3SV%NB2OgKVYI_0++">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</xml>
Alles anzeigen