- ioBroker Community Home
- Deutsch
- Skripten / Logik
- Blockly
- Durchschnitt über Wert aus History
Durchschnitt über Wert aus History
-
Hallo zusammen,
ich habe einen täglichen Autarkie-Wert meiner Solaranlage. Bei diesem ist die History an und wird für 1 Jahr gespeichert.
Wie kann ich (am liebsten mit Blockly) nun den gesammten Mittelwert über die History ausgeben? -
@caravandriver
DEINE ID ersetzen
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="WX[:Tk-|~F2Z[odL2-!]">timeRange</variable> <variable id="gH-;kXfKuQjqeAAq)RR2">end</variable> <variable id="iw:GM1Yv=^4(|dJHog`+">Summe</variable> <variable id="vl)04H}3D;^/v=azk~1i">result</variable> <variable id="Z.VC)8^?qXuW0hD)HGzh">Liste</variable> <variable id="0bVTJYJUF1nDSgr|FqjF">Wert</variable> </variables> <block type="comment" id="Jddp97d8(p]]@YM,JUEf" x="213" y="-13"> <field name="COMMENT">AnzTage*24h*60min*60sec*1000millisec</field> <next> <block type="variables_set" id="{zrregDEN?Me90/1d~lJ"> <field name="VAR" id="WX[:Tk-|~F2Z[odL2-!]">timeRange</field> <value name="VALUE"> <block type="math_arithmetic" id="jk{`:MRK/aD}t|D_=mL}"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="Q-Eba)+]Uzh(pSNP{?Zi"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="K2^6p1?S:Q%5j@JGpn,9"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="7QvW=GTfBDPy=c^q2`u|"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="tISN9oe7GZ.]EZE`k/k$"> <field name="NUM">24</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="+RN6KgRYF.I;QZ]Va4#3"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="0Dev)Rk0M/v6ik/t#cCi"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="1BJXo0-FDwAu!C(Ee)En"> <field name="NUM">3600</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="hDA~ywIKil3qy?X)hD=_"> <field name="NUM">1000</field> </shadow> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Z:{[VL5UGR[U|B7$1SUk"> <field name="VAR" id="gH-;kXfKuQjqeAAq)RR2">end</field> <value name="VALUE"> <block type="time_get" id="@li@ZJIHB2*f:A1.*rk0"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <next> <block type="variables_set" id="XcRsFZHAbPP)3i!]:{R;"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> <value name="VALUE"> <block type="math_number" id="mbu!NGm~ag@1C0@bR,^u"> <field name="NUM">0</field> </block> </value> <next> <block type="sendto_custom" id="zTEsB]|`}*7!=loVr;bb"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="id,options" with_statement="true"></mutation> <field name="INSTANCE">history.0</field> <field name="COMMAND">getHistory</field> <field name="LOG"></field> <field name="WITH_STATEMENT">TRUE</field> <value name="ARG0"> <shadow type="text" id="n$)w3oaKN^+JqxvIop9."> <field name="TEXT">DEINE ID</field> </shadow> </value> <value name="ARG1"> <shadow type="text" id="OAj%c%(l{_^5Ps/#P,l."> <field name="TEXT">{start: end - timeRange,end: end,aggregate: "onchange",ignoreNull: true}</field> </shadow> </value> <statement name="STATEMENT"> <block type="debug" id="l}2aWee;4)rLW(C=)6t?" disabled="true"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="^9Wqkh@C#vjBBfugg_z,"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="^V*)DgZaz+b/`?J.@MyJ"> <field name="VAR" id="vl)04H}3D;^/v=azk~1i">result</field> </block> </value> <next> <block type="variables_set" id="}*sVU;}|4L0;2Sy%Ha(R"> <field name="VAR" id="Z.VC)8^?qXuW0hD)HGzh">Liste</field> <value name="VALUE"> <block type="convert_jsonata" id="y/K+8!;G;(i=4$:m(oD}"> <value name="EXPRESSION"> <shadow type="text" id="gIr5s`CKArLh;Vsu/XOI"> <field name="TEXT">result</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="`3aN!|FL})#Ts?6eu5Nb"> <field name="VAR" id="vl)04H}3D;^/v=azk~1i">result</field> </block> </value> </block> </value> <next> <block type="controls_forEach" id="!5V~~(hgNh4oZs~1--RK"> <field name="VAR" id="0bVTJYJUF1nDSgr|FqjF">Wert</field> <value name="LIST"> <block type="variables_get" id="iVDQ)r4p]J#_t^n32]?9"> <field name="VAR" id="Z.VC)8^?qXuW0hD)HGzh">Liste</field> </block> </value> <statement name="DO"> <block type="math_change" id="p1y9KG/7!$n-}*)CcR|l"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> <value name="DELTA"> <shadow type="math_number" id="v4~EHLd(pixLSUv.;8?u"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="!Hy*1iC=ey?EY;o)_h@g"> <value name="VALUE"> <block type="convert_jsonata" id="mDx0%hy}X2#]A~N=qF*W"> <value name="EXPRESSION"> <shadow type="text" id="]DZeDs3~Gl!6Mz!YtGyI"> <field name="TEXT">val</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="W7L^(fINXEv5f=CaXoY:"> <field name="VAR" id="0bVTJYJUF1nDSgr|FqjF">Wert</field> </block> </value> </block> </value> </block> </value> </block> </statement> <next> <block type="debug" id="uGQn4l{4OQV@2~7Qcd2:"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="spO7GG8y*H5OrJhl}~IH"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="qO8Y4TW#3!r^Z;iJ8ox2"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="2b(YU/$^*Pnts+)^LD4C"> <field name="TEXT">Summe: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="YS$woJ[R`P2_|`w:WY]@"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> </block> </value> </block> </value> <next> <block type="debug" id="=t{JgCN9{x~#*IDelkNS"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="!8de!t!]B=!|r0s/#:E@"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="-FX|Z!(L)xfD)]X?~5cB"> <field name="TEXT">Durchschnitt:</field> </block> </value> <value name="ADD1"> <block type="math_rndfixed" id="(#D@Er#dV!C!Sg~5W`X4"> <field name="n">2</field> <value name="x"> <shadow type="math_number" id="Rz6y+])UUuu[H8+4isq$"> <field name="NUM">3.1234</field> </shadow> <block type="math_arithmetic" id="|Y[v9Terc[=CaA)8+xw`"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="S;7qx!t0MKc2A/BM|44k"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="Erd|8)U[pEqTzHJ}hn!,"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> </block> </value> <value name="B"> <shadow type="math_number" id="~=K{Vc/nTavG6PwWqx~C"> <field name="NUM">1</field> </shadow> <block type="lists_length" id="|;+7~`q*OR7/Qwx|wR5O"> <value name="VALUE"> <block type="variables_get" id=";lm+0#;%Gx2(]ffRD2:t"> <field name="VAR" id="Z.VC)8^?qXuW0hD)HGzh">Liste</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
NUC i7 64GB mit Proxmox ---- Jarvis Infos Aktualisierungen der Doku auf Instagram verfolgen -> mcuiobroker Instagram
Wenn Euch mein Vorschlag geholfen hat, bitte rechts "^" klicken. -
@caravandriver
DEINE ID ersetzen
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="WX[:Tk-|~F2Z[odL2-!]">timeRange</variable> <variable id="gH-;kXfKuQjqeAAq)RR2">end</variable> <variable id="iw:GM1Yv=^4(|dJHog`+">Summe</variable> <variable id="vl)04H}3D;^/v=azk~1i">result</variable> <variable id="Z.VC)8^?qXuW0hD)HGzh">Liste</variable> <variable id="0bVTJYJUF1nDSgr|FqjF">Wert</variable> </variables> <block type="comment" id="Jddp97d8(p]]@YM,JUEf" x="213" y="-13"> <field name="COMMENT">AnzTage*24h*60min*60sec*1000millisec</field> <next> <block type="variables_set" id="{zrregDEN?Me90/1d~lJ"> <field name="VAR" id="WX[:Tk-|~F2Z[odL2-!]">timeRange</field> <value name="VALUE"> <block type="math_arithmetic" id="jk{`:MRK/aD}t|D_=mL}"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="Q-Eba)+]Uzh(pSNP{?Zi"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="K2^6p1?S:Q%5j@JGpn,9"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="7QvW=GTfBDPy=c^q2`u|"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="tISN9oe7GZ.]EZE`k/k$"> <field name="NUM">24</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="+RN6KgRYF.I;QZ]Va4#3"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="0Dev)Rk0M/v6ik/t#cCi"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="1BJXo0-FDwAu!C(Ee)En"> <field name="NUM">3600</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="hDA~ywIKil3qy?X)hD=_"> <field name="NUM">1000</field> </shadow> </value> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="Z:{[VL5UGR[U|B7$1SUk"> <field name="VAR" id="gH-;kXfKuQjqeAAq)RR2">end</field> <value name="VALUE"> <block type="time_get" id="@li@ZJIHB2*f:A1.*rk0"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <next> <block type="variables_set" id="XcRsFZHAbPP)3i!]:{R;"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> <value name="VALUE"> <block type="math_number" id="mbu!NGm~ag@1C0@bR,^u"> <field name="NUM">0</field> </block> </value> <next> <block type="sendto_custom" id="zTEsB]|`}*7!=loVr;bb"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="id,options" with_statement="true"></mutation> <field name="INSTANCE">history.0</field> <field name="COMMAND">getHistory</field> <field name="LOG"></field> <field name="WITH_STATEMENT">TRUE</field> <value name="ARG0"> <shadow type="text" id="n$)w3oaKN^+JqxvIop9."> <field name="TEXT">DEINE ID</field> </shadow> </value> <value name="ARG1"> <shadow type="text" id="OAj%c%(l{_^5Ps/#P,l."> <field name="TEXT">{start: end - timeRange,end: end,aggregate: "onchange",ignoreNull: true}</field> </shadow> </value> <statement name="STATEMENT"> <block type="debug" id="l}2aWee;4)rLW(C=)6t?" disabled="true"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="^9Wqkh@C#vjBBfugg_z,"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="^V*)DgZaz+b/`?J.@MyJ"> <field name="VAR" id="vl)04H}3D;^/v=azk~1i">result</field> </block> </value> <next> <block type="variables_set" id="}*sVU;}|4L0;2Sy%Ha(R"> <field name="VAR" id="Z.VC)8^?qXuW0hD)HGzh">Liste</field> <value name="VALUE"> <block type="convert_jsonata" id="y/K+8!;G;(i=4$:m(oD}"> <value name="EXPRESSION"> <shadow type="text" id="gIr5s`CKArLh;Vsu/XOI"> <field name="TEXT">result</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="`3aN!|FL})#Ts?6eu5Nb"> <field name="VAR" id="vl)04H}3D;^/v=azk~1i">result</field> </block> </value> </block> </value> <next> <block type="controls_forEach" id="!5V~~(hgNh4oZs~1--RK"> <field name="VAR" id="0bVTJYJUF1nDSgr|FqjF">Wert</field> <value name="LIST"> <block type="variables_get" id="iVDQ)r4p]J#_t^n32]?9"> <field name="VAR" id="Z.VC)8^?qXuW0hD)HGzh">Liste</field> </block> </value> <statement name="DO"> <block type="math_change" id="p1y9KG/7!$n-}*)CcR|l"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> <value name="DELTA"> <shadow type="math_number" id="v4~EHLd(pixLSUv.;8?u"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="!Hy*1iC=ey?EY;o)_h@g"> <value name="VALUE"> <block type="convert_jsonata" id="mDx0%hy}X2#]A~N=qF*W"> <value name="EXPRESSION"> <shadow type="text" id="]DZeDs3~Gl!6Mz!YtGyI"> <field name="TEXT">val</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="W7L^(fINXEv5f=CaXoY:"> <field name="VAR" id="0bVTJYJUF1nDSgr|FqjF">Wert</field> </block> </value> </block> </value> </block> </value> </block> </statement> <next> <block type="debug" id="uGQn4l{4OQV@2~7Qcd2:"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="spO7GG8y*H5OrJhl}~IH"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="qO8Y4TW#3!r^Z;iJ8ox2"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="2b(YU/$^*Pnts+)^LD4C"> <field name="TEXT">Summe: </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="YS$woJ[R`P2_|`w:WY]@"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> </block> </value> </block> </value> <next> <block type="debug" id="=t{JgCN9{x~#*IDelkNS"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="!8de!t!]B=!|r0s/#:E@"> <mutation items="2"></mutation> <value name="ADD0"> <block type="text" id="-FX|Z!(L)xfD)]X?~5cB"> <field name="TEXT">Durchschnitt:</field> </block> </value> <value name="ADD1"> <block type="math_rndfixed" id="(#D@Er#dV!C!Sg~5W`X4"> <field name="n">2</field> <value name="x"> <shadow type="math_number" id="Rz6y+])UUuu[H8+4isq$"> <field name="NUM">3.1234</field> </shadow> <block type="math_arithmetic" id="|Y[v9Terc[=CaA)8+xw`"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="S;7qx!t0MKc2A/BM|44k"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="Erd|8)U[pEqTzHJ}hn!,"> <field name="VAR" id="iw:GM1Yv=^4(|dJHog`+">Summe</field> </block> </value> <value name="B"> <shadow type="math_number" id="~=K{Vc/nTavG6PwWqx~C"> <field name="NUM">1</field> </shadow> <block type="lists_length" id="|;+7~`q*OR7/Qwx|wR5O"> <value name="VALUE"> <block type="variables_get" id=";lm+0#;%Gx2(]ffRD2:t"> <field name="VAR" id="Z.VC)8^?qXuW0hD)HGzh">Liste</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden