- Home
- Deutsch
- Skripten / Logik
- Blockly
- [Vorlage] Gartenbewässerung mit 4 Ventilen
[Vorlage] Gartenbewässerung mit 4 Ventilen
-
@Kuddel sagte in [Vorlage] Gartenbewässerung mit 4 Ventilen:
Ventil 4 startet leider nicht.
Schau mal ob du hiermit was erkennen kannst. Damit kannst die DPs subscripen und die einzelnen Werte vom DP beobachten. Hab ich heut Morgen für meine Tests mit der Automatik zusammengeklickt.
<xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="pIay;;)7~Cs@HxnMh[%B">objectID_1</variable> <variable type="" id="r?C3GwKf]$).t1P,PO`h">oid</variable> <variable type="" id="7tcJOjj[bGR_[Q5koxNA">objectID_2</variable> <variable type="" id="z24$A}L)IdGOWDHl|s@Y">objectID_val</variable> <variable type="" id="??/Z|X!WTK3pdtkMxRtN">objectID_3</variable> <variable type="" id="I9FS^5?Fc.mWsisn=z,n">objectID_5</variable> <variable type="" id="W;6~2.QFR;kxwI:Jni/2">objectID_ack</variable> <variable type="" id="Eatwppv0f11iBwd,uVGn">objectID_4</variable> <variable type="" id="(yhXEH$,_L37m,=PdKU[">objectID_6</variable> <variable type="" id="o`K]4Fft5bYb99@(#$r.">objectID_ts</variable> <variable type="" id="88~;^mCbyiOD.?s^jKi-">objectID_lc</variable> <variable type="" id="I}GFHXKg4T#[:)#Xgox6">objectID_quality</variable> <variable type="" id="7Mwo)h)O(Xj88r34@|%N">objectID_from</variable> <variable type="" id="!GFq`Fg/M-XdtwRhqyM`">debuggedObjectID</variable> </variables> <block type="variables_set" id="?3(0UaCYoI+a2N6vfX|[" x="13" y="188"> <field name="VAR" id="pIay;;)7~Cs@HxnMh[%B" variabletype="">objectID_1</field> <value name="VALUE"> <block type="text" id="`ICn.%BFnBX2,;.mQ9}h"> <field name="TEXT">hm-rpc.1.OEQ0044740.1.ON_TIME</field> </block> </value> <next> <block type="variables_set" id="X+X/_[Jn:x?IDt6K[]l^"> <field name="VAR" id="7tcJOjj[bGR_[Q5koxNA" variabletype="">objectID_2</field> <value name="VALUE"> <block type="text" id="x=e0s2^AU=4=Erv!APzI"> <field name="TEXT">hm-rpc.1.OEQ0044740.1.STATE</field> </block> </value> <next> <block type="variables_set" id="K^~_{9^gYF}E/}wIF{?s"> <field name="VAR" id="??/Z|X!WTK3pdtkMxRtN" variabletype="">objectID_3</field> <value name="VALUE"> <block type="text" id=";K=Ez_IVwAmY=;CWq%5("> <field name="TEXT">hm-rpc.1.OEQ0044740.2.ON_TIME</field> </block> </value> <next> <block type="variables_set" id="/Cl1:a9(-z7X8xJ|}yd)"> <field name="VAR" id="Eatwppv0f11iBwd,uVGn" variabletype="">objectID_4</field> <value name="VALUE"> <block type="text" id="ISS=8o=f/rT_8u!xCWU7"> <field name="TEXT">hm-rpc.1.OEQ0044740.2.STATE</field> </block> </value> <next> <block type="variables_set" id=":8~?Xm]-D6sMhCeXSCsX"> <field name="VAR" id="I9FS^5?Fc.mWsisn=z,n" variabletype="">objectID_5</field> <value name="VALUE"> <block type="text" id="k#RBk@5U;mvQUp6@SF40"> <field name="TEXT">hm-rpc.1.OEQ0044740.3.ON_TIME</field> </block> </value> <next> <block type="variables_set" id=",zY+4+t_#N-Y;LIWPh9-"> <field name="VAR" id="(yhXEH$,_L37m,=PdKU[" variabletype="">objectID_6</field> <value name="VALUE"> <block type="text" id="S,*wssU7lL=kQ`gAyT`l"> <field name="TEXT">hm-rpc.1.OEQ0044740.3.STATE</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> <block type="procedures_defnoreturn" id="PHk=-:*kr_}}aE@tBwkM" x="613" y="187"> <mutation> <arg name="oid" varid="r?C3GwKf]$).t1P,PO`h"></arg> </mutation> <field name="NAME">debugObject</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="variables_set" id="8}RZidatnAws$00{%,8L"> <field name="VAR" id="z24$A}L)IdGOWDHl|s@Y" variabletype="">objectID_val</field> <value name="VALUE"> <block type="get_value_var" id="}K`+UqB0Hh!;p/p8=vyX"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="0C#A,};yov4)hJ%3b*a;"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="fD=T2Y-+Qyb=qzX`?!z/"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> <next> <block type="variables_set" id="}^EEnhSJ]Es@PCj2XsqB"> <field name="VAR" id="W;6~2.QFR;kxwI:Jni/2" variabletype="">objectID_ack</field> <value name="VALUE"> <block type="get_value_var" id="58oyy/#{nW)*RcGPG1j]"> <field name="ATTR">ack</field> <value name="OID"> <shadow type="text" id="0C#A,};yov4)hJ%3b*a;"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="kFZbnNajUd#[dTVm}%|k"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> <next> <block type="variables_set" id="X(U)ReIJ][Z4SGncZBB?"> <field name="VAR" id="o`K]4Fft5bYb99@(#$r." variabletype="">objectID_ts</field> <value name="VALUE"> <block type="convert_from_date" id="}pbfxJ%WGK3tfs(UBVt}"> <mutation format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="get_value_var" id="oEbG{om_5V_LuYrt+m#y"> <field name="ATTR">ts</field> <value name="OID"> <shadow type="text" id="0C#A,};yov4)hJ%3b*a;"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="=jo6Y{:f7+rk!%yB.3g2"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="]g,_pT+;;E$|Vkj|l83U"> <field name="VAR" id="88~;^mCbyiOD.?s^jKi-" variabletype="">objectID_lc</field> <value name="VALUE"> <block type="convert_from_date" id="PgOu(x#nu}3ao^{sN@rH"> <mutation format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="get_value_var" id="RiTlkJGnVWB=r_1e%4LN"> <field name="ATTR">lc</field> <value name="OID"> <shadow type="text" id=",C0Uu^N]anjX=]D=Qiq|"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="[IS:]J!Sg)M7A6G*:;~:"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Gfkry3O/w^,Z}Sh_nmso"> <field name="VAR" id="I}GFHXKg4T#[:)#Xgox6" variabletype="">objectID_quality</field> <value name="VALUE"> <block type="get_value_var" id="3Iz#aZ/oUZF5B%YYk*?z"> <field name="ATTR">q</field> <value name="OID"> <shadow type="text" id="0C#A,};yov4)hJ%3b*a;"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="^K{jA!67=JGG|})jR*np"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> <next> <block type="variables_set" id="E=(yL]k$NFy$|]F5*@:;"> <field name="VAR" id="7Mwo)h)O(Xj88r34@|%N" variabletype="">objectID_from</field> <value name="VALUE"> <block type="get_value_var" id="y,z~a]oh[@Fb/U(^183n"> <field name="ATTR">from</field> <value name="OID"> <shadow type="text" id="quF~P*ktXV:f=K=#a}g1"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="7OhGdI95j,Sq1n,qP!nI"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> <next> <block type="variables_set" id="1(0{pOnQ3R:;5VY!*hpF"> <field name="VAR" id="!GFq`Fg/M-XdtwRhqyM`" variabletype="">debuggedObjectID</field> <value name="VALUE"> <block type="text_join" id="%=b+5aYtPHq6q!wM`U#,"> <mutation items="13"></mutation> <value name="ADD0"> <block type="text_join" id="#ThSty_d0r_avD.X{6wz"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="HHe+iY!|`Fj16W:iz]{k"> <field name="TEXT">oid: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="0G!LO?HK?RnCf-*R/S@9"> <field name="VAR" id="r?C3GwKf]$).t1P,PO`h" variabletype="">oid</field> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="gUP?IQoyvO4[owxBAF,Z"> <field name="TEXT"> | </field> </block> </value> <value name="ADD2"> <block type="text_join" id="f9D.;U=)O,AnUT}3f.P/"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="[rfpH()|Zcz*_*X;@_Lh"> <field name="TEXT">val: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="vpj]@tlSC@p`0k-O]6qx"> <field name="VAR" id="z24$A}L)IdGOWDHl|s@Y" variabletype="">objectID_val</field> </block> </value> </block> </value> <value name="ADD3"> <block type="text" id="oai#6hBZgSBtJ#|Kbipi"> <field name="TEXT"> | </field> </block> </value> <value name="ADD4"> <block type="text_join" id="f~(`Yzv-/^qXwVP@3oH."> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="!1oRXcRU(gLluh%BQpzg"> <field name="TEXT">ack: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="s3-9D.rHXGwYlMS,Avhe"> <field name="VAR" id="W;6~2.QFR;kxwI:Jni/2" variabletype="">objectID_ack</field> </block> </value> </block> </value> <value name="ADD5"> <block type="text" id=".)I]jK7ine.)@Z40Lbbh"> <field name="TEXT"> | </field> </block> </value> <value name="ADD6"> <block type="text_join" id=")r%D|?O,vHlK2hAv=?RT"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="5i}@6h$Wi#!_x3l@yEf_"> <field name="TEXT">ts: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="H.ikYY_h_0ekLH%[J0?X"> <field name="VAR" id="o`K]4Fft5bYb99@(#$r." variabletype="">objectID_ts</field> </block> </value> </block> </value> <value name="ADD7"> <block type="text" id="?uV!?yMZk4^*]wW,tDMt"> <field name="TEXT"> | </field> </block> </value> <value name="ADD8"> <block type="text_join" id="$*h-bG-Px0{:xMMzS%w8"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="j`jA@Uca6eLCCEbwsb@z"> <field name="TEXT">lc: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="s[,CnfTQ9V{S;}VUQ,HH"> <field name="VAR" id="88~;^mCbyiOD.?s^jKi-" variabletype="">objectID_lc</field> </block> </value> </block> </value> <value name="ADD9"> <block type="text" id="`LYrSzptqEBj}MvUQXgk"> <field name="TEXT"> | </field> </block> </value> <value name="ADD10"> <block type="text_join" id="TwE*+;~PKTr3Y-NZ,W6e"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="[0=|=1QNg]wR34VE_64B"> <field name="TEXT">quality: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="KDZ!pSdC8$_5DsINApON"> <field name="VAR" id="I}GFHXKg4T#[:)#Xgox6" variabletype="">objectID_quality</field> </block> </value> </block> </value> <value name="ADD11"> <block type="text" id="C6)F}h6Tqh%RKLda~tGt"> <field name="TEXT"> | </field> </block> </value> <value name="ADD12"> <block type="text_join" id="^dR_LN^|-3yslENv=Wc1"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="TT}Y.D5`VX~ArYud0-Lt"> <field name="TEXT">from: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="m}uOiCv,S/ZYz,Tu2@:$"> <field name="VAR" id="7Mwo)h)O(Xj88r34@|%N" variabletype="">objectID_from</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="^5M-8`;hS^!@zT#w7TPp"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="P0)38%YEoA-tS1,cn!L^"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id=";kcjsB;IB~bf5%]5vi.R"> <field name="VAR" id="!GFq`Fg/M-XdtwRhqyM`" variabletype="">debuggedObjectID</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="on_ext" id="pjEBbboC7Hi@(yQ4T$dn" x="13" y="412"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="t6!4Gn$C@W0Dfo1]T0nL"> <field name="oid">default</field> </shadow> <block type="variables_get" id="[-VvV(PZi0HOK5K`#]Sj"> <field name="VAR" id="pIay;;)7~Cs@HxnMh[%B" variabletype="">objectID_1</field> </block> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="6_Wv-j?5iBqx_._@ZVTz" inline="true"> <mutation name="debugObject"> <arg name="oid"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="zmB*)H`PhWSI*[gUPj;;"> <field name="VAR" id="pIay;;)7~Cs@HxnMh[%B" variabletype="">objectID_1</field> </block> </value> </block> </statement> <next> <block type="on_ext" id="q%G6_k5LHa^XKMivMw4a"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="t6!4Gn$C@W0Dfo1]T0nL"> <field name="oid">default</field> </shadow> <block type="variables_get" id="nPb|n%*Bde~mWvKq{F}T"> <field name="VAR" id="7tcJOjj[bGR_[Q5koxNA" variabletype="">objectID_2</field> </block> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="%/EgZ]9|1p2x=oPShKUP" inline="true"> <mutation name="debugObject"> <arg name="oid"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="Y*M9;FjqZ808mdyh8th7"> <field name="VAR" id="7tcJOjj[bGR_[Q5koxNA" variabletype="">objectID_2</field> </block> </value> </block> </statement> </block> </next> </block> <block type="on_ext" id="$JXvjguh-VLZ5*wU4AkW" x="13" y="713"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="t6!4Gn$C@W0Dfo1]T0nL"> <field name="oid">default</field> </shadow> <block type="variables_get" id="}BG71024BkA2Q$rtlZS|"> <field name="VAR" id="??/Z|X!WTK3pdtkMxRtN" variabletype="">objectID_3</field> </block> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="uu%.IJ~H}0f3|8-2vc~|" inline="true"> <mutation name="debugObject"> <arg name="oid"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="!Joh2~8P;U{D0~_5qztJ"> <field name="VAR" id="??/Z|X!WTK3pdtkMxRtN" variabletype="">objectID_3</field> </block> </value> </block> </statement> <next> <block type="on_ext" id="MNOU_{2~=kw:r*=XOFyl"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="t6!4Gn$C@W0Dfo1]T0nL"> <field name="oid">default</field> </shadow> <block type="variables_get" id="}-v1nXC6nN87vraOpcfL"> <field name="VAR" id="Eatwppv0f11iBwd,uVGn" variabletype="">objectID_4</field> </block> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id=":/ZkVHkP-.Pz!THj-lA~" inline="true"> <mutation name="debugObject"> <arg name="oid"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="g3yCmxGPSO,LmR;.`2V#"> <field name="VAR" id="Eatwppv0f11iBwd,uVGn" variabletype="">objectID_4</field> </block> </value> </block> </statement> </block> </next> </block> <block type="on_ext" id="8^@Ja7Ly[Q*qjwtlxRYQ" x="13" y="1013"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="t6!4Gn$C@W0Dfo1]T0nL"> <field name="oid">default</field> </shadow> <block type="variables_get" id="2dZ|PeyZZl#+Q1H6PMyO"> <field name="VAR" id="I9FS^5?Fc.mWsisn=z,n" variabletype="">objectID_5</field> </block> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="rMG(zi(D@+a!|0cTz:P4" inline="true"> <mutation name="debugObject"> <arg name="oid"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="+E?EAwYE+hu(KH9z!~+d"> <field name="VAR" id="I9FS^5?Fc.mWsisn=z,n" variabletype="">objectID_5</field> </block> </value> </block> </statement> <next> <block type="on_ext" id="b-CfFQ02oeMw41Uv@OsA"> <mutation items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="t6!4Gn$C@W0Dfo1]T0nL"> <field name="oid">default</field> </shadow> <block type="variables_get" id="QF6i!c-U*6u2|R,h]oVF"> <field name="VAR" id="(yhXEH$,_L37m,=PdKU[" variabletype="">objectID_6</field> </block> </value> <statement name="STATEMENT"> <block type="procedures_callnoreturn" id="wtr`Rh:x1_@r[:.q-7~2" inline="true"> <mutation name="debugObject"> <arg name="oid"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="CC6u?4|+Dne*LZo8@8h4"> <field name="VAR" id="(yhXEH$,_L37m,=PdKU[" variabletype="">objectID_6</field> </block> </value> </block> </statement> </block> </next> </block> </xml>
-
Ein schneller Test zumindest in sofern erfolgreich das die Aktoren ausgelöst haben.
Im Log gabs allerdings einen kleinen Fehler - schaus mit heut Abend nochmal an.
2020-04-01 16:18:19.331 - error: hm-rpc.1 (479) Cannot call setValue: :Error: Missing element text
Edit 1:
Und hier ein kleiner Typo:
Edit 2:
Im Trigger/Cronjob für den fixen Zeitpunkt hast du noch keine Variablen:
Edit 3:
Hier auch:
-
@darkiop danke für ddie Rückmeldung.
Dein Fehler aus dem Log habe ich gefixt und aus den Scrrenshots auch.
Ich hoffe ich habe jetzt alles erwischt
-
@Kuddel Musst nochmal hochladen, der Export ist nicht vollständig
-
@darkiop ach verdammt
-
@Kuddel
ich habe mal Deine DP bearbeitet, schau mal ob es so passt.<xml xmlns="http://www.w3.org/1999/xhtml"> <block type="procedures_defcustomnoreturn" id="D:0E=~0D8*EFnn8f|sd." x="13" y="13"> <mutation statements="false"></mutation> <field name="NAME">Datenpunkte_erstellen</field> <field name="SCRIPT">LyoqCiAqIENyZWF0ZSBzdGF0ZXMgdW5kZXIgMF91c2VyZGF0YS4wIG9yIGphdm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ERUJVRykgbG9nKCdbRGVidWddIE5vdyB3ZSBhcmUgY3JlYXRpbmcgbmV3IHN0YXRlIFsnICsgbG9vcFBhcmFtWzBdICsgJ10nKTsKICAgICAgICAgICAgbGV0IGxvb3BJbml0ID0gKGxvb3BQYXJhbVsxXVsnZGVmJ10gPT0gdW5kZWZpbmVkKSA/IG51bGwgOiBsb29wUGFyYW1bMV1bJ2RlZiddOyAvLyBtaW1pYyBzYW1lIGJlaGF2aW9yIGFzIGNyZWF0ZVN0YXRlIGlmIG5vIGluaXQgdmFsdWUgaXMgcHJvdmlkZWQKICAgICAgICAgICAgY3JlYXRlU3RhdGUobG9vcFBhcmFtWzBdLCBsb29wSW5pdCwgZm9yY2UsIGxvb3BQYXJhbVsxXSwgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICBudW1TdGF0ZXMtLTsKICAgICAgICAgICAgICAgIGlmIChudW1TdGF0ZXMgPT09IDApIHsKICAgICAgICAgICAgICAgICAgICBpZiAoTE9HX0RFQlVHKSBsb2coJ1tEZWJ1Z10gQWxsIHN0YXRlcyBwcm9jZXNzZWQuJyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBjYWxsYmFjayA9PT0gJ2Z1bmN0aW9uJykgeyAvLyBleGVjdXRlIGlmIGEgZnVuY3Rpb24gd2FzIHByb3ZpZGVkIHRvIHBhcmFtZXRlciBjYWxsYmFjawogICAgICAgICAgICAgICAgICAgICAgICBpZiAoTE9HX0RFQlVHKSBsb2coJ1tEZWJ1Z10gRnVuY3Rpb24gdG8gY2FsbGJhY2sgcGFyYW1ldGVyIHdhcyBwcm92aWRlZCcpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soKTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9KTs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AgICAgICAgICAgLy8gU3RhdGUgZXhpc3RzIGFuZCBzaGFsbCBub3QgYmUgb3ZlcndyaXR0ZW4gc2luY2UgZm9yY2U9ZmFsc2UKICAgICAgICAgICAgICAgICAgICAvLyBTbywgd2UgZG8gbm90IHByb2NlZWQuCiAgICAgICAgICAgICAgICAgICAgbnVtU3RhdGVzLS07CiAgICAgICAgICAgICAgICAgICAgaWYgKG51bVN0YXRlcyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoTE9HX0RFQlVHKSBsb2coJ1tEZWJ1Z10gQWxsIHN0YXRlcyBzdWNjZXNzZnVsbHkgcHJvY2Vzc2VkIScpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNhbGxiYWNrID09PSAnZnVuY3Rpb24nKSB7IC8vIGV4ZWN1dGUgaWYgYSBmdW5jdGlvbiB3YXMgcHJvdmlkZWQgdG8gcGFyYW1ldGVyIGNhbGxiYWNrCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTE9HX0RFQlVHKSBsb2coJ1tEZWJ1Z10gQW4gb3B0aW9uYWwgY2FsbGJhY2sgZnVuY3Rpb24gd2FzIHByb3ZpZGVkLCB3aGljaCB3ZSBhcmUgZ29pbmcgdG8gZXhlY3V0ZSBub3cuJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FsbGJhY2soKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFdlIG5lZWQgdG8gZ28gb3V0IGFuZCBjb250aW51ZSB3aXRoIG5leHQgZWxlbWVudCBpbiBsb29wLgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47IC8vIGh0dHBzOi8vc3RhY2tvdmVyZmxvdy5jb20vcXVlc3Rpb25zLzE4NDUyOTIwL2NvbnRpbnVlLWluLWN1cnNvci1mb3JlYWNoCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSAvLyBpZighZm9yY2UpCiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIC8vIFN0YXRlIGlzIG5vdCBleGlzdGluZyBvciBmb3JjZSA9IHRydWUsIHNvIHdlIGFyZSBjb250aW51aW5nIHRvIGNyZWF0ZSB0aGUgc3RhdGUgdGhyb3VnaCBzZXRPYmplY3QoKS4KICAgICAgICAgICAgbGV0IG9iaiA9IHt9OwogICAgICAgICAgICBvYmoudHlwZSA9ICdzdGF0ZSc7CiAgICAgICAgICAgIG9iai5uYXRpdmUgPSB7fTsKICAgICAgICAgICAgb2JqLmNvbW1vbiA9IGxvb3BQYXJhbVsxXTsKICAgICAgICAgICAgc2V0T2JqZWN0KGxvb3BQYXJhbVswXSwgb2JqLCBmdW5jdGlvbiAoZXJyKSB7CiAgICAgICAgICAgICAgICBpZiAoZXJyKSB7CiAgICAgICAgICAgICAgICAgICAgbG9nKCdDYW5ub3Qgd3JpdGUgb2JqZWN0IGZvciBzdGF0ZSBbJyArIGxvb3BQYXJhbVswXSArICddOiAnICsgZXJyKTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKExPR19ERUJVRykgbG9nKCdbRGVidWddIE5vdyB3ZSBhcmUgY3JlYXRpbmcgbmV3IHN0YXRlIFsnICsgbG9vcFBhcmFtWzBdICsgJ10nKQogICAgICAgICAgICAgICAgICAgIGxldCBpbml0ID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICBpZihsb29wUGFyYW1bMV0uZGVmID09PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYobG9vcFBhcmFtWzFdLnR5cGUgPT09ICdudW1iZXInKSBpbml0ID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgaWYobG9vcFBhcmFtWzFdLnR5cGUgPT09ICdib29sZWFuJykgaW5pdCA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICAgICBpZihsb29wUGFyYW1bMV0udHlwZSA9PT0gJ3N0cmluZycpIGluaXQgPSAnJzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpbml0ID0gbG9vcFBhcmFtWzFdLmRlZjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgc2V0U3RhdGUobG9vcFBhcmFtWzBdLCBpbml0LCB0cnVlLCBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMT0dfREVCVUcpIGxvZygnW0RlYnVnXSBzZXRTdGF0ZSBkdXJjaGdlZsO8aHJ0OiAnICsgbG9vcFBhcmFtWzBdKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bVN0YXRlcy0tOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG51bVN0YXRlcyA9PT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMT0dfREVCVUcpIGxvZygnW0RlYnVnXSBBbGwgc3RhdGVzIHByb2Nlc3NlZC4nKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGNhbGxiYWNrID09PSAnZnVuY3Rpb24nKSB7IC8vIGV4ZWN1dGUgaWYgYSBmdW5jdGlvbiB3YXMgcHJvdmlkZWQgdG8gcGFyYW1ldGVyIGNhbGxiYWNrCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChMT0dfREVCVUcpIGxvZygnW0RlYnVnXSBGdW5jdGlvbiB0byBjYWxsYmFjayBwYXJhbWV0ZXIgd2FzIHByb3ZpZGVkJyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjYWxsYmFjaygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICA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LAoJLy9GZXN0ZSBTdGFydHplaXQKCVtwZmFkKyd6ZWl0cGxhbi5mZXN0ZV9zdGFydHplaXRfYWt0aXYnLCB7J25hbWUnOidmZXN0ZV9zdGFydHplaXRfYWt0aXYnLCd0eXBlJzonYm9vbGVhbicsJ3JlYWQnOnRydWUsJ3dyaXRlJzp0cnVlLCdyb2xlJzonc3dpdGNoJywnZGVmJzpmYWxzZX1dLAoJW3BmYWQrJ3plaXRwbGFuLmZlc3RlX3N0YXJ0emVpdF91aHJ6ZWl0X3N0YXJ0JywgeyduYW1lJzonZmVzdGVfc3RhcnR6ZWl0X3VocnplaXRfc3RhcnQnLCd0eXBlJzonc3RyaW5nJywncmVhZCc6dHJ1ZSwnd3JpdGUnOnRydWUsJ3JvbGUnOidzdHJpbmcnLCdkZWYnOidVaHInfV0sCglbcGZhZCsnemVpdHBsYW4uZmVzdGVfc3RhcnR6ZWl0X3VocnplaXRfc3RhcnRfc3R1bmRlJywgeyduYW1lJzonZmVzdGVfc3RhcnR6ZWl0X3VocnplaXRfc3RhcnRfc3R1bmRlJywndHlwZSc6J3N0cmluZycsJ3JlYWQnOnRydWUsJ3dyaXRlJzp0cnVlLCdyb2xlJzonc3RyaW5nJywnZGVmJzonJ31dLAoJW3BmYWQrJ3plaXRwbGFuLmZlc3RlX3N0YXJ0emVpdF91aHJ6ZWl0X3N0YXJ0X21pbnV0ZScsIHsnbmFtZSc6J2Zlc3RlX3N0YXJ0emVpdF91aHJ6ZWl0X3N0YXJ0X21pbnV0ZScsJ3R5cGUnOidzdHJpbmcnLCdyZWFkJzp0cnVlLCd3cml0ZSc6dHJ1ZSwncm9sZSc6J3N0cmluZycsJ2RlZic6Jyd9XSwJCiAgICAKXTsgICAgCiAgICBjcmVhdGVVc2VyU3RhdGVzKHNwZWljaGVyb3J0LCBmYWxzZSwgc3RhdGVzVG9DcmVhdGUpOw==</field> <comment pinned="false" h="80" w="160">Datenpunkte erstellen</comment> </block> <block type="procedures_callcustomnoreturn" id="aFB$[5W:V-UBM8)LeXC!" x="13" y="63"> <mutation name="Datenpunkte_erstellen"></mutation> </block> </xml>
/** * Create states under 0_userdata.0 or javascript.x * Current Version: https://github.com/Mic-M/iobroker.createUserStates * Support: https://forum.iobroker.net/topic/26839/ * Autor: Mic (ioBroker) | Mic-M (github) * Version: 1.1 (26 January 2020) * Example: see https://github.com/Mic-M/iobroker.createUserStates#beispiel * ----------------------------------------------- * PLEASE NOTE: Per https://github.com/ioBroker/ioBroker.javascript/issues/474, the used function setObject() * executes the callback PRIOR to completing the state creation. Therefore, we use a setTimeout and counter. * ----------------------------------------------- * @param {string} where Where to create the state: '0_userdata.0' or 'javascript.x'. * @param {boolean} force Force state creation (overwrite), if state is existing. * @param {array} statesToCreate State(s) to create. single array or array of arrays * @param {object} [callback] Optional: a callback function -- This provided function will be executed after all states are created. */ /** * Hier bitte den Speicherort und den Pfad eintragen * Beispiele: speicherort = '0_userdata.0.' speicherort = 'javascript.0' pfad = 'bewasserung.' pfad = 'Gardena.Bewaesserung.' */ speicherort = 'javascript.0' pfad = 'bewaesserung.' function createUserStates(where, force, statesToCreate, callback = undefined) { const WARN = false; // Only for 0_userdata.0: Throws warning in log, if state is already existing and force=false. Default is false, so no warning in log, if state exists. const LOG_DEBUG = false; // To debug this function, set to true // Per issue #474 (https://github.com/ioBroker/ioBroker.javascript/issues/474), the used function setObject() executes the callback // before the state is actual created. Therefore, we use a setTimeout and counter as a workaround. const DELAY = 50; // Delay in milliseconds (ms). Increase this to 100, if it is not working. // Validate "where" if (where.endsWith('.')) where = where.slice(0, -1); // Remove trailing dot if ( (where.match(/^((javascript\.([1-9][0-9]|[0-9]))$|0_userdata\.0$)/) == null) ) { log('This script does not support to create states under [' + where + ']', 'error'); return; } // Prepare "statesToCreate" since we also allow a single state to create if(!Array.isArray(statesToCreate[0])) statesToCreate = [statesToCreate]; // wrap into array, if just one array and not inside an array // Add "where" to STATES_TO_CREATE for (let i = 0; i < statesToCreate.length; i++) { let lpPath = statesToCreate[i][0].replace(/\.*\./g, '.'); // replace all multiple dots like '..', '...' with a single '.' lpPath = lpPath.replace(/^((javascript\.([1-9][0-9]|[0-9])\.)|0_userdata\.0\.)/,'') // remove any javascript.x. / 0_userdata.0. from beginning lpPath = where + '.' + lpPath; // add where to beginning of string statesToCreate[i][0] = lpPath; } if (where != '0_userdata.0') { // Create States under javascript.x let numStates = statesToCreate.length; statesToCreate.forEach(function(loopParam) { if (LOG_DEBUG) log('[Debug] Now we are creating new state [' + loopParam[0] + ']'); let loopInit = (loopParam[1]['def'] == undefined) ? null : loopParam[1]['def']; // mimic same behavior as createState if no init value is provided createState(loopParam[0], loopInit, force, loopParam[1], function() { numStates--; if (numStates === 0) { if (LOG_DEBUG) log('[Debug] All states processed.'); if (typeof callback === 'function') { // execute if a function was provided to parameter callback if (LOG_DEBUG) log('[Debug] Function to callback parameter was provided'); return callback(); } else { return; } } }); }); } else { // Create States under 0_userdata.0 let numStates = statesToCreate.length; let counter = -1; statesToCreate.forEach(function(loopParam) { counter += 1; if (LOG_DEBUG) log ('[Debug] Currently processing following state: [' + loopParam[0] + ']'); if( ($(loopParam[0]).length > 0) && (existsState(loopParam[0])) ) { // Workaround due to https://github.com/ioBroker/ioBroker.javascript/issues/478 // State is existing. if (WARN && !force) log('State [' + loopParam[0] + '] is already existing and will no longer be created.', 'warn'); if (!WARN && LOG_DEBUG) log('[Debug] State [' + loopParam[0] + '] is already existing. Option force (=overwrite) is set to [' + force + '].'); if(!force) { // State exists and shall not be overwritten since force=false // So, we do not proceed. numStates--; if (numStates === 0) { if (LOG_DEBUG) log('[Debug] All states successfully processed!'); if (typeof callback === 'function') { // execute if a function was provided to parameter callback if (LOG_DEBUG) log('[Debug] An optional callback function was provided, which we are going to execute now.'); return callback(); } } else { // We need to go out and continue with next element in loop. return; // https://stackoverflow.com/questions/18452920/continue-in-cursor-foreach } } // if(!force) } // State is not existing or force = true, so we are continuing to create the state through setObject(). let obj = {}; obj.type = 'state'; obj.native = {}; obj.common = loopParam[1]; setObject(loopParam[0], obj, function (err) { if (err) { log('Cannot write object for state [' + loopParam[0] + ']: ' + err); } else { if (LOG_DEBUG) log('[Debug] Now we are creating new state [' + loopParam[0] + ']') let init = null; if(loopParam[1].def === undefined) { if(loopParam[1].type === 'number') init = 0; if(loopParam[1].type === 'boolean') init = false; if(loopParam[1].type === 'string') init = ''; } else { init = loopParam[1].def; } setTimeout(function() { setState(loopParam[0], init, true, function() { if (LOG_DEBUG) log('[Debug] setState durchgeführt: ' + loopParam[0]); numStates--; if (numStates === 0) { if (LOG_DEBUG) log('[Debug] All states processed.'); if (typeof callback === 'function') { // execute if a function was provided to parameter callback if (LOG_DEBUG) log('[Debug] Function to callback parameter was provided'); return callback(); } } }); }, DELAY + (20 * counter) ); } }); }); } } let statesToCreate = [ //Bewässerung [pfad+'bewaesserung_aktiv', {'name':'bewaesserung_aktiv','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'bewaesserung_automatik', {'name':'bewaesserung_automatik','type':'boolean','read':true,'write':true,'role':'switch','def':false}], //Timer [pfad+'lautzeit_gesamt_in_sek', {'name':'lautzeit_gesamt_in_sek','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], [pfad+'lautzeit_ende_uhrzeit', {'name':'lautzeit_ende_uhrzeit','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'restlautzeit', {'name':'restlautzeit','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], [pfad+'restlautzeit_in_sek', {'name':'restlautzeit_in_sek','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], //Ventile [pfad+'ventile.aktives_ventil', {'name': 'aktives_ventil','type':'string','read':true,'write':true,'role':'string','def':''}], [pfad+'ventile.anzahl_aktive_ventile', {'name':'anzahl_aktive_ventile','type':'number','read':true,'write':true,'role':'number','def':0,} ], //Ventil 1 [pfad+'ventile.ventil_1.ventil_1', {'name':'ventil_1','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'ventile.ventil_1.ventil_1_dauer', {'name': 'ventil_1_dauer','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], [pfad+'ventile.ventil_1.ventil_1_ende', {'name':'ventil_1_ende','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'ventile.ventil_1.ventil_1_name', {'name':'ventil_1_name','type':'string','read':true,'write':true,'role':'string','def':'Hecke'}], [pfad+'ventile.ventil_1.ventil_1_restzeit', {'name':'ventil_1_restzeit','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], [pfad+'ventile.ventil_1.ventil_1_restzeit_in_sek', {'name':'ventil_1_restzeit_in_sek','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], //Ventil 2 [pfad+'ventile.ventil_2.ventil_2', {'name':'ventil_2','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'ventile.ventil_2.ventil_2_dauer', {'name': 'ventil_2_dauer','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], [pfad+'ventile.ventil_2.ventil_2_ende', {'name':'ventil_2_ende','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'ventile.ventil_2.ventil_2_name', {'name':'ventil_2_name','type':'string','read':true,'write':true,'role':'string','def':'Rasen'}], [pfad+'ventile.ventil_2.ventil_2_restzeit', {'name':'ventil_2_restzeit','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], [pfad+'ventile.ventil_2.ventil_2_restzeit_in_sek', {'name':'ventil_2_restzeit_in_sek','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], //Ventil 3 [pfad+'ventile.ventil_3.ventil_3', {'name':'ventil_3','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'ventile.ventil_3.ventil_3_dauer', {'name': 'ventil_3_dauer','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], [pfad+'ventile.ventil_3.ventil_3_ende', {'name':'ventil_3_ende','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'ventile.ventil_3.ventil_3_name', {'name':'ventil_3_name','type':'string','read':true,'write':true,'role':'string','def':'Beet'}], [pfad+'ventile.ventil_3.ventil_3_restzeit', {'name':'ventil_3_restzeit','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], [pfad+'ventile.ventil_3.ventil_3_restzeit_in_sek', {'name':'ventil_3_restzeit_in_sek','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], //Ventil 4 [pfad+'ventile.ventil_4.ventil_4', {'name':'ventil_4','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'ventile.ventil_4.ventil_4_dauer', {'name': 'ventil_4_dauer','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], [pfad+'ventile.ventil_4.ventil_4_ende', {'name':'ventil_4_ende','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'ventile.ventil_4.ventil_4_name', {'name':'ventil_4_name','type':'string','read':true,'write':true,'role':'string','def':'kl. Rasen'}], [pfad+'ventile.ventil_4.ventil_4_restzeit', {'name':'ventil_4_restzeit','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], [pfad+'ventile.ventil_4.ventil_4_restzeit_in_sek', {'name':'ventil_4_restzeit_in_sek','type':'number','read':true,'write':true,'role':'number','def':0,'unit':'Sekunden'}], //Zeitplan //Morgens [pfad+'zeitplan.morgens_aktiv', {'name':'morgens_aktiv','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'zeitplan.morgens_uhrzeit_start', {'name':'morgens_uhrzeit_start','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'zeitplan.morgens_uhrzeit_start_stunde', {'name':'morgens_uhrzeit_start_stunde','type':'string','read':true,'write':true,'role':'string','def':''}], [pfad+'zeitplan.morgens_uhrzeit_start_minute', {'name':'morgens_uhrzeit_start_minute','type':'string','read':true,'write':true,'role':'string','def':''}], [pfad+'zeitplan.morgens_verzoegerung_sonnenaufgang', {'name':'morgens_verzoegerung_sonnenaufgang','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], //Abends [pfad+'zeitplan.abends_aktiv', {'name':'abends_aktiv','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'zeitplan.abends_uhrzeit_start', {'name':'abends_uhrzeit_start','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'zeitplan.abends_uhrzeit_start_stunde', {'name':'abends_uhrzeit_start_stunde','type':'string','read':true,'write':true,'role':'string','def':''}], [pfad+'zeitplan.abends_uhrzeit_start_minute', {'name':'abends_uhrzeit_start_minute','type':'string','read':true,'write':true,'role':'string','def':''}], [pfad+'zeitplan.abends_verzoegerung_sonnenuntergang', {'name':'abends_verzoegerung_sonnenuntergang','type': 'string','read':true,'write':true,'role':'string','def':'Minuten'}], //Feste Startzeit [pfad+'zeitplan.feste_startzeit_aktiv', {'name':'feste_startzeit_aktiv','type':'boolean','read':true,'write':true,'role':'switch','def':false}], [pfad+'zeitplan.feste_startzeit_uhrzeit_start', {'name':'feste_startzeit_uhrzeit_start','type':'string','read':true,'write':true,'role':'string','def':'Uhr'}], [pfad+'zeitplan.feste_startzeit_uhrzeit_start_stunde', {'name':'feste_startzeit_uhrzeit_start_stunde','type':'string','read':true,'write':true,'role':'string','def':''}], [pfad+'zeitplan.feste_startzeit_uhrzeit_start_minute', {'name':'feste_startzeit_uhrzeit_start_minute','type':'string','read':true,'write':true,'role':'string','def':''}], ]; createUserStates(speicherort, false, statesToCreate);
Mic-M created this issue in ioBroker/ioBroker.javascriptclosed setObject() function: callback not working as intended. #474
Mic-M created this issue in ioBroker/ioBroker.javascriptclosed setObject() function: callback not working as intended. #474
Mic-M created this issue in ioBroker/ioBroker.javascriptclosed 0_userdata.0: existsState() vs. $-Selector $().length after state deletion #478
-
@dslraser cool, danke. schaue ich mir morgen mal an
-
@Kuddel
wenn Du es in Dein Script mit einbaust, dann würde ich die Funktion zum erstellen der DP nur beim ersten starten des Blockly aktivieren, dann deaktivieren und wieder starten. Sonnst hast Du bei einem Neustart vom Script oder der JS Instanz wieder initiale Werte drinn, wenn die letzte Zeile auf true steht, oder eben die letzte Zeile auf false stellen. -
@Kuddel sagte in [Vorlage] Gartenbewässerung mit 4 Ventilen:
Dein Fehler aus dem Log habe ich gefixt und aus den Scrrenshots auch.
Sieht auf den ersten Blick gut aus - keine Fehler.
Ich hab vorhin nur auf die schnelle nach dem hm-rpc Fehler gesucht - was war es denn?
-
@darkiop die variable für den ontime wert wurde falsch benutzt
-
hier nochmal zum testen inkl. erstellung aller DPs (vielen dank an @dslraser für die Hilfe)
-
@Kuddel Bei Ventil 3 wird keine Restlaufzeit berechnet
-
bei mir schon
-
@Kuddel Guten Morgen. Ich muss mal schauen - ich hab hier leider den Effekt - Geht mal / Geht wieder nicht ...
Funkprobleme kann ich ausschließen, in der Nähe des Außenaktors für die Ventile sitzt ein LAN-Gateway.
Im Log ist mir aufgefallen, das manchmal das ON_TIME zweimal geschickt wird - das wird aber ein Javascript-Adapter/ioBroker-Controller Problem sein. -
hallo zusammen, ich hab das skript gerade erweitert, sodass es für Homematic UND Sonoff funktioniert.
Dazu muss man in den Variablen nur den Aktornamen und den Aktortyp eintragen:
In den Kommentaren zu den Variablen steht eine kurze Beschreibung.
Ich habe es mit Sonoff und HM gestetet.
Bis au der Übergang von Ventil 3 zu Ventil 4, läuft es.
Des Weiteren habe ich den DP "Sonnenuntergang" neu definiert und in die DP-Struktur der Bewässerung mit eingebaut.
Wer Lust und Zeit hat zu testen... gerne gerne Fehler bitte melden
-
@Kuddel
Danke für deine Arbeit!
Das sieht bei mir aktuell so aus, bin mir nicht sicher ob das so stimmt.vars_pfad -> müsste so bleiben, da ja durch dein Script importiert?
vars_aktor_typ = sonoff ?
vars_aktor_name = sonoff.0.DVES_5A1757 ? (müssen power 1-4 nicht mehr definiert werden?
-
vars_pfad -> müsste so bleiben, da ja durch dein Script importiert?
Kann, muss aber nicht. Wenn du deine Struktur anders aufbauen möchtest, kannst du das gerne anpassen.
Dann aber bitte in der Blockly-Variable UND im JavaSkriptvars_aktor_typ = sonoff ?
Ja, passt so
vars_aktor_name = sonoff.0.DVES_5A1757 ? (müssen power 1-4 nicht mehr definiert werden?
Name passt. Power1-4 wird automatisch vom Skript definiert
-
@Kuddel
Danke, dann müsste das jetzt so passen (deine Struktur lasse ich aktuell so)Folgende Beobachtung habe ich gerade gemacht:
Habe jetzt als Test des Sonoff für alle 4 Kreise 1min eingestellt und den an/aus Button (links neben Automatik) aktiviert.Ergebnis:
- Kanal 1 wird aktiviert, nach einer Minute wird Kanal 2 aktiviert, Kanal 1 bleibt aktiv und so weiter, am Ende der Laufzeit werden alle vier Kanäle wieder deaktiviert
- Wenn ich einen Kreis anklicke (wird grün) sollte dann nicht der Kanal aktiviert werden oder welche Funktion hat das aktivieren eines Kreise in der Vis?
--> nach klicken auf einen Kreis passiert im Sonoff nichts.
-
Kanal 1 wird aktiviert, nach einer Minute wird Kanal 2 aktiviert, Kanal 1 bleibt aktiv und so weiter, am Ende der Laufzeit werden alle vier Kanäle wieder deaktiviert
Ist die IP in den Variablen richtig ? Das sieht so aus, als wenn die Einschaltdauer nicht richtig gesetzt wird
Wenn ich einen Kreis anklicke (wird grün) sollte dann nicht der Kanal aktiviert werden oder welche Funktion hat das aktivieren eines Kreise in der Vis?
Die aktvierung der einzelnen Ventile per VIS ist komplett losgelöst vom Skript. Das ist dann ein komplett manueller Eingriff.
Prüfe mal im VIS Editor, ob überall die korrekten DPs zu deinem Sonoff aktor hinterlegt sind
Wennm an die einzelnen Ventile manuell anschaltet per VIS, muss man sie auch wieder manuell abschalten. -
ok, dachte nur das es sinnvoller wäre Kreis 1 an, Kreis 1 aus, dann Kreis 2 an und so weiter. Für Leute die zu wenig Fließdruck haben könnte das ggf Eng werden wenn alle vier Kreise gleichzeitig aktiv sind. Abgesehen davon müsste Kreis 1 doch nach einer Minute (wenn so eingestellt) ausgehen, sonst bleibt Kreis 1 am Ende 4 Minuten an (wenn alle Kreise 1 Minute aktiv sind) oder?
Das scheint in der VIS noch nicht zu stimmen:
Der obere Eintrag endet auf STATE der untere auf WORKING, kannst du mir sagen was dort eingestellt werden bei Sonoff?Das bei manueller Aktivierung eines Kreises der auch wieder deaktiviert werden muss macht Sinn, der timer daneben greift dann nicht?