NEWS
OpenDTU-onBattery Blockly DPL Ein/Aus
-
Nachdem ich keine Lösung gefunden habe bei OpenDTU-onBattery den Dynamic Power Limiter per iobroker ein- und ausschalten zu lassen, musste ich selbst eine Möglichkeit schaffen.
Dazu habe ich die requests gelogt und dann ein Blockly geschrieben.
Das Script funktioniert wie folgt:
Nachdem man Passwort und IP der OpenDTU-onBattery am Beginn des Blockly eingetragen hat, startet man kurz das Blockly.
Wenn es ausgeführt wird, werden die aktuellen Dynamic Power Limiter Einstellungen von OpenDTU-onBattery in den Datenpunkt DPLjson geschrieben.
Aus diesem Datenpunkt werden 2 cURL generiert und in die Datenpunkte DPLcURLoff und DPLcURLon geschrieben.Wenn man nun scripte hat, die den Dynamic Power Limiter aktivieren und deaktivieren sollen, kann man einfach
den Baustein: Blockly -> Aktionen -> Exec Befehl benutzen.
Bei Exec Befehl: Wert von Objekt ID fürs Ein- oder Ausschalten übergeben.
Das hat mehrere Vorteile:
Unter anderem kann man nun beliebig auf der Web-Oberfläche von OpenDTU-onBattery die Werte editieren und abspeichern.
Auch ein Wechsel der IP oder des Passworts sind schnell erledigt.
Kein json und cURL muss mehr editiert werden und auch nicht kopiert werden.
(Fehlerquellen) Nichts muss mehr manuell geändert werdenNach einer Änderungen der DPL-Einstellungen bei OpenDTU-onBattery nur kurz das script ausführen.
Schon stehen weiterhin allen anderen scripts die aktuellen cURL zur Verfügung.
Folgendes muss manuell erstellt werden:
Verzeichnis: openDTUoB3 Datenpunkte:
DPLcURLoff
0_userdata.0.Datenpunkte.openDTUoB.DPLcURLoff
"type": "mixed"DPLcURLon
0_userdata.0.Datenpunkte.openDTUoB.DPLcURLon
"type": "mixed"DPLjson
0_userdata.0.Datenpunkte.openDTUoB.DPLjson
"type": "json"
Blockly importieren:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="Qi(X{.W0hQa)qS.~KMnK">jsonObj</variable> <variable id="vGj~Up;/(GEjVCtCWSau">attr</variable> <variable id="aK@)UK^I,OjUDotEm{RT">val</variable> <variable id="T[fn@X+yakzmBpi9]n*E">openDTUonBatteryIP</variable> <variable id="nh}jM|3k}%Qhny;,Etjk">OpenDTUonBatteryPassword</variable> <variable id="2|vbm;5buC6^$eogp=fe">urlDPLstate</variable> <variable id="PWsI)BqL)EeZPzj!8-VY">set</variable> <variable id="_+8y375~59B=8rd!@Ae%">jsonObjekt</variable> </variables> <block type="comment" id="g{c,O//*067~CDT{26F+" x="187" y="113"> <field name="COMMENT">OpenDTUonBattery DPL&#10;Ein /Aus curl-Generator</field> <next> <block type="comment" id="X#b7{Kt}1UU7fDa$==:$"> <field name="COMMENT">---</field> <next> <block type="comment" id="wPs7.T(3#lmg-Q#YnMcz"> <field name="COMMENT">IP von OpenDTUonBattery:</field> <next> <block type="variables_set" id="xiC72+QQD{FQ44VC6wQn"> <field name="VAR" id="T[fn@X+yakzmBpi9]n*E">openDTUonBatteryIP</field> <value name="VALUE"> <block type="text" id="3|rd+!6W]T02z}tGd1/m"> <field name="TEXT">xxx.xxx.xx.xxx</field> </block> </value> <next> <block type="comment" id="8!|A_f5hyHJr/:f!|;r."> <field name="COMMENT">OpenDTUonBattery Passwort:</field> <next> <block type="variables_set" id="ItJFflir$91[$;pF5+MA"> <field name="VAR" id="nh}jM|3k}%Qhny;,Etjk">OpenDTUonBatteryPassword</field> <value name="VALUE"> <block type="text" id="xYm]l*(;=w@0xJQnWi5-"> <field name="TEXT">openDTU42</field> </block> </value> <next> <block type="comment" id="8ezl|ED@6X29f4k@:.2H"> <field name="COMMENT">----</field> <next> <block type="variables_set" id="!#IE.`!)HPf,NcPW*miy"> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> <value name="VALUE"> <block type="text_join" id="F#[x6:MOpP{a#hljyq@2"> <mutation items="5"></mutation> <value name="ADD0"> <block type="text" id="!@~5;?O8`oIO%oN]bLJa"> <field name="TEXT">curl -u "admin:</field> </block> </value> <value name="ADD1"> <block type="variables_get" id="SFT0:Zq378qj5]2?a5#b"> <field name="VAR" id="nh}jM|3k}%Qhny;,Etjk">OpenDTUonBatteryPassword</field> </block> </value> <value name="ADD2"> <block type="text" id="5}ok+uklC%b/F}gtZr`^"> <field name="TEXT">" http://</field> </block> </value> <value name="ADD3"> <block type="variables_get" id="C|ac)ks!*i8cZS5zb!0?"> <field name="VAR" id="T[fn@X+yakzmBpi9]n*E">openDTUonBatteryIP</field> </block> </value> <value name="ADD4"> <block type="text" id="!=iiY$6m(O#=Q|km-7W1"> <field name="TEXT">/api/powerlimiter/config</field> </block> </value> </block> </value> <next> <block type="variables_set" id="Nw*-3DKlvV=)l.++!yg%"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> <value name="VALUE"> <block type="text_join" id="b3+b3^R@5s5Vbpj^o9!6"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="%UJkDROf_mMO^oE4EKW."> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> </block> </value> <value name="ADD1"> <block type="text" id="o}*[n$;A?-]x1P{Ppan."> <field name="TEXT"> -d 'data=</field> </block> </value> </block> </value> <next> <block type="comment" id="Y+nX-p}*xExWw]O`OX~{"> <field name="COMMENT">aktueller DPL state:</field> <next> <block type="exec" id="I~3.fAPDzJ[1T(TlzoOT"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation> <field name="WITH_STATEMENT">TRUE</field> <field name="LOG"></field> <value name="COMMAND"> <shadow type="text" id="9;-TT-}BY,qROECr/9_6"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="i4]srTbBS]Jm}Z^t,,i^"> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> </block> </value> <statement name="STATEMENT"> <block type="update" id="]_}9,-rEB(}}o}|$vd2a"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_json2object" id="+S#oh?uaC.uh+B.5!ftz"> <value name="VALUE"> <block type="exec_result" id=".PXAxRRLM_t8^:5$jp+b"> <field name="ATTR">result</field> </block> </value> </block> </value> <next> <block type="comment" id="Uk.|!p8=8P=KEmM?62Yw"> <field name="COMMENT">DPL==false</field> <next> <block type="controls_if" id="eSYnXB@M8e4mYTwMl?nk"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="`fzpMw!?u%@Eavl5V|EF"> <field name="OP">EQ</field> <value name="A"> <block type="get_attr" id="3p`mkNx[*HO7iQJC|V{N"> <value name="PATH"> <shadow type="text" id="8DfMj){9E]0z+yjsND5+"> <field name="TEXT">enabled</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object" id="aHFd;U%V4s{~a(8w9UNy"> <field name="OID">0_userdata.0.Datenpunkte.Test.test-Json</field> </shadow> <block type="get_value" id="h}CfSdJ5IV._[~=/@kZK"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> </block> </value> <value name="B"> <block type="logic_boolean" id="[rt,uw{$!;vYlL=e?zLD"> <field name="BOOL">FALSE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="G*c:B_jB13GqpNd,o(F@"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLcURLoff</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id="*=C%NRPXME0A6FX^v{^/"> <mutation items="3"></mutation> <value name="ADD0"> <block type="variables_get" id="@V/wiwS61;_W=qF.qe},"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> </block> </value> <value name="ADD1"> <block type="convert_object2json" id="b=?~!KmQ:low.y0uw5-*"> <field name="PRETTIFY">FALSE</field> <value name="VALUE"> <block type="get_value" id="go35w{_dzqNS:=}_:CF7"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> </block> </value> <value name="ADD2"> <block type="text" id="c@*KM#xUbNEWlB`Xn`m`"> <field name="TEXT">'</field> </block> </value> </block> </value> <next> <block type="comment" id="A(14glg}PvpJG@9qX7Z+"> <field name="COMMENT">vice versa&#10;DPL EIN:</field> <next> <block type="variables_set" id="0|V0|;zC!q:L?LEw_SCm"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> <value name="VALUE"> <block type="get_value" id="2:GuRI#:c_/ff.[pny3J"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="D9g{#*qgs_-7rfz6|TYD"> <mutation name="change"> <arg name="jsonObj"></arg> <arg name="attr"></arg> <arg name="val"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="yi4H-8|bl|J[{ecr@w?*"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> </block> </value> <value name="ARG1"> <block type="text" id="/1aiKrRmt}{2sRQ`BE^S"> <field name="TEXT">enabled</field> </block> </value> <value name="ARG2"> <block type="logic_boolean" id="]!TrP#dnQ%e`r1%@n;)0"> <field name="BOOL">TRUE</field> </block> </value> <next> <block type="update" id="FDTWU8Q(D$r^4@Oa[7-H"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLcURLon</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id="4LCf@(uF:9R1pJ;:{rwm"> <mutation items="3"></mutation> <value name="ADD0"> <block type="variables_get" id="oBaJ~PM^%X0}qr~sN.wG"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> </block> </value> <value name="ADD1"> <block type="convert_object2json" id="H7/X)J#6af29v,y:KJkc"> <field name="PRETTIFY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="m~;E(nq{5fj@.G-+9/]C"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> </block> </value> </block> </value> <value name="ADD2"> <block type="text" id="ba,QplH`[d@~.VFYbl/x"> <field name="TEXT">'</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="comment" id="MZHI{#fd6q3sz3I_d+GN"> <field name="COMMENT">DPL==true</field> <next> <block type="controls_if" id="PAibga_z{LcQ[~jM8;Ca"> <value name="IF0"> <block type="logic_compare" id="(?;RKnXV72NthJA#uMFR"> <field name="OP">EQ</field> <value name="A"> <block type="get_attr" id="_!]mQ-leM12{h%m}UUH@"> <value name="PATH"> <shadow type="text" id="M;r%l+8)VN_pDsh^eiCS"> <field name="TEXT">enabled</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object" id="aHFd;U%V4s{~a(8w9UNy"> <field name="OID">0_userdata.0.Datenpunkte.Test.test-Json</field> </shadow> <block type="get_value" id="A`y:i12%FLSG=d:|X+F["> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> </block> </value> <value name="B"> <block type="logic_boolean" id="2m*-oFX3UimQy@###-)|"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="q{qz:UVdtG=PYm^y|%fB"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLcURLon</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id="D5B6R@JvIqMwALRZkKn["> <mutation items="3"></mutation> <value name="ADD0"> <block type="variables_get" id="`0!j-Z88!Ljdq1R)oW7T"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> </block> </value> <value name="ADD1"> <block type="convert_object2json" id="@#hU(~r@yZ;MEG=fL[dt"> <field name="PRETTIFY">FALSE</field> <value name="VALUE"> <block type="get_value" id="eb`rFBf.{[S}[L;H*u6]"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> </block> </value> <value name="ADD2"> <block type="text" id="ddX9tj.4u,VaSeJ9ScQ$"> <field name="TEXT">'</field> </block> </value> </block> </value> <next> <block type="comment" id="pd=K1k)tUpL8+R1irW~g"> <field name="COMMENT">vice versa&#10;DPL AUS</field> <next> <block type="variables_set" id="XKauh_84Yny7N.iV[},h"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> <value name="VALUE"> <block type="get_value" id="w1~H:gcTjR7vX4.z]S/^"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="D$dLL1B`Q`pduW5}=@2d"> <mutation name="change"> <arg name="jsonObj"></arg> <arg name="attr"></arg> <arg name="val"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="xWY=avx.3,-q(7tDhODL"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> </block> </value> <value name="ARG1"> <block type="text" id=",eWW=PmfF{bVI.C{OA21"> <field name="TEXT">enabled</field> </block> </value> <value name="ARG2"> <block type="logic_boolean" id="2Bi`1f_y6|$,!+y39ou/"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="update" id="r7b/s#UtaaL/}L+Gf]3A"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLcURLoff</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id="7KxC37uFlZ4X~axO=^@$"> <mutation items="3"></mutation> <value name="ADD0"> <block type="variables_get" id="85LCj01ufV~vHu*jxxbY"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> </block> </value> <value name="ADD1"> <block type="convert_object2json" id="tT4*~Wki{B+:Kays[$x7"> <field name="PRETTIFY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="BF;r+2*I3i`hTMk849Y3"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> </block> </value> </block> </value> <value name="ADD2"> <block type="text" id="Xj?V!xEz/ob86i/D#HR0"> <field name="TEXT">'</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> <block type="procedures_defcustomnoreturn" id="nxZk[TB}x%yvkJ058U]o" x="887" y="387"> <mutation statements="false"> <arg name="jsonObj" varid="Qi(X{.W0hQa)qS.~KMnK"></arg> <arg name="attr" varid="vGj~Up;/(GEjVCtCWSau"></arg> <arg name="val" varid="aK@)UK^I,OjUDotEm{RT"></arg> </mutation> <field name="NAME">change</field> <field name="SCRIPT">anNvbk9ialthdHRyXSA9IHZhbDs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> </xml>
Im Blockly IP und Passwort eintragen:
Blockly kurz starten.
Schon stehen die Datenpunkte zum ein- ausschalten des DPL als cURL zur Verfügung und können Blockly Script(e) -> Aktionen -> Exec Befehl übergeben werden.
Wenn man mal DPL-Werte auf der Web-Oberfläche geändert hat,
muss nur das Script kurz ausgeführt werden, schon sind die aktualisierten cURL für Exec in den Datenpunkten.Im Script wird berücksichtigt ob DPL gerade ein- oder ausgeschaltet ist und die Datenpunkte mit den Werten für Einschalten und Ausschalten stimmen.
Gleichgültig ob DPL gerade ein- oder ausgeschaltet ist.Finde das ist ne gute Lösung und wird bestimmt hilfreich sein.
Viel Spaß
-
Dynamic Power Limiter
"Angestrebter Netzbezug" einfach per Datenpunkt ändern.Gleichgültig ob Dynamic Power Limiter gerade aktiviert oder deaktiviert ist.
Alle anderen Einstellungen bleiben erhalten.Für das Script werden manuell 1 Verzeichnis und 4 Datenpunkte angelegt:
Verzeichnis:
openDTUoB
0_userdata.0.Datenpunkte.openDTUoBDatenpunkte:
DPLjson
"type": "mixed"
0_userdata.0.Datenpunkte.openDTUoB.DPLjsonaktDplLimit
"type": "mixed"
0_userdata.0.Datenpunkte.openDTUoB.aktDplLimitsetDplLimit
"type": "mixed"
0_userdata.0.Datenpunkte.openDTUoB.setDplLimitSetDPLcUrlLimit
"type": "mixed"
0_userdata.0.Datenpunkte.openDTUoB.SetDPLcUrlLimitIm Blockly IP und Password der OpenDTUonBattery eintragen:
Beim ersten start des scripts bzw. Aktion des scripts wird kurz ein Fehler protokolliert, weil die Datenpunkte beim ersten mal (null) sind.
Sobald das script 1x ausgeführt wurde und Daten vorhanden sind, läuft es durch.Um ein Angestrebter Netzbezug zu setzen einfach in einem Script den Datenpunkt: setDplLimitmit den gewünschten Wert übergeben.
Blockly:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="PpEE#-6$^YDe2BB~7G(1">jsonObj</variable> <variable id="2-72ij)e0rW1b$Z(u.Fw">attr</variable> <variable id="qMDm[]#Gz_!JwdN9S+^b">val</variable> <variable id="T[fn@X+yakzmBpi9]n*E">openDTUonBatteryIP</variable> <variable id="nh}jM|3k}%Qhny;,Etjk">OpenDTUonBatteryPassword</variable> <variable id="2|vbm;5buC6^$eogp=fe">urlDPLstate</variable> <variable id="PWsI)BqL)EeZPzj!8-VY">set</variable> <variable id="_+8y375~59B=8rd!@Ae%">jsonObjekt</variable> </variables> <block type="on_ext" id="aE.a,mnB^lC:Ei0^7)N^" x="163" y="38"> <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="I)1M,z91-GcW7mR_fI.b"> <field name="oid">0_userdata.0.Datenpunkte.openDTUoB.setDplLimit</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="g{c,O//*067~CDT{26F+"> <field name="COMMENT">setOpenDtuLimit</field> <next> <block type="comment" id="X#b7{Kt}1UU7fDa$==:$"> <field name="COMMENT">---</field> <next> <block type="comment" id="wPs7.T(3#lmg-Q#YnMcz"> <field name="COMMENT">IP von OpenDTUonBattery:</field> <next> <block type="variables_set" id="xiC72+QQD{FQ44VC6wQn"> <field name="VAR" id="T[fn@X+yakzmBpi9]n*E">openDTUonBatteryIP</field> <value name="VALUE"> <block type="text" id="3|rd+!6W]T02z}tGd1/m"> <field name="TEXT">192.174.50.254</field> </block> </value> <next> <block type="comment" id="8!|A_f5hyHJr/:f!|;r."> <field name="COMMENT">OpenDTUonBattery Passwort:</field> <next> <block type="variables_set" id="ItJFflir$91[$;pF5+MA"> <field name="VAR" id="nh}jM|3k}%Qhny;,Etjk">OpenDTUonBatteryPassword</field> <value name="VALUE"> <block type="text" id="xYm]l*(;=w@0xJQnWi5-"> <field name="TEXT">openDTU42</field> </block> </value> <next> <block type="comment" id="8ezl|ED@6X29f4k@:.2H"> <field name="COMMENT">----</field> <next> <block type="variables_set" id="!#IE.`!)HPf,NcPW*miy"> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> <value name="VALUE"> <block type="text_join" id="F#[x6:MOpP{a#hljyq@2"> <mutation items="5"></mutation> <value name="ADD0"> <block type="text" id="!@~5;?O8`oIO%oN]bLJa"> <field name="TEXT">curl -u "admin:</field> </block> </value> <value name="ADD1"> <block type="variables_get" id="SFT0:Zq378qj5]2?a5#b"> <field name="VAR" id="nh}jM|3k}%Qhny;,Etjk">OpenDTUonBatteryPassword</field> </block> </value> <value name="ADD2"> <block type="text" id="5}ok+uklC%b/F}gtZr`^"> <field name="TEXT">" http://</field> </block> </value> <value name="ADD3"> <block type="variables_get" id="C|ac)ks!*i8cZS5zb!0?"> <field name="VAR" id="T[fn@X+yakzmBpi9]n*E">openDTUonBatteryIP</field> </block> </value> <value name="ADD4"> <block type="text" id="!=iiY$6m(O#=Q|km-7W1"> <field name="TEXT">/api/powerlimiter/config</field> </block> </value> </block> </value> <next> <block type="variables_set" id="Nw*-3DKlvV=)l.++!yg%"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> <value name="VALUE"> <block type="text_join" id="b3+b3^R@5s5Vbpj^o9!6"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="%UJkDROf_mMO^oE4EKW."> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> </block> </value> <value name="ADD1"> <block type="text" id="o}*[n$;A?-]x1P{Ppan."> <field name="TEXT"> -d 'data=</field> </block> </value> </block> </value> <next> <block type="comment" id="Y+nX-p}*xExWw]O`OX~{"> <field name="COMMENT">aktueller DPL state:</field> <next> <block type="exec" id="I~3.fAPDzJ[1T(TlzoOT"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation> <field name="WITH_STATEMENT">TRUE</field> <field name="LOG"></field> <value name="COMMAND"> <shadow type="text" id="9;-TT-}BY,qROECr/9_6"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="i4]srTbBS]Jm}Z^t,,i^"> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> </block> </value> <statement name="STATEMENT"> <block type="update" id="]_}9,-rEB(}}o}|$vd2a"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_json2object" id="+S#oh?uaC.uh+B.5!ftz"> <value name="VALUE"> <block type="exec_result" id=".PXAxRRLM_t8^:5$jp+b"> <field name="ATTR">result</field> </block> </value> </block> </value> <next> <block type="update" id="@VwExFP~sAbTQzLip^k`"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.aktDplLimit</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_attr" id="7LIYk[ib]$eCRG4gtJ]R"> <value name="PATH"> <shadow type="text" id="~@p8v^7;c3y8n)^,`:G@"> <field name="TEXT">target_power_consumption</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object" id="aHFd;U%V4s{~a(8w9UNy"> <field name="OID">0_userdata.0.Datenpunkte.Test.test-Json</field> </shadow> <block type="get_value" id="$DI6u}$ch[R!KrLlz?@Q"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> </block> </value> </block> </next> </block> </statement> <next> <block type="controls_if" id="pQ1x;S)8=f%tkpcHbJ?K"> <value name="IF0"> <block type="logic_compare" id="0)d3q9Y:x}C+V0`gz93."> <field name="OP">NEQ</field> <value name="A"> <block type="get_value" id="]w6pqITVtC(YRS/uXHn."> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.aktDplLimit</field> </block> </value> <value name="B"> <block type="get_value" id="pVSRx_717;j[_r5D3e]F"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.setDplLimit</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="0|V0|;zC!q:L?LEw_SCm"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> <value name="VALUE"> <block type="get_value" id="2:GuRI#:c_/ff.[pny3J"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="D9g{#*qgs_-7rfz6|TYD"> <mutation name="change"> <arg name="jsonObj"></arg> <arg name="attr"></arg> <arg name="val"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="yi4H-8|bl|J[{ecr@w?*"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> </block> </value> <value name="ARG1"> <block type="text" id="/1aiKrRmt}{2sRQ`BE^S"> <field name="TEXT">target_power_consumption</field> </block> </value> <value name="ARG2"> <block type="get_value" id="4mP1p@JH1Q/u)jt-TLlK"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.setDplLimit</field> </block> </value> <next> <block type="update" id="FDTWU8Q(D$r^4@Oa[7-H"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.SetDPLcUrlLimit</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id="4LCf@(uF:9R1pJ;:{rwm"> <mutation items="3"></mutation> <value name="ADD0"> <block type="variables_get" id="oBaJ~PM^%X0}qr~sN.wG"> <field name="VAR" id="PWsI)BqL)EeZPzj!8-VY">set</field> </block> </value> <value name="ADD1"> <block type="convert_object2json" id="H7/X)J#6af29v,y:KJkc"> <field name="PRETTIFY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="m~;E(nq{5fj@.G-+9/]C"> <field name="VAR" id="_+8y375~59B=8rd!@Ae%">jsonObjekt</field> </block> </value> </block> </value> <value name="ADD2"> <block type="text" id="ba,QplH`[d@~.VFYbl/x"> <field name="TEXT">'</field> </block> </value> </block> </value> <next> <block type="exec" id="/]sKAbRLtX8xCM$2kgdn"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="false"></mutation> <field name="WITH_STATEMENT">FALSE</field> <field name="LOG"></field> <value name="COMMAND"> <shadow type="text" id="N9:Pe(3lj5x,ZG*6It01"> <field name="TEXT"></field> </shadow> <block type="get_value" id="{L%0:kV{MfGZHJepOEC4"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.SetDPLcUrlLimit</field> </block> </value> <next> <block type="exec" id="9+t[=xH=g*zCivn`c_Q3"> <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation> <field name="WITH_STATEMENT">TRUE</field> <field name="LOG"></field> <value name="COMMAND"> <shadow type="text" id="9;-TT-}BY,qROECr/9_6"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="2Q[rFYRfky7^ar%-M:[."> <field name="VAR" id="2|vbm;5buC6^$eogp=fe">urlDPLstate</field> </block> </value> <statement name="STATEMENT"> <block type="update" id=".[Sbk(eJ3mJHIoa?tA^d"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_json2object" id="=zr^[0YUCL^@hdD0=F+4"> <value name="VALUE"> <block type="exec_result" id="!4z#dX-Z95L2:niL9(K5"> <field name="ATTR">result</field> </block> </value> </block> </value> <next> <block type="update" id="qN1h=Qq3-HQ-g:t]O34$"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.aktDplLimit</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_attr" id="%0//;8tj{Qsw#_Ue?3L~"> <value name="PATH"> <shadow type="text" id="-!OUAh+JxR7HYU_4H:MJ"> <field name="TEXT">target_power_consumption</field> </shadow> </value> <value name="OBJECT"> <shadow type="get_object" id="aHFd;U%V4s{~a(8w9UNy"> <field name="OID">0_userdata.0.Datenpunkte.Test.test-Json</field> </shadow> <block type="get_value" id="k(y6d_|s3j,/of~I7dHS"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Datenpunkte.openDTUoB.DPLjson</field> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defcustomnoreturn" id="5JF2E5G%-.$OV~qb`(l/" x="275" y="883"> <mutation> <arg name="jsonObj" varid="PpEE#-6$^YDe2BB~7G(1"></arg> <arg name="attr" varid="2-72ij)e0rW1b$Z(u.Fw"></arg> <arg name="val" varid="qMDm[]#Gz_!JwdN9S+^b"></arg> </mutation> <field name="NAME">change</field> <field name="SCRIPT"></field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> </xml>
Klar, es geht immer besser.
Man könnte mehr Variablen statt Datenpunkte verwenden.
Habe es mit Datenpunkte schnell umgesetzt, weil ich verschachtelt mit mehr arbeite und leider nicht genug Zeit habe.Habe lange erfolglos gesucht und muss(te) mir die Lösungen selbst erarbeiten.
Damit bin ich bestimmt nicht allein und möchte Erfolge mit Euch teilen.
Funktioniert einwandfrei, ist so gut verwendbar.
Gerne darf hier jemand weiter helfen und Verbesserungen oder Vorschläge einbringen.