NEWS
Frage zu eCharts - x-Offset?
-
@bananajoe
Daten kommen aus SQL. Ich speichere die per Blockly selber dort rein, da ich mehrere Anlagen zusammen addieren muss. Wie kann ich denn den Zeitstempel selbst auf +24h setzen? Hab das noch nie gemacht…Edit: Die Daten kommen in selbst erstellte Datenpunkte und von dort in die SQL-Datenbank, nicht direkt in SQL.
-
@guitardoc Zu jedem Wert den du erhältst (vom Adapter, ich nehme an du verarbeitest das JSON) ist da auch ein Datum/Uhrzeit dabei:
oder wenn du den anderen JSON nimmst:
Wenn diese Zeitangaben beim Schreiben der Werte in die Datenbank als Zeitstempel genutzt hast wäre alles gut ...
Du hast also in eCharts eine Ansicht mit dem Zeitraum von heute, und siehst die Prognosen von morgen?
Bei mir - heute, per eCharts:
und wenn ich das 24h von rechts nach links schiebe:
Die Zahlen oben rechst sind natürlich dann von heute und nicht morgen, aber das eChart zeigt diese richtig an. -
@bananajoe Ich hatte nur den absoluten Wert (also die gesamte zu erwartende Leistung des gesamten heutigen und morgigen Tages) ausgewertet, also nur ganz einfach so:
Wenn ich das richtig sehe, dann könnte man über das JSON ja sogar über den Tag verteilt auswerten, das hatte ich noch gar nicht gesehen. Da muss ich mich mal damit beschäftigen. Da sind die Zeitstempel ja dabei.
Aber mal interessehalber - bei meiner kleinen Sparvariante - wie könnte man denn da per Hand selbst den Zeitstempel im Blockly setzen? -
@guitardoc du hast das also in Datenpunkten, ok ok.
Keine Ahnung. -
@bananajoe Ich habe mir gerade noch mal das Thema angesehen. Ich komme damit nicht klar... Wie kann ich denn das JSON so verarbeiten, damit ich die Daten so in SQL reinbekomme um sie dann auch auswerten zu können? Bei meiner Ein-Wert-Variante mache ich das darüber:
Dann hab ich ja auch noch das Problem, dass ich ein Ost-West-System habe und daher die beiden JSON addieren muss. Keine Ahnung wie das wieder geht...EDIT: Aber eigentlich ist doch in den eCharts trotzdem ein Fehler. Wenn der x-Offset so funktionieren würde wie ich es denke dass er es müsste, dann würden die Daten bei der Anzeige ja einfach 24h in die Zukunft verschoben werden können und alles wäre schick. Oder hab ich da einen Denkfehler?
-
@guitardoc irgendwo in diesem Thread müsste das Skript sein: https://forum.iobroker.net/topic/45315/test-pv-forecast-adapter
Ich habe dir einfach mal mein Blockly-Skript kopiert:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="RtPM2%k{F`%!q{Rk]|a.">id</variable> <variable id=";!)T*gf?`G!J~iZ#4,CG">ts</variable> <variable id="epT$}5hcYx3b^`jz:~#d">value</variable> <variable id="GAGtL,+-C3?x`s;u1nsR">ack</variable> <variable id="rHJp6FCFj,U],$ysF[xX">from</variable> <variable id="p~yp5Fejp5Y|*K$i[(u%">q</variable> <variable id="xr?C%:}F%HR,+baC%W8n">x</variable> <variable id="eF:WEr]2Ns:niv]0A2?4">myIdDeleteAll</variable> <variable id="x_DyQchZBQppJ/pt(CT@">dp_Forecast_Total</variable> <variable id="!X-*UNPMzEuy~Y#t}/dN">dp_Forecast_600W</variable> <variable id="h*oloiz8h?C|3%]5[3Cq">dp_Forecast_1500W</variable> <variable id="k`SXM[H%$|.V$:XshBb~">dp_Forecast_Hauswand</variable> <variable id="B$n_|Lt?V?dltG$1=%U!">JSONTable</variable> <variable id="zqSSt1.lPBrP!prtJp:[">JSONListe</variable> <variable id="[,noZ+!#R([v)Vli[JAC">counter</variable> <variable id="9[xS=sH).DKBS8oGN@cs">i</variable> <variable id="tkH#qcE=H5/_7~OttW5(">tempDatum</variable> <variable id="f=MX5bxXCe`#`$z~HXcG">tempLeistungTotal</variable> <variable id="Qc{Jo]quM_J722)2(/*i">tempLeistung600W</variable> <variable id="K=U*Y1p=yxx7@Aa0B%fF">tempLeistung1500W</variable> <variable id="WVv5bH~8]ZEzMqXNtKo}">tempLeistungHauswand</variable> </variables> <block type="procedures_defcustomnoreturn" id="ppt|ajrQncolYtqyk1q1" x="113" y="-187"> <mutation statements="false"> <arg name="id" varid="RtPM2%k{F`%!q{Rk]|a."></arg> <arg name="ts" varid=";!)T*gf?`G!J~iZ#4,CG"></arg> <arg name="value" varid="epT$}5hcYx3b^`jz:~#d"></arg> <arg name="ack" varid="GAGtL,+-C3?x`s;u1nsR"></arg> <arg name="from" varid="rHJp6FCFj,U],$ysF[xX"></arg> <arg name="q" varid="p~yp5Fejp5Y|*K$i[(u%"></arg> </mutation> <field name="NAME">InsertToHistory</field> <field name="SCRIPT">bGV0IHN0YXRlbWVudCA9IGANCiAgICBSRVBMQUNFIElOVE8gaW9icm9rZXIudHNfbnVtYmVyIA0KICAgICAgICAoaWQsIHRzLCB2YWwsIGFjaywgX2Zyb20sIHEpIA0KICAgICAgICBWQUxVRVMgKChTRUxFQ1QgaWQgRlJPTSBpb2Jyb2tlci5kYXRhcG9pbnRzIFdIRVJFIG5hbWUgPSAiJHtpZH0iKSwgJHt0c30sICR7dmFsdWV9LCAke2Fja30sICR7ZnJvbX0sICR7cX0pDQpgDQovL2xvZyhzdGF0ZW1lbnQpDQpzZW5kVG8oInNxbC4wIiwgInF1ZXJ5Iiwgc3RhdGVtZW50LCBlID0+IHsNCiAgICBpZiAoZSAmJiBlLmVycm9yKSB7DQogICAgICAgIGxvZyhlLmVycm9yKQ0KICAgIH0gZWxzZSB7DQogICAgICAgIC8vIGxvZygiRG9uZSEiKQ0KICAgIH0NCn0p</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="YKZ7]x,bTzIFH|2uVS[r" x="113" y="-137"> <mutation statements="false"> <arg name="x" varid="xr?C%:}F%HR,+baC%W8n"></arg> </mutation> <field name="NAME">ReplaceDot</field> <field name="SCRIPT">cmV0dXJuIHgucmVwbGFjZSgiLiIsIiIpOw==</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="f5+e$i!@hdFdP7[JA1^`" x="113" y="-87"> <mutation statements="false"> <arg name="x" varid="xr?C%:}F%HR,+baC%W8n"></arg> </mutation> <field name="NAME">ReplaceHyphen</field> <field name="SCRIPT">cmV0dXJuIHgucmVwbGFjZSgiLy0vZyIsIi4iKTs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomnoreturn" id="m.]d6DR4hIR|rhM`P3KU" x="113" y="-37"> <mutation statements="false"> <arg name="myIdDeleteAll" varid="eF:WEr]2Ns:niv]0A2?4"></arg> </mutation> <field name="NAME">SendTo_SQL_deleteAll</field> <field name="SCRIPT">Ly8gQWxsZXMgbMO2c2NoZW4NCnNlbmRUbygic3FsLjAiLCAiZGVsZXRlQWxsIiwgew0KICAgIC8vICJpZCI6ICcwX3VzZXJkYXRhLjAuU29sYXJhbmxhZ2UucHZmb3JlY2FzdCcsDQogICAgImlkIjogbXlJZERlbGV0ZUFsbCwNCn0sIGFzeW5jIGZ1bmN0aW9uIChyZXN1bHQpIHsNCiAgICAgIC8vY29uc29sZS5sb2cocmVzdWx0KTsNCn0pOw0K</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="comment" id="emF90N[xA].w:e$0a5`A" x="113" y="38"> <field name="COMMENT">Trigger auf den Datenpunkt JSONTable der</field> <next> <block type="comment" id="v|g5R@PBSlfR{}gqtWR1"> <field name="COMMENT">gewünschten Anlage</field> <next> <block type="variables_set" id="=.d:q6Z9kw}YcA[{UFd%"> <field name="VAR" id="x_DyQchZBQppJ/pt(CT@">dp_Forecast_Total</field> <value name="VALUE"> <block type="text" id=":/qWf7vbtQAICtz`.S?4"> <field name="TEXT">0_userdata.0.Solaranlage.pvforecasts.Solcast.Total</field> </block> </value> <next> <block type="variables_set" id="IK$-$m]~F![8fw3OLm2r"> <field name="VAR" id="!X-*UNPMzEuy~Y#t}/dN">dp_Forecast_600W</field> <value name="VALUE"> <block type="text" id="-u)LAh^;Kq(U?ig^gOnf"> <field name="TEXT">0_userdata.0.Solaranlage.pvforecasts.Solcast.600W</field> </block> </value> <next> <block type="variables_set" id="6Kgq}f.=V17oN[J@}GGc"> <field name="VAR" id="h*oloiz8h?C|3%]5[3Cq">dp_Forecast_1500W</field> <value name="VALUE"> <block type="text" id="n86DG8x|zDoT5fy[Ip^t"> <field name="TEXT">0_userdata.0.Solaranlage.pvforecasts.Solcast.1500W</field> </block> </value> <next> <block type="variables_set" id="P1X]es{93Kucl24mJ=I^"> <field name="VAR" id="k`SXM[H%$|.V$:XshBb~">dp_Forecast_Hauswand</field> <value name="VALUE"> <block type="text" id="V=O+]TPBae4wz1d.rI4Q"> <field name="TEXT">0_userdata.0.Solaranlage.pvforecasts.Solcast.Hauswand</field> </block> </value> <next> <block type="on_ext" id="2}81gNSPn48mxt-C32N3"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="$fUC/kgh^7[pBZjds,[N"> <field name="oid">default</field> </shadow> <block type="text" id="Q~[~L7`?jff9w0!|{R!~"> <field name="TEXT">pvforecast.1.summary.JSONTable</field> </block> </value> <statement name="STATEMENT"> <block type="comment" id="xipk,Q4m/$Zbq(9xP]N;"> <field name="COMMENT">Den JSON in eine Variable als Objekt holen</field> <next> <block type="variables_set" id="9le8nB_}E+{=^zh:Futa"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> <value name="VALUE"> <block type="convert_json2object" id="C^`)6e!W4atd.!+{(i`D"> <value name="VALUE"> <block type="get_value_var" id="CX?q]Gc8j[Ks2F4.yc=c"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="Y:eexHcUNi5aP`=sh5_;"> <field name="TEXT"></field> </shadow> <block type="text" id="2yV92%k{c@aR$t@FV|VK"> <field name="TEXT">pvforecast.1.summary.JSONTable</field> </block> </value> </block> </value> </block> </value> <next> <block type="comment" id="78{/(q^zo:Vm3)}YeMKs"> <field name="COMMENT">Den JSON nochmal als Liste</field> <next> <block type="variables_set" id="$C:;|F_ENe?Kc{f9E*tE"> <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field> <value name="VALUE"> <block type="lists_split" id=":4[[9BsVwSu-#SFS/qp#"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="get_value_var" id="k${_LxJlQ~Jc%^8mQ;J3"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="b~A-z_Llc)xn3cRp?%BP"> <field name="TEXT"></field> </shadow> <block type="text" id="@(LLEO9DcZC_107PY7e;"> <field name="TEXT">pvforecast.1.summary.JSONTable</field> </block> </value> </block> </value> <value name="DELIM"> <shadow type="text" id="_=ir)--C~K.5!,@3!%@4"> <field name="TEXT">},</field> </shadow> </value> </block> </value> <next> <block type="comment" id="_dDWRwqorhv|K4r20+CF"> <field name="COMMENT">Zähler für die einzelnen Werte</field> <next> <block type="variables_set" id="w[HNQFZ(pKC;(LonsppG"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> <value name="VALUE"> <block type="math_number" id="$YD#)Z6].!0wU8:!IFY-"> <field name="NUM">-1</field> </block> </value> <next> <block type="comment" id="nON/.IM*.X5L7BSfqn.j"> <field name="COMMENT">Vorherige Werte löschen</field> <next> <block type="comment" id="+UxP]UFX*K*Ay8@+.3D("> <field name="COMMENT">Kurz warten ...</field> <next> <block type="timeouts_wait" id="b#[5BCU4#vD.+@RIgxwr"> <field name="DELAY">2</field> <field name="UNIT">sec</field> <next> <block type="comment" id="?qlG@bV1nj7K%h8?`S-h"> <field name="COMMENT">Die Werte abarbeiten:</field> <next> <block type="controls_forEach" id="sZ%NhNSxC10sAg@O]Kz6"> <field name="VAR" id="9[xS=sH).DKBS8oGN@cs">i</field> <value name="LIST"> <block type="variables_get" id="psB3RQ42dmHy[=aKrs!2"> <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field> </block> </value> <statement name="DO"> <block type="comment" id="0i?Xu2@hUv,g4?;i5Fhl"> <field name="COMMENT">Wird beim ersten mal 0 sein</field> <next> <block type="math_change" id="liet[5#L@~`I]t{8:/Es"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> <value name="DELTA"> <shadow type="math_number" id="986qLvCF[J2VK^no0@Rp"> <field name="NUM">1</field> </shadow> </value> <next> <block type="comment" id="}fPI/Q;fVu7V-uYuX2I+"> <field name="COMMENT">Wir arbeiten die Liste ab, nutzen aber das Objekt!</field> <next> <block type="variables_set" id="^w);@i_kdtjWWf?c}BcO"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> <value name="VALUE"> <block type="get_attr" id="jTRbW_-wI4-}.!,5V(VJ"> <value name="PATH"> <shadow type="text" id="3r`W9/~ToEj{Abx:)agx"> <field name="TEXT"></field> </shadow> <block type="text_join" id="xoFmSb~Y+xnD;cvM|g;-"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="K9;4LQ$1S/`at#YY52.j"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="Kkt8qVr.ykp~NV;@{Uas"> <field name="TEXT">.Time</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="`-rw74I`kqylUWgeH*+("> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> <next> <block type="comment" id="b?]P+H9BwqfkDRv$/:j("> <field name="COMMENT">Die - in . umwandeln</field> <next> <block type="variables_set" id="k@v15A-cYpf/vbpRa;_z"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="p[kw(;yI)pXBjjzD#D)~"> <mutation name="ReplaceHyphen"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="N)h=(1TR`.9#96=m?A0Y"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> </block> </value> <next> <block type="comment" id="I-6Pjzc2in5fU|/L@xLT"> <field name="COMMENT">In ein Datum-Objekt umwandeln</field> <next> <block type="variables_set" id="FsILBORsaLrrazBi1L)J"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> <value name="VALUE"> <block type="convert_from_date" id="4bbw}ZJhpHe}e.*nJ0`M"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="variables_get" id="RjC;=Ac;nPHFrHCNt$SG"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> </block> </value> <next> <block type="comment" id="?/.AjS+{19mE_EhC6?{%"> <field name="COMMENT">Leistungswerte holen</field> <next> <block type="variables_set" id="7$e1=Z.||tt-}b}$`QUX"> <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistungTotal</field> <value name="VALUE"> <block type="convert_tonumber" id="67IrRL?P*p~@Pjf(+`|m"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="7gdr}E~K1^E%nReKXCTg"> <mutation name="ReplaceDot"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="!p(Q2{*u/U@(LdLaWO;s"> <value name="PATH"> <shadow type="text" id="ggA,%baz5EZSCeRgC3aH"> <field name="TEXT"></field> </shadow> <block type="text_join" id="eO+Kc@J#5ncJexgCa;XG"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="6h@/w;v+5fJ:2k^fRu$`"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="u;lW,EMq1lo;0wl@^s~Z"> <field name="TEXT">.Total</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id=":wC%m_*5#kUmjSCtRht*"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Bs]rzL5Ou(TgO8/9n(?c"> <field name="VAR" id="Qc{Jo]quM_J722)2(/*i">tempLeistung600W</field> <value name="VALUE"> <block type="convert_tonumber" id="tMmS$h!@}Ow%t)=ItX0,"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="d8ICH/{6V[$h=0#xy+i^"> <mutation name="ReplaceDot"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="]yk~Vja4R|8vn@1,V]/O"> <value name="PATH"> <shadow type="text" id="S|8FNN7w6)sBHuhiephR"> <field name="TEXT"></field> </shadow> <block type="text_join" id="50|S}#qaQ?XsjIlp$eUH"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="89zd[}sNs{07o$(Q`/Wv"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="Q:K|d_%wW60Lz}|pyP,X"> <field name="TEXT">.600W</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="en([*{/z)4M*6nR%,jHM"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="$)=NIW?*GSOI0w3#RDEO"> <value name="IF0"> <block type="logic_compare" id="XYxd?dYJf^B{]#%hE=qp"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="alwHr.*jhF:+_2Bi}/7x"> <field name="VAR" id="Qc{Jo]quM_J722)2(/*i">tempLeistung600W</field> </block> </value> <value name="B"> <block type="math_number" id="GWQ$f$PbD,ZiL(#m6zv5"> <field name="NUM">600</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="=j~?EUOw{ljNgg/5=k14"> <field name="VAR" id="Qc{Jo]quM_J722)2(/*i">tempLeistung600W</field> <value name="VALUE"> <block type="math_number" id="BpfPA`%jOdP7i~`lf|C`"> <field name="NUM">600</field> </block> </value> </block> </statement> <next> <block type="variables_set" id="Mp4GDYK;xvbK@n576Yy?"> <field name="VAR" id="K=U*Y1p=yxx7@Aa0B%fF">tempLeistung1500W</field> <value name="VALUE"> <block type="convert_tonumber" id="a*T|Owt=NGz9W*4ujNWj"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="kK^bm09m=[fY^nV0#hoF"> <mutation name="ReplaceDot"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="`5$IYI^Zeeey;D=BYZnd"> <value name="PATH"> <shadow type="text" id=";l/nP9x^KvI%[JnJ)s$X"> <field name="TEXT"></field> </shadow> <block type="text_join" id="cA/PU=3^w:?8$g$+wB|M"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="UpPZ@/t|p48k|ht/E+5~"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="0iHajUG]UFRG)Ugqgj)r"> <field name="TEXT">.1500W</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="BkEQO(9;9k2t3pDC3,)u"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="dDP%7/_4$3(?`ZgW@K/="> <field name="VAR" id="WVv5bH~8]ZEzMqXNtKo}">tempLeistungHauswand</field> <value name="VALUE"> <block type="convert_tonumber" id="L_=5F.LmPp28n^yhP1uE"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="7+|SlQ;vx$cy5P~_cpj{"> <mutation name="ReplaceDot"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="Srn~Id`D|M8MtYJMpN)o"> <value name="PATH"> <shadow type="text" id="Nhr{*~QV%](7jVhrG72%"> <field name="TEXT"></field> </shadow> <block type="text_join" id="rs,s@r6:Av`@0km1dD$3"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="M%OACy-n7epajBiAX|.H"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="/PUr~Cp0Vkjd$LIK^L/|"> <field name="TEXT">.Hauswand</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="1aiVhMcR_`xhlDl=M8uj"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="comment" id=".r}c.6$[JDf=.|#00pZj"> <field name="COMMENT">Und in die Datenbank schreiben</field> <next> <block type="procedures_callcustomnoreturn" id="JoDo6nn!){b@{QRXrB[u" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="mHi3(RLor?[/?$+Xplx-"> <field name="VAR" id="x_DyQchZBQppJ/pt(CT@">dp_Forecast_Total</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="5jX#X}JXg$NzrHHpJ@eX"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="o0=yzbg$L5|F}X9^8G{A"> <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistungTotal</field> </block> </value> <value name="ARG3"> <block type="math_number" id="20UH^hgYc(x[ff8AFLg="> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id=";^6heBy3kPnz_;P0++$P"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id="eWLzW-vnc1F%*khHrZb{"> <field name="NUM">0</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="M^AAkuV`a@Z.)aHzF*cS" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="5);}w+nl3mmT2P1)PfZv"> <field name="VAR" id="!X-*UNPMzEuy~Y#t}/dN">dp_Forecast_600W</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="r(_ZS`H9#9L[XZBs,r2o"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="PVq;+vyh]6](gm[cMdG{"> <field name="VAR" id="Qc{Jo]quM_J722)2(/*i">tempLeistung600W</field> </block> </value> <value name="ARG3"> <block type="math_number" id="`F,$`peh0`2grx8z0C{I"> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id="F,vah,1EQo9C4e6~J:(n"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id=";,x`))M,iJvBaeR@3UPZ"> <field name="NUM">0</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="]gn.y|sQ_AR:A0hlX:I`" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="E_/YoyEzmMkO#~v}Oz?g"> <field name="VAR" id="h*oloiz8h?C|3%]5[3Cq">dp_Forecast_1500W</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="mj~@)|)%2b?bTck?|jdy"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="vDMFCpgb]G!dPK@8Jga~"> <field name="VAR" id="K=U*Y1p=yxx7@Aa0B%fF">tempLeistung1500W</field> </block> </value> <value name="ARG3"> <block type="math_number" id="rk$(1qOLf=N6Bgx2].dJ"> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id="q2@SS]g~!uMO7;#,p0^9"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id="{BwPv%I|5?rp%2JaHUax"> <field name="NUM">0</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="rk9H4%ii-AO+dU=*qrhF" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="A_6FC?_BQ!YfC!V0UlWR"> <field name="VAR" id="k`SXM[H%$|.V$:XshBb~">dp_Forecast_Hauswand</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="YB@{-PlD^a*2cPAyQITI"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="O-aa^!:n5BY0+jyC0yDQ"> <field name="VAR" id="WVv5bH~8]ZEzMqXNtKo}">tempLeistungHauswand</field> </block> </value> <value name="ARG3"> <block type="math_number" id="#mMx23QuBu_8(dqf7Hc("> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id="g_u8h1=!Hq8k_-5Oqw05"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id="xq9CX(K_$dp[Le-+Y:ew"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </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> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
Das Wertet meine 3 Anlagen aus (600W, 1500W und Hauswand) und schreibt deren Vorhersagen in 3 Datenpunkte + Total
Die Zieldatenpunkte musst du anlegen / anpassen, nicht vergessen die History dafür zu aktivieren. Und mal mindestens, ggf, von Hand, ein zwei Werte reinschreiben damit das SQL auch aktiv ist.Da sind deaktivierte Elemente drin (meine ersten Versuche), die kannst du auch einfach ganz raus löschen
-
@bananajoe Wow - vielen lieben Dank für das Blockly! Das erspart mir unglaublich viel Arbeit. Ich habe das Blockly gerade an meine Anlage angepasst und da sind zwei Fragen aufgetreten:
-
Das hier kann vermutlich raus, oder?
-
Die Funktion wird dann auch nicht mehr gebraucht, stimmt's?
-
-
@guitardoc ...und gleich noch eine Frage: Muss ich irgendwo noch was einstellen? Ich bekomme diesen Fehler:
javascript.0 2024-04-12 11:00:02.271 info script.js.common.Solaranlage.Vorhersage: Error: INSERT, DELETE command denied to user 'mn'@'localhost' for table `iobroker`.`ts_number`
EDIT: Habs schon gefunden. Meine DB heißt anders. Jaja, man muss jeden Wert prüfen...
-
So, ich habe das Script mal ein bisschen aufgeräumt und an meine beiden Anlagenhälften angepasst:
Was ich aber nicht hinbekomme - es werden bei den Leistungswerten nicht die Nachkommastellen mit geschrieben. Ist das bei dir auch so?
-
Ich habs raus. In deinem Script ist ein Fehler. Es muss das Komma durch einen Punkt ersetzt und dann in die Zahl umgewandelt werden:
Hier noch der Export:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="RtPM2%k{F`%!q{Rk]|a.">id</variable> <variable id=";!)T*gf?`G!J~iZ#4,CG">ts</variable> <variable id="epT$}5hcYx3b^`jz:~#d">value</variable> <variable id="GAGtL,+-C3?x`s;u1nsR">ack</variable> <variable id="rHJp6FCFj,U],$ysF[xX">from</variable> <variable id="p~yp5Fejp5Y|*K$i[(u%">q</variable> <variable id="xr?C%:}F%HR,+baC%W8n">x</variable> <variable id="x_DyQchZBQppJ/pt(CT@">Vorhersage Gesamt</variable> <variable id="!X-*UNPMzEuy~Y#t}/dN">Vorhersage Ostseite</variable> <variable id="h*oloiz8h?C|3%]5[3Cq">Vorhersage Westseite</variable> <variable id="B$n_|Lt?V?dltG$1=%U!">JSONTable</variable> <variable id="zqSSt1.lPBrP!prtJp:[">JSONListe</variable> <variable id="[,noZ+!#R([v)Vli[JAC">counter</variable> <variable id="9[xS=sH).DKBS8oGN@cs">i</variable> <variable id="tkH#qcE=H5/_7~OttW5(">tempDatum</variable> <variable id="f=MX5bxXCe`#`$z~HXcG">tempLeistungGesamt</variable> <variable id="Qc{Jo]quM_J722)2(/*i">tempLeistungOstseite</variable> <variable id="K=U*Y1p=yxx7@Aa0B%fF">tempLeistungWestseite</variable> </variables> <block type="procedures_defcustomnoreturn" id="[lJ0qqv1Jj`[:vUDk9xI" x="113" y="-187"> <mutation statements="false"> <arg name="id" varid="RtPM2%k{F`%!q{Rk]|a."></arg> <arg name="ts" varid=";!)T*gf?`G!J~iZ#4,CG"></arg> <arg name="value" varid="epT$}5hcYx3b^`jz:~#d"></arg> <arg name="ack" varid="GAGtL,+-C3?x`s;u1nsR"></arg> <arg name="from" varid="rHJp6FCFj,U],$ysF[xX"></arg> <arg name="q" varid="p~yp5Fejp5Y|*K$i[(u%"></arg> </mutation> <field name="NAME">InsertToHistory2</field> <field name="SCRIPT">bGV0IHN0YXRlbWVudCA9IGANCiAgICBSRVBMQUNFIElOVE8gaW9icm9rZXIudHNfbnVtYmVyIA0KICAgICAgICAoaWQsIHRzLCB2YWwsIGFjaywgX2Zyb20sIHEpIA0KICAgICAgICBWQUxVRVMgKChTRUxFQ1QgaWQgRlJPTSBpb2Jyb2tlci5kYXRhcG9pbnRzIFdIRVJFIG5hbWUgPSAiJHtpZH0iKSwgJHt0c30sICR7dmFsdWV9LCAke2Fja30sICR7ZnJvbX0sICR7cX0pDQpgDQovL2xvZyhzdGF0ZW1lbnQpDQpzZW5kVG8oInNxbC4wIiwgInF1ZXJ5Iiwgc3RhdGVtZW50LCBlID0+IHsNCiAgICBpZiAoZSAmJiBlLmVycm9yKSB7DQogICAgICAgIGxvZyhlLmVycm9yKQ0KICAgIH0gZWxzZSB7DQogICAgICAgIC8vIGxvZygiRG9uZSEiKQ0KICAgIH0NCn0p</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id="YKZ7]x,bTzIFH|2uVS[r" x="113" y="238"> <mutation statements="false"> <arg name="x" varid="xr?C%:}F%HR,+baC%W8n"></arg> </mutation> <field name="NAME">ReplaceKomma</field> <field name="SCRIPT">cmV0dXJuIHgucmVwbGFjZSgiLCIsIi4iKTs=</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomnoreturn" id="ppt|ajrQncolYtqyk1q1" x="113" y="263"> <mutation statements="false"> <arg name="id" varid="RtPM2%k{F`%!q{Rk]|a."></arg> <arg name="ts" varid=";!)T*gf?`G!J~iZ#4,CG"></arg> <arg name="value" varid="epT$}5hcYx3b^`jz:~#d"></arg> <arg name="ack" varid="GAGtL,+-C3?x`s;u1nsR"></arg> <arg name="from" varid="rHJp6FCFj,U],$ysF[xX"></arg> <arg name="q" varid="p~yp5Fejp5Y|*K$i[(u%"></arg> </mutation> <field name="NAME">InsertToHistory</field> <field name="SCRIPT">bGV0IHN0YXRlbWVudCA9IGANCiAgICBSRVBMQUNFIElOVE8gREJpb0Jyb2tlci50c19udW1iZXIgDQogICAgICAgIChpZCwgdHMsIHZhbCwgYWNrLCBfZnJvbSwgcSkgDQogICAgICAgIFZBTFVFUyAoKFNFTEVDVCBpZCBGUk9NIERCaW9Ccm9rZXIuZGF0YXBvaW50cyBXSEVSRSBuYW1lID0gIiR7aWR9IiksICR7dHN9LCAke3ZhbHVlfSwgJHthY2t9LCAke2Zyb219LCAke3F9KQ0KYA0KLy9sb2coc3RhdGVtZW50KQ0Kc2VuZFRvKCJzcWwuMCIsICJxdWVyeSIsIHN0YXRlbWVudCwgZSA9PiB7DQogICAgaWYgKGUgJiYgZS5lcnJvcikgew0KICAgICAgICBsb2coZS5lcnJvcikNCiAgICB9IGVsc2Ugew0KICAgICAgICAvLyBsb2coIkRvbmUhIikNCiAgICB9DQp9KQ==</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="comment" id="emF90N[xA].w:e$0a5`A" x="113" y="338"> <field name="COMMENT">Trigger auf den Datenpunkt JSONTable der</field> <next> <block type="comment" id="v|g5R@PBSlfR{}gqtWR1"> <field name="COMMENT">gewünschten Anlage</field> <next> <block type="variables_set" id="=.d:q6Z9kw}YcA[{UFd%"> <field name="VAR" id="x_DyQchZBQppJ/pt(CT@">Vorhersage Gesamt</field> <value name="VALUE"> <block type="text" id=":/qWf7vbtQAICtz`.S?4"> <field name="TEXT">0_userdata.0.Solaranlage.Vorhersage_Gesamt</field> </block> </value> <next> <block type="variables_set" id="IK$-$m]~F![8fw3OLm2r"> <field name="VAR" id="!X-*UNPMzEuy~Y#t}/dN">Vorhersage Ostseite</field> <value name="VALUE"> <block type="text" id="-u)LAh^;Kq(U?ig^gOnf"> <field name="TEXT">0_userdata.0.Solaranlage.Vorhersage_Ostseite</field> </block> </value> <next> <block type="variables_set" id="6Kgq}f.=V17oN[J@}GGc"> <field name="VAR" id="h*oloiz8h?C|3%]5[3Cq">Vorhersage Westseite</field> <value name="VALUE"> <block type="text" id="n86DG8x|zDoT5fy[Ip^t"> <field name="TEXT">0_userdata.0.Solaranlage.Vorhersage_Westseite</field> </block> </value> <next> <block type="on_ext" id="2}81gNSPn48mxt-C32N3"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="$fUC/kgh^7[pBZjds,[N"> <field name="oid">default</field> </shadow> <block type="text" id="Q~[~L7`?jff9w0!|{R!~"> <field name="TEXT">alias.0.Solaranlage.Vorhersage</field> </block> </value> <value name="OID1"> <shadow type="field_oid" id="o0(8S_tLD6f|3N,ENOvo"> <field name="oid">0_userdata.0.Test.Test</field> </shadow> </value> <statement name="STATEMENT"> <block type="comment" id="xipk,Q4m/$Zbq(9xP]N;"> <field name="COMMENT">Den JSON in eine Variable als Objekt holen</field> <next> <block type="variables_set" id="9le8nB_}E+{=^zh:Futa"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> <value name="VALUE"> <block type="convert_json2object" id="C^`)6e!W4atd.!+{(i`D"> <value name="VALUE"> <block type="get_value_var" id="CX?q]Gc8j[Ks2F4.yc=c"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="Y:eexHcUNi5aP`=sh5_;"> <field name="TEXT"></field> </shadow> <block type="text" id="2yV92%k{c@aR$t@FV|VK"> <field name="TEXT">alias.0.Solaranlage.Vorhersage</field> </block> </value> </block> </value> </block> </value> <next> <block type="comment" id="78{/(q^zo:Vm3)}YeMKs"> <field name="COMMENT">Den JSON nochmal als Liste</field> <next> <block type="variables_set" id="$C:;|F_ENe?Kc{f9E*tE"> <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field> <value name="VALUE"> <block type="lists_split" id=":4[[9BsVwSu-#SFS/qp#"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="get_value_var" id="k${_LxJlQ~Jc%^8mQ;J3"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="b~A-z_Llc)xn3cRp?%BP"> <field name="TEXT"></field> </shadow> <block type="text" id="6mu32=NYAYv/,!D)z{/}"> <field name="TEXT">alias.0.Solaranlage.Vorhersage</field> </block> </value> </block> </value> <value name="DELIM"> <shadow type="text" id="_=ir)--C~K.5!,@3!%@4"> <field name="TEXT">},</field> </shadow> </value> </block> </value> <next> <block type="comment" id="_dDWRwqorhv|K4r20+CF"> <field name="COMMENT">Zähler für die einzelnen Werte</field> <next> <block type="variables_set" id="w[HNQFZ(pKC;(LonsppG"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> <value name="VALUE"> <block type="math_number" id="$YD#)Z6].!0wU8:!IFY-"> <field name="NUM">-1</field> </block> </value> <next> <block type="comment" id="?qlG@bV1nj7K%h8?`S-h"> <field name="COMMENT">Die Werte abarbeiten:</field> <next> <block type="controls_forEach" id="sZ%NhNSxC10sAg@O]Kz6"> <field name="VAR" id="9[xS=sH).DKBS8oGN@cs">i</field> <value name="LIST"> <block type="variables_get" id="psB3RQ42dmHy[=aKrs!2"> <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field> </block> </value> <statement name="DO"> <block type="comment" id="0i?Xu2@hUv,g4?;i5Fhl"> <field name="COMMENT">Wird beim ersten mal 0 sein</field> <next> <block type="math_change" id="liet[5#L@~`I]t{8:/Es"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> <value name="DELTA"> <shadow type="math_number" id="986qLvCF[J2VK^no0@Rp"> <field name="NUM">1</field> </shadow> </value> <next> <block type="comment" id="}fPI/Q;fVu7V-uYuX2I+"> <field name="COMMENT">Wir arbeiten die Liste ab, nutzen aber das Objekt!</field> <next> <block type="comment" id="I-6Pjzc2in5fU|/L@xLT"> <field name="COMMENT">Datumswert holen</field> <next> <block type="variables_set" id="FsILBORsaLrrazBi1L)J"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> <value name="VALUE"> <block type="convert_to_date" id="n1K6g7EPQNBR4*Wu1]*?"> <value name="VALUE"> <block type="get_attr" id="hL*eFV?33[O=c]gr|@jR"> <value name="PATH"> <shadow type="text" id="ggA,%baz5EZSCeRgC3aH"> <field name="TEXT"></field> </shadow> <block type="text_join" id="Z`JEhZdZQqpb=1l2BDxu"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="tgJC;K$CN5P,s4iPf}7y"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="^}=EZ[8i!ZUbC#VR2nC|"> <field name="TEXT">.Time</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="?E.b5XpnpjOl1+$9GhX("> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> <next> <block type="comment" id="?/.AjS+{19mE_EhC6?{%"> <field name="COMMENT">Leistungswerte holen</field> <next> <block type="variables_set" id="7$e1=Z.||tt-}b}$`QUX"> <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistungGesamt</field> <value name="VALUE"> <block type="convert_tonumber" id="ku0~(,vxcDM7`7]V-cO2"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="+Zx5TzLQZ-AdE[Cw$2oV"> <mutation name="ReplaceKomma"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="!p(Q2{*u/U@(LdLaWO;s"> <value name="PATH"> <shadow type="text" id="ggA,%baz5EZSCeRgC3aH"> <field name="TEXT"></field> </shadow> <block type="text_join" id="eO+Kc@J#5ncJexgCa;XG"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="6h@/w;v+5fJ:2k^fRu$`"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="u;lW,EMq1lo;0wl@^s~Z"> <field name="TEXT">.Total</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id=":wC%m_*5#kUmjSCtRht*"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Bs]rzL5Ou(TgO8/9n(?c"> <field name="VAR" id="Qc{Jo]quM_J722)2(/*i">tempLeistungOstseite</field> <value name="VALUE"> <block type="convert_tonumber" id="BgJ)[eda5=7z7(k]pL/A"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="B84.=TqG1/OjBAyY5Eg."> <mutation name="ReplaceKomma"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="]yk~Vja4R|8vn@1,V]/O"> <value name="PATH"> <shadow type="text" id="S|8FNN7w6)sBHuhiephR"> <field name="TEXT"></field> </shadow> <block type="text_join" id="50|S}#qaQ?XsjIlp$eUH"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="89zd[}sNs{07o$(Q`/Wv"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="Q:K|d_%wW60Lz}|pyP,X"> <field name="TEXT">.Ostseite</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="en([*{/z)4M*6nR%,jHM"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Mp4GDYK;xvbK@n576Yy?"> <field name="VAR" id="K=U*Y1p=yxx7@Aa0B%fF">tempLeistungWestseite</field> <value name="VALUE"> <block type="convert_tonumber" id="X*pL(%q5Y{WvH!|S,x{7"> <value name="VALUE"> <block type="procedures_callcustomreturn" id="p^LF=HtzO[i@4Pk)Q_{b"> <mutation name="ReplaceKomma"> <arg name="x"></arg> </mutation> <value name="ARG0"> <block type="get_attr" id="`5$IYI^Zeeey;D=BYZnd"> <value name="PATH"> <shadow type="text" id=";l/nP9x^KvI%[JnJ)s$X"> <field name="TEXT"></field> </shadow> <block type="text_join" id="cA/PU=3^w:?8$g$+wB|M"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="UpPZ@/t|p48k|ht/E+5~"> <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field> </block> </value> <value name="ADD1"> <block type="text" id="0iHajUG]UFRG)Ugqgj)r"> <field name="TEXT">.Westseite</field> </block> </value> </block> </value> <value name="OBJECT"> <block type="variables_get" id="BkEQO(9;9k2t3pDC3,)u"> <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field> </block> </value> </block> </value> </block> </value> </block> </value> <next> <block type="comment" id=".r}c.6$[JDf=.|#00pZj"> <field name="COMMENT">Und in die Datenbank schreiben</field> <next> <block type="procedures_callcustomnoreturn" id="JoDo6nn!){b@{QRXrB[u" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="mHi3(RLor?[/?$+Xplx-"> <field name="VAR" id="x_DyQchZBQppJ/pt(CT@">Vorhersage Gesamt</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="5jX#X}JXg$NzrHHpJ@eX"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="o0=yzbg$L5|F}X9^8G{A"> <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistungGesamt</field> </block> </value> <value name="ARG3"> <block type="math_number" id="20UH^hgYc(x[ff8AFLg="> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id=";^6heBy3kPnz_;P0++$P"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id="eWLzW-vnc1F%*khHrZb{"> <field name="NUM">0</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="M^AAkuV`a@Z.)aHzF*cS" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="5);}w+nl3mmT2P1)PfZv"> <field name="VAR" id="!X-*UNPMzEuy~Y#t}/dN">Vorhersage Ostseite</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="r(_ZS`H9#9L[XZBs,r2o"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="PVq;+vyh]6](gm[cMdG{"> <field name="VAR" id="Qc{Jo]quM_J722)2(/*i">tempLeistungOstseite</field> </block> </value> <value name="ARG3"> <block type="math_number" id="`F,$`peh0`2grx8z0C{I"> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id="F,vah,1EQo9C4e6~J:(n"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id=";,x`))M,iJvBaeR@3UPZ"> <field name="NUM">0</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="]gn.y|sQ_AR:A0hlX:I`" inline="false"> <mutation name="InsertToHistory"> <arg name="id"></arg> <arg name="ts"></arg> <arg name="value"></arg> <arg name="ack"></arg> <arg name="from"></arg> <arg name="q"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="E_/YoyEzmMkO#~v}Oz?g"> <field name="VAR" id="h*oloiz8h?C|3%]5[3Cq">Vorhersage Westseite</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="mj~@)|)%2b?bTck?|jdy"> <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="vDMFCpgb]G!dPK@8Jga~"> <field name="VAR" id="K=U*Y1p=yxx7@Aa0B%fF">tempLeistungWestseite</field> </block> </value> <value name="ARG3"> <block type="math_number" id="rk$(1qOLf=N6Bgx2].dJ"> <field name="NUM">1</field> </block> </value> <value name="ARG4"> <block type="math_number" id="q2@SS]g~!uMO7;#,p0^9"> <field name="NUM">1</field> </block> </value> <value name="ARG5"> <block type="math_number" id="{BwPv%I|5?rp%2JaHUax"> <field name="NUM">0</field> </block> </value> </block> </next> </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> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
Das Testobjekt kann gelöscht werden - ist bei mir nur ein Trigger um das Script per Hand auszulösen.
-
@guitardoc naja, bei mir steht in Total der Gesamtwert mit 1.000er Trennzeichen:
weil ich das im Adapter so eingestellt habe:
Deshalb habe ich den Punkt durch nichts ersetzt.
War schon eine ganze weile her das ich das gebaut habe. Und wie das so ist fasst man es nicht mehr an wenn es läuft.
Die Löschen Funktion kann weg, ja. Die hatte ich am Anfang genutzt als ich das mit dem Insert+Überschreiben noch nicht hatte, da musste ich vorher löschen. Die Lösung stammt von einem unserer Mitstreiter hier im Forum, müsste sich irgendwo als Thema finden lassen. -
@bananajoe OK, dann passt das ja alles. Ich habe übrigens auch eine Variante gefunden, wie man einzelne Werte mit einem Zeitstempel aus der Zukunft versehen kann - ist eine kleine Abwandlung aus deinem Script mit der Funktion InsertToHistory und funktioniert super:
Die vorhergesagten Werte werden immer 00:00 Uhr auf 0 gesetzt und 23:59 Uhr des Folgetages auf den vorhergesagten Gesamtwert. Da weiß ich dann, welche Stromproduktion bis Ende des Tages laut Prognose erreicht werden müsste.