- Home
- Deutsch
- Skripten / Logik
- Blockly
- Datenpunkt setzen mit "Heute" "Gestern" "Vorgestern"
Datenpunkt setzen mit "Heute" "Gestern" "Vorgestern"
-
@peks-67 was steht denn in dem Datenpunkt genau drin(im Objektbaum mal auf den Wert klicken!)?
@dslraser das gibt Probleme am Monatsende
-
-
@dslraser ich würde es so lösen, es sollte fast egal sein was im DP steht
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Y//i[tB(O8vZ(Bs:6juX">letzteBewaesserung</variable> </variables> <block type="procedures_defcustomreturn" id="]]6exc}p_46Ii}b0FwQ+" x="63" y="12"> <mutation statements="false"> <arg name="letzteBewaesserung" varid="Y//i[tB(O8vZ(Bs:6juX"></arg> </mutation> <field name="NAME">DatumDiff</field> <field name="SCRIPT">aWYodHlwZW9mIGxldHp0ZUJld2Flc3NlcnVuZyA9PT0gJ3N0cmluZycpIGxldHp0ZUJld2Flc3NlcnVuZyA9IGxldHp0ZUJld2Flc3NlcnVuZy5yZXBsYWNlKC8oXGQrKVwuKFxkKylcLihcZCspKFxzLikvLCIkMy0kMi0kMSQ0Iik7DQpsZXQgZGF0MiA9IG5ldyBEYXRlKGxldHp0ZUJld2Flc3NlcnVuZyk7DQpkYXQyLnNldEhvdXJzKDAsMCwwLDApOw0KY29uc3QgaGV1dGUgPSBuZXcgRGF0ZSgpLnNldEhvdXJzKDAsMCwwLDApOw0KY29uc3QgYXJyID0gWydIZXV0ZScsJ0dlc3Rlcm4nLCdWb3JnZXN0ZXJuJ107DQpjb25zdCBkVGltZSA9IGhldXRlIC0gZGF0MjsNCmNvbnN0IGREYXlzID0gZFRpbWUgLyAoMTAwMCAqIDYwICogNjAgKiAyNCk7IA0KcmV0dXJuIGREYXlzIDwgMyA/IGFycltkRGF5c10gOiBmb3JtYXREYXRlKG5ldyBEYXRlKGxldHp0ZUJld2Flc3NlcnVuZyksJ0RELk1NLllZWVkgaGg6bW0nKSArICcgVWhyJzs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="debug" id="sd%ifTnaNIk2a|)a1C^D" x="62" y="38"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="Y*NT}Ox[-4]{5Cvg|eQb"> <field name="TEXT">test</field> </shadow> <block type="procedures_callcustomreturn" id="u]0dAoN)haF[@wC#paX*" inline="true"> <mutation name="DatumDiff"> <arg name="letzteBewaesserung"></arg> </mutation> <value name="ARG0"> <block type="get_value" id="B6C@v_(?ztL/EFE.|9M["> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Test</field> </block> </value> </block> </value> </block> </xml>
-
Ich habe es jetzt so...
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</variable> <variable id="TN*b2s_.y_`^DJT6$cA3">Gestern</variable> <variable id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</variable> </variables> <block type="procedures_defcustomreturn" id="=_Xx7~PddFV+`HS|w}Ld" x="13" y="13"> <mutation statements="false"></mutation> <field name="NAME">datum_gestern</field> <field name="SCRIPT">dmFyIHllc3RlcmRheSA9IChmdW5jdGlvbihkKXsgZC5zZXREYXRlKGQuZ2V0RGF0ZSgpLTEpOyByZXR1cm4gZH0pKG5ldyBEYXRlKQpyZXR1cm4geWVzdGVyZGF5IDs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="!Vf+c%_m)^5NUX6GBnue" x="13" y="63"> <mutation statements="false"></mutation> <field name="NAME">datum_vorgestern</field> <field name="SCRIPT">dmFyIHRoZWRheWJlZm9yeWVzdGVyZGF5ID0gKGZ1bmN0aW9uKGQpeyBkLnNldERhdGUoZC5nZXREYXRlKCktMik7IHJldHVybiBkfSkobmV3IERhdGUpCnJldHVybiB0aGVkYXliZWZvcnllc3RlcmRheTs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="on_ext" id="PC{Q}G6V9t1ay|%ZQ6q:" x="13" y="113"> <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="T/YG1KxJ@TY1WzPIi|Yk"> <field name="oid">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="UIkcSE,9bu6,OtT-8D:D"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> <value name="VALUE"> <block type="on_source" id="Q}W|q^5#]C+#CafA+);H"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="variables_set" id="RymLVmrI_a|%C-),fVB-"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> <value name="VALUE"> <block type="convert_from_date" id="**9!|uKs(gBaLtF;IlBo"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="-=Y1*T].C]}%!~bGt)Rs"> <mutation name="datum_gestern"></mutation> </block> </value> </block> </value> <next> <block type="variables_set" id="?h2F*bUz_9QmbM?29wC)"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> <value name="VALUE"> <block type="convert_from_date" id="{$vz@8,cW^$yrRgq~jw!"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="~_20WVn-5)%Q88x_!zKi"> <mutation name="datum_vorgestern"></mutation> </block> </value> </block> </value> <next> <block type="controls_if" id="=a:o^eb_Ice3nnyJ{7o3"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="ALQMq4Ht3Y3`5e;B(oA+"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="q4`E+VCJB@1B+t9hL|BF"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="time_get" id="0*bmmc|b7VrGa%e{C($d"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="jWgkwCIX^:_q_4,hZNeW"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="-M;!i9$vWQ*.G18AUP:Y"> <field name="TEXT">Heute</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id=")R|MNW^j|X+4w4*1UTQx"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="^ywj6fUE{1i12FzBwBD@"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="-?#q|^5M;9Kp+glPOiM3"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id=":bDCMK{5z~rTH?3y:w$w"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="$U~M|_quSrJaxubl((r."> <field name="TEXT">Gestern</field> </block> </value> </block> </statement> <value name="IF2"> <block type="logic_compare" id="yF~13~g[*p{Wf?WE}p/?"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="$k0erYX*.V6jS49*M_5o"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="OFahT5(Jd7v]=,2:o~f^"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> </block> </value> </block> </value> <statement name="DO2"> <block type="update" id="|~iHb[aYUq)LC}*aFQ{B"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="nw[M3T}TLrE),V:Rj0*,"> <field name="TEXT">Vorgestern</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="update" id="Cs*/-=)--;+xa?8gvP-F"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="on_source" id="OWz~)t$v$cF_fVD~[d:/"> <field name="ATTR">state.val</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@dslraser einen haste noch. Deine Funktionen liefern auch die Uhrzeit, weshalb sie wohl fast nie der letzten Bewässerung entsprechen werden
-
@fastfoot sagte in Datenpunkt setzen mit "Heute" "Gestern" "Vorgestern":
@dslraser einen haste noch. Deine Funktionen liefern auch die Uhrzeit, weshalb sie wohl fast nie der letzten Bewässerung entsprechen werden
? welche Uhrzeit meinst Du ?
-
@dslraser upps, mea culpa, mea maxima culpa, habe die Funktion mit der Variablen verwechselt.
-
@fastfoot sagte in Datenpunkt setzen mit "Heute" "Gestern" "Vorgestern":
@dslraser upps, mea culpa, mea maxima culpa, habe die Funktion mit der Variablen verwechselt.
Und ich habe sie nun umbenannt und das Bild ausgetauscht
-
@peks-67
Man kann als Datenpunkt eine Werteliste verwenden:{ "_id": "0_userdata.0.Bewaesserung.Tag", "type": "state", "common": { "name": "Tag letzte Bewässerung", "role": "", "type": "number", "read": true, "write": true, "desc": "Manuell erzeugt", "min": 0, "max": 3, "def": 0, "states": { "0": "heute", "1": "gestern", "2": "vorgestern", "3": "länger her" } }, "native": {}, "from": "system.adapter.admin.0", "user": "system.user.admin", "ts": 1626938044757, "acl": { "object": 1636, "state": 1636, "owner": "system.user.admin", "ownerGroup": "system.group.administrator" } }
und die Tagesdifferenz berechnen:
-
Danke für die vielen Vorschläge! Ich werde mich später oder morgen mal dran setzen und versuchen ob ich es so zum laufen bekomme.
-
@dslraser said in Datenpunkt setzen mit "Heute" "Gestern" "Vorgestern":
Ich habe es jetzt so...
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</variable> <variable id="TN*b2s_.y_`^DJT6$cA3">Gestern</variable> <variable id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</variable> </variables> <block type="procedures_defcustomreturn" id="=_Xx7~PddFV+`HS|w}Ld" x="13" y="13"> <mutation statements="false"></mutation> <field name="NAME">datum_gestern</field> <field name="SCRIPT">dmFyIHllc3RlcmRheSA9IChmdW5jdGlvbihkKXsgZC5zZXREYXRlKGQuZ2V0RGF0ZSgpLTEpOyByZXR1cm4gZH0pKG5ldyBEYXRlKQpyZXR1cm4geWVzdGVyZGF5IDs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="!Vf+c%_m)^5NUX6GBnue" x="13" y="63"> <mutation statements="false"></mutation> <field name="NAME">datum_vorgestern</field> <field name="SCRIPT">dmFyIHRoZWRheWJlZm9yeWVzdGVyZGF5ID0gKGZ1bmN0aW9uKGQpeyBkLnNldERhdGUoZC5nZXREYXRlKCktMik7IHJldHVybiBkfSkobmV3IERhdGUpCnJldHVybiB0aGVkYXliZWZvcnllc3RlcmRheTs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="on_ext" id="PC{Q}G6V9t1ay|%ZQ6q:" x="13" y="113"> <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="T/YG1KxJ@TY1WzPIi|Yk"> <field name="oid">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="UIkcSE,9bu6,OtT-8D:D"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> <value name="VALUE"> <block type="on_source" id="Q}W|q^5#]C+#CafA+);H"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="variables_set" id="RymLVmrI_a|%C-),fVB-"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> <value name="VALUE"> <block type="convert_from_date" id="**9!|uKs(gBaLtF;IlBo"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="-=Y1*T].C]}%!~bGt)Rs"> <mutation name="datum_gestern"></mutation> </block> </value> </block> </value> <next> <block type="variables_set" id="?h2F*bUz_9QmbM?29wC)"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> <value name="VALUE"> <block type="convert_from_date" id="{$vz@8,cW^$yrRgq~jw!"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="~_20WVn-5)%Q88x_!zKi"> <mutation name="datum_vorgestern"></mutation> </block> </value> </block> </value> <next> <block type="controls_if" id="=a:o^eb_Ice3nnyJ{7o3"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="ALQMq4Ht3Y3`5e;B(oA+"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="q4`E+VCJB@1B+t9hL|BF"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="time_get" id="0*bmmc|b7VrGa%e{C($d"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="jWgkwCIX^:_q_4,hZNeW"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="-M;!i9$vWQ*.G18AUP:Y"> <field name="TEXT">Heute</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id=")R|MNW^j|X+4w4*1UTQx"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="^ywj6fUE{1i12FzBwBD@"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="-?#q|^5M;9Kp+glPOiM3"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id=":bDCMK{5z~rTH?3y:w$w"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="$U~M|_quSrJaxubl((r."> <field name="TEXT">Gestern</field> </block> </value> </block> </statement> <value name="IF2"> <block type="logic_compare" id="yF~13~g[*p{Wf?WE}p/?"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="$k0erYX*.V6jS49*M_5o"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="OFahT5(Jd7v]=,2:o~f^"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> </block> </value> </block> </value> <statement name="DO2"> <block type="update" id="|~iHb[aYUq)LC}*aFQ{B"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="nw[M3T}TLrE),V:Rj0*,"> <field name="TEXT">Vorgestern</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="update" id="Cs*/-=)--;+xa?8gvP-F"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.heute_gestern_vorgestern</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="on_source" id="OWz~)t$v$cF_fVD~[d:/"> <field name="ATTR">state.val</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
Funktioniert im Testlauf schonmal astrein! Vielen Dank!
Was mir nur durch den Kopf geht ist der Trigger. Wenn heute gemäht wurde und ich schaue morgen vor dem Mähvorgang in die App steht da doch immernoch "Heute" oder?
Meine Idee wäre jetzt jeden Tag um 0:00 Uhr einen Trigger mit dem selben Script laufen zu lassen.
Oder gäbe es hier eine sehr viel kleinere Möglichkeit? -
@peks-67 sagte in Datenpunkt setzen mit "Heute" "Gestern" "Vorgestern":
Was mir nur durch den Kopf geht ist der Trigger. Wenn heute gemäht wurde und ich schaue morgen vor dem Mähvorgang in die App steht da doch immernoch "Heute" oder?
Meine Idee wäre jetzt jeden Tag um 0:00 Uhr einen Trigger mit dem selben Script laufen zu lassen.Da hast Du natürlich recht. Ich nehme allerdings einen Cron dafür, weil Zeitpläne oft nicht richtig funktionieren (warum auch immer ? ) Ich habe es gerade probiert (mit einem Cron um 17:05 Uhr) da hat es funktioniert wie gewünscht. Ob es genau um 00:00 Uhr funktioniert weiß ich nicht, sonst vielleicht 00:01 Uhr nehmen....Ich probiere es heute Nacht auch mal mit 00:00 Uhr.
Oder gäbe es hier eine sehr viel kleinere Möglichkeit?
Ich weiß keine...
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</variable> <variable type="cron" id="schedule1">schedule1</variable> <variable id="TN*b2s_.y_`^DJT6$cA3">Gestern</variable> <variable id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</variable> </variables> <block type="procedures_defcustomreturn" id="=_Xx7~PddFV+`HS|w}Ld" x="13" y="13"> <mutation statements="false"></mutation> <field name="NAME">datum_gestern</field> <field name="SCRIPT">dmFyIHllc3RlcmRheSA9IChmdW5jdGlvbihkKXsgZC5zZXREYXRlKGQuZ2V0RGF0ZSgpLTEpOyByZXR1cm4gZH0pKG5ldyBEYXRlKQpyZXR1cm4geWVzdGVyZGF5IDs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="!Vf+c%_m)^5NUX6GBnue" x="13" y="63"> <mutation statements="false"></mutation> <field name="NAME">datum_vorgestern</field> <field name="SCRIPT">dmFyIHRoZWRheWJlZm9yeWVzdGVyZGF5ID0gKGZ1bmN0aW9uKGQpeyBkLnNldERhdGUoZC5nZXREYXRlKCktMik7IHJldHVybiBkfSkobmV3IERhdGUpCnJldHVybiB0aGVkYXliZWZvcnllc3RlcmRheTs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="on_ext" id="PC{Q}G6V9t1ay|%ZQ6q:" x="13" y="113"> <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="T/YG1KxJ@TY1WzPIi|Yk"> <field name="oid">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="UIkcSE,9bu6,OtT-8D:D"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> <value name="VALUE"> <block type="on_source" id="Q}W|q^5#]C+#CafA+);H"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="variables_set" id="RymLVmrI_a|%C-),fVB-"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> <value name="VALUE"> <block type="convert_from_date" id="**9!|uKs(gBaLtF;IlBo"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="-=Y1*T].C]}%!~bGt)Rs"> <mutation name="datum_gestern"></mutation> </block> </value> </block> </value> <next> <block type="variables_set" id="?h2F*bUz_9QmbM?29wC)"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> <value name="VALUE"> <block type="convert_from_date" id="{$vz@8,cW^$yrRgq~jw!"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="~_20WVn-5)%Q88x_!zKi"> <mutation name="datum_vorgestern"></mutation> </block> </value> </block> </value> <next> <block type="controls_if" id="=a:o^eb_Ice3nnyJ{7o3"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="ALQMq4Ht3Y3`5e;B(oA+"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="q4`E+VCJB@1B+t9hL|BF"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="time_get" id="0*bmmc|b7VrGa%e{C($d"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="jWgkwCIX^:_q_4,hZNeW"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="-M;!i9$vWQ*.G18AUP:Y"> <field name="TEXT">Heute</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id=")R|MNW^j|X+4w4*1UTQx"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="^ywj6fUE{1i12FzBwBD@"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="-?#q|^5M;9Kp+glPOiM3"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id=":bDCMK{5z~rTH?3y:w$w"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="$U~M|_quSrJaxubl((r."> <field name="TEXT">Gestern</field> </block> </value> </block> </statement> <value name="IF2"> <block type="logic_compare" id="yF~13~g[*p{Wf?WE}p/?"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="$k0erYX*.V6jS49*M_5o"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="OFahT5(Jd7v]=,2:o~f^"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> </block> </value> </block> </value> <statement name="DO2"> <block type="update" id="|~iHb[aYUq)LC}*aFQ{B"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="nw[M3T}TLrE),V:Rj0*,"> <field name="TEXT">Vorgestern</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="update" id="Cs*/-=)--;+xa?8gvP-F"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="on_source" id="OWz~)t$v$cF_fVD~[d:/"> <field name="ATTR">state.val</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="schedule_create" id="Ts/}Sgr+5Q}e53fCH]pH"> <field name="NAME">schedule1</field> <value name="SCHEDULE"> <shadow type="field_cron" id="(e?VUV5O$=;M(qzb{o!3"> <field name="CRON">0 0 * * *</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="abrv/M@%W(b+Rhw,wn:d"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> <value name="VALUE"> <block type="get_value" id="JRxo)x|aWP|Bfi3-^9@2"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </block> </value> <next> <block type="variables_set" id="W@o(K#T(=Fz#kJs@)d]x"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> <value name="VALUE"> <block type="convert_from_date" id="Le0;N,+cY|zn]x_:SVMY"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="+aAo(A?8Fec@1|!ZqKrF"> <mutation name="datum_gestern"></mutation> </block> </value> </block> </value> <next> <block type="variables_set" id="e%plMH`1zjs||?VJCSI]"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> <value name="VALUE"> <block type="convert_from_date" id="ij*6M]A0lxP~ol9:WaoL"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="J3u*AcmOr3DP^r?gTr}z"> <mutation name="datum_vorgestern"></mutation> </block> </value> </block> </value> <next> <block type="controls_if" id="f4k4F1oDz$BY-79X;zC,"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="Q?A?{3TNMt%Csym`$@,P"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="89v1,Nq{h}9+p#}(?u3^"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="time_get" id="W|t)3lGMjn-m9TpJ_h~1"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="K_Y8z]6,uOH,I.){~dD/"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="f_^+TMRI=u~uh|aW4OqO"> <field name="TEXT">Heute</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="%GVDT+;4GdLWK3J*]?Ja"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="+lRXB@O:Rsw8:nvsCTYe"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="i;)YWu`uxj3e@5Titag["> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id="^PSTwN4}k-c:@Zq.sOSB"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="@xf%UW]nG(IW?Jdx-/Lf"> <field name="TEXT">Gestern</field> </block> </value> </block> </statement> <value name="IF2"> <block type="logic_compare" id="%jLWIlm:7.he01N;QIKR"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="H}y.*:7;%}wI,5fgNS77"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="Ud}b$w_2r)g5BEvPDUzg"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> </block> </value> </block> </value> <statement name="DO2"> <block type="update" id="JoPvu#lNpRpzV`^:lk:z"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="2{IEjnE3{o:tV:S$)6k-"> <field name="TEXT">Vorgestern</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="update" id="/CaOI)#RKk=}KY$BSPFN"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_value" id="TVO@D,jX)[?H;+$COiU`"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </xml>
Variante ala @paul53 mit gemeinsamer Funktion
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</variable> <variable id="TN*b2s_.y_`^DJT6$cA3">Gestern</variable> <variable id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</variable> </variables> <block type="procedures_defcustomreturn" id="=_Xx7~PddFV+`HS|w}Ld" x="13" y="13"> <mutation statements="false"></mutation> <field name="NAME">datum_gestern</field> <field name="SCRIPT">dmFyIHllc3RlcmRheSA9IChmdW5jdGlvbihkKXsgZC5zZXREYXRlKGQuZ2V0RGF0ZSgpLTEpOyByZXR1cm4gZH0pKG5ldyBEYXRlKQpyZXR1cm4geWVzdGVyZGF5IDs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="!Vf+c%_m)^5NUX6GBnue" x="13" y="63"> <mutation statements="false"></mutation> <field name="NAME">datum_vorgestern</field> <field name="SCRIPT">dmFyIHRoZWRheWJlZm9yeWVzdGVyZGF5ID0gKGZ1bmN0aW9uKGQpeyBkLnNldERhdGUoZC5nZXREYXRlKCktMik7IHJldHVybiBkfSkobmV3IERhdGUpCnJldHVybiB0aGVkYXliZWZvcnllc3RlcmRheTs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="on_ext" id="PC{Q}G6V9t1ay|%ZQ6q:" x="13" y="113"> <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="T/YG1KxJ@TY1WzPIi|Yk"> <field name="oid">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </shadow> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="`K4}[lJOEB7Ha%#8s%nT"> <mutation name="Bewaesserung_Tag"></mutation> </block> </statement> <next> <block type="schedule" id="w8Q*X39N|^xlJz[xJ.NG"> <field name="SCHEDULE">0 0 * * *</field> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="=Q.Z9g1Tu+N0zMGX,{Ek"> <mutation name="Bewaesserung_Tag"></mutation> </block> </statement> </block> </next> </block> <block type="procedures_defnoreturn" id="n0Y.,:A:u!dU#APKEp`Z" x="213" y="163"> <field name="NAME">Bewaesserung_Tag</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="variables_set" id="abrv/M@%W(b+Rhw,wn:d"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> <value name="VALUE"> <block type="get_value" id="JRxo)x|aWP|Bfi3-^9@2"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </block> </value> <next> <block type="variables_set" id="W@o(K#T(=Fz#kJs@)d]x"> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> <value name="VALUE"> <block type="convert_from_date" id="Le0;N,+cY|zn]x_:SVMY"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="+aAo(A?8Fec@1|!ZqKrF"> <mutation name="datum_gestern"></mutation> </block> </value> </block> </value> <next> <block type="variables_set" id="e%plMH`1zjs||?VJCSI]"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> <value name="VALUE"> <block type="convert_from_date" id="ij*6M]A0lxP~ol9:WaoL"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="J3u*AcmOr3DP^r?gTr}z"> <mutation name="datum_vorgestern"></mutation> </block> </value> </block> </value> <next> <block type="controls_if" id="f4k4F1oDz$BY-79X;zC,"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="Q?A?{3TNMt%Csym`$@,P"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="89v1,Nq{h}9+p#}(?u3^"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="time_get" id="W|t)3lGMjn-m9TpJ_h~1"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">DD.MM.YYYY</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="K_Y8z]6,uOH,I.){~dD/"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="f_^+TMRI=u~uh|aW4OqO"> <field name="TEXT">Heute</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="%GVDT+;4GdLWK3J*]?Ja"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="+lRXB@O:Rsw8:nvsCTYe"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="i;)YWu`uxj3e@5Titag["> <field name="VAR" id="TN*b2s_.y_`^DJT6$cA3">Gestern</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id="^PSTwN4}k-c:@Zq.sOSB"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="@xf%UW]nG(IW?Jdx-/Lf"> <field name="TEXT">Gestern</field> </block> </value> </block> </statement> <value name="IF2"> <block type="logic_compare" id="%jLWIlm:7.he01N;QIKR"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="H}y.*:7;%}wI,5fgNS77"> <field name="VAR" id="GfWhg11(gE@cDL}rT~qj">letzte_Bewaesserung</field> </block> </value> <value name="B"> <block type="variables_get" id="Ud}b$w_2r)g5BEvPDUzg"> <field name="VAR" id="~!)I|B*)E+YCj^%Tm]k)">Vorgestern</field> </block> </value> </block> </value> <statement name="DO2"> <block type="update" id="JoPvu#lNpRpzV`^:lk:z"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text" id="2{IEjnE3{o:tV:S$)6k-"> <field name="TEXT">Vorgestern</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="update" id="/CaOI)#RKk=}KY$BSPFN"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.letzte_Bewaesserung_Tag</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_value" id="TVO@D,jX)[?H;+$COiU`"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Test.Datum_letzte_Bewaesserung</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@peks-67 sagte: kleinere Möglichkeit?
Übersichtlicher ist die Verwendung einer gemeinsamen Funktion. Beispiel: