Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Schieberegister für gleitenden Mittelwert Smartmeter

    NEWS

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    Schieberegister für gleitenden Mittelwert Smartmeter

    This topic has been deleted. Only users with topic management privileges can see it.
    • U
      UwesSmartHome last edited by UwesSmartHome

      Hallo,

      der gleitende Mittelwert ist mit blockly möglich. Hiermit kann man z.B. die recht häufigen Smartmeter Werte beruhigen.
      Habe 10 Werte angelegt und diese schiebt das Script dann durch bis sie hinten wieder "runterfallen".
      0599c22c-c9ac-44c0-ac92-17e14d828b7f-image.png

      U 1 Reply Last reply Reply Quote 0
      • U
        UwesSmartHome @UwesSmartHome last edited by Homoran

        <xml xmlns="https://developers.google.com/blockly/xml">
         <variables>
           <variable id="s2mC7-7N|ALEh.Io}9rV">10th</variable>
           <variable id="D=jARPkr+qrMi7-)w=1u">9th</variable>
           <variable id="Tg3E9)ZPmbROaS+|*@FV">8th</variable>
           <variable id="AV:lS*1+8,;%f-NKchS$">7th</variable>
           <variable id="9yO0u8_@!y1m-5b_wkyE">6th</variable>
           <variable id="QraX}+^E~r~2(d0x4`9g">5th</variable>
           <variable id="oio=zjEIiTyzvlu8WOXn">4th</variable>
           <variable id="Gv!D!pu4xtPryuoqLv*C">3rd</variable>
           <variable id="JjS$g?rzdQfb(ahmdPzQ">2nd</variable>
           <variable id=";Ff?1PdSbk,C.-Vm@JTG">1st</variable>
           <variable type="timeout" id="timeout10">timeout10</variable>
         </variables>
         <block type="on_ext" id="Lg(z9yj`}M_CYiiIux$K" x="-687" y="63">
           <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="DzPRt89XW@nhkjV6Y;=-">
               <field name="oid">smartmeter.0.1-0:16_7_0__255.value</field>
             </shadow>
           </value>
           <statement name="STATEMENT">
             <block type="variables_set" id="X0spX2Fa,C!qxAw0?V{?">
               <field name="VAR" id="s2mC7-7N|ALEh.Io}9rV">10th</field>
               <value name="VALUE">
                 <block type="variables_get" id="_nj9x@6U$gr^lq6{|DUP">
                   <field name="VAR" id="D=jARPkr+qrMi7-)w=1u">9th</field>
                 </block>
               </value>
               <next>
                 <block type="variables_set" id="aL;@v$b1)*|M.UFr-0WA">
                   <field name="VAR" id="D=jARPkr+qrMi7-)w=1u">9th</field>
                   <value name="VALUE">
                     <block type="variables_get" id="vZ[4A9shcS-v/o+0$DPO">
                       <field name="VAR" id="Tg3E9)ZPmbROaS+|*@FV">8th</field>
                     </block>
                   </value>
                   <next>
                     <block type="variables_set" id="pIl9@1v@?B`s4V:j-(s-">
                       <field name="VAR" id="Tg3E9)ZPmbROaS+|*@FV">8th</field>
                       <value name="VALUE">
                         <block type="variables_get" id="X*Y,y[*k${xf$m(pmVb*">
                           <field name="VAR" id="AV:lS*1+8,;%f-NKchS$">7th</field>
                         </block>
                       </value>
                       <next>
                         <block type="variables_set" id="O:?L:y%lH`J}0zpQ};(f">
                           <field name="VAR" id="AV:lS*1+8,;%f-NKchS$">7th</field>
                           <value name="VALUE">
                             <block type="variables_get" id="5OtdAN/):qH-pDMIqv3g">
                               <field name="VAR" id="9yO0u8_@!y1m-5b_wkyE">6th</field>
                             </block>
                           </value>
                           <next>
                             <block type="variables_set" id="#I=t{/`~We*kRo-G.|[m">
                               <field name="VAR" id="9yO0u8_@!y1m-5b_wkyE">6th</field>
                               <value name="VALUE">
                                 <block type="variables_get" id="sP2[7Sr8y;I@r2pIY+KJ">
                                   <field name="VAR" id="QraX}+^E~r~2(d0x4`9g">5th</field>
                                 </block>
                               </value>
                               <next>
                                 <block type="variables_set" id="YArx@2ES7A)A[Ookv{W8">
                                   <field name="VAR" id="QraX}+^E~r~2(d0x4`9g">5th</field>
                                   <value name="VALUE">
                                     <block type="variables_get" id="tk]tc6aX,JpPV[Xj-9q3">
                                       <field name="VAR" id="oio=zjEIiTyzvlu8WOXn">4th</field>
                                     </block>
                                   </value>
                                   <next>
                                     <block type="variables_set" id="@4mS2*L^C$m.TA~RM,5p">
                                       <field name="VAR" id="oio=zjEIiTyzvlu8WOXn">4th</field>
                                       <value name="VALUE">
                                         <block type="variables_get" id="jm3:Ov+3rqzA84`4cMJa">
                                           <field name="VAR" id="Gv!D!pu4xtPryuoqLv*C">3rd</field>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="variables_set" id="1qj69l1g{LNTs~Mw|gYD">
                                           <field name="VAR" id="Gv!D!pu4xtPryuoqLv*C">3rd</field>
                                           <value name="VALUE">
                                             <block type="variables_get" id="m?F#YTb;g41/jO(j{0_S">
                                               <field name="VAR" id="JjS$g?rzdQfb(ahmdPzQ">2nd</field>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id="tR!!URgwaH~IfZ7ggks)">
                                               <field name="VAR" id="JjS$g?rzdQfb(ahmdPzQ">2nd</field>
                                               <value name="VALUE">
                                                 <block type="variables_get" id="4Wq5#Z3qrs3Z8UopHP.,">
                                                   <field name="VAR" id=";Ff?1PdSbk,C.-Vm@JTG">1st</field>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="variables_set" id="5?5*TKMShna]6@lmPI`7">
                                                   <field name="VAR" id=";Ff?1PdSbk,C.-Vm@JTG">1st</field>
                                                   <value name="VALUE">
                                                     <block type="get_value" id="#/4$w)ZmBHn8Pur*18M-">
                                                       <field name="ATTR">val</field>
                                                       <field name="OID">smartmeter.0.1-0:16_7_0__255.value</field>
                                                     </block>
                                                   </value>
                                                   <next>
                                                     <block type="control" id="+2=}V6/guj4q9(c4*!ya">
                                                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                                       <field name="OID">MeineIoTGeräte.0.DrehstromLeistungBeruhigt</field>
                                                       <field name="WITH_DELAY">TRUE</field>
                                                       <field name="DELAY_MS">100</field>
                                                       <field name="UNIT">ms</field>
                                                       <field name="CLEAR_RUNNING">FALSE</field>
                                                       <value name="VALUE">
                                                         <block type="math_round" id="T?,jWA?k@/8MG=NCU=AY">
                                                           <field name="OP">ROUNDDOWN</field>
                                                           <value name="NUM">
                                                             <shadow type="math_number" id="IKh@[~o*1mytZsx2oXt0">
                                                               <field name="NUM">3.1</field>
                                                             </shadow>
                                                             <block type="math_arithmetic" id="o^1$#B:7R)Pu%[[6/zOd">
                                                               <field name="OP">DIVIDE</field>
                                                               <value name="A">
                                                                 <shadow type="math_number" id="A@EDP*gv[l0$+/MAwa~U">
                                                                   <field name="NUM">1</field>
                                                                 </shadow>
                                                                 <block type="math_arithmetic" id="vi+tEW~4V=omi-KP!})E">
                                                                   <field name="OP">ADD</field>
                                                                   <value name="A">
                                                                     <shadow type="math_number" id="CkJ^:$@:6U=do.{/Hk]K">
                                                                       <field name="NUM">1</field>
                                                                     </shadow>
                                                                     <block type="math_arithmetic" id="Q-rRZI-^0a?kS|**gi6t">
                                                                       <field name="OP">ADD</field>
                                                                       <value name="A">
                                                                         <shadow type="math_number" id="p_Irm!dN@IDAHqJuJF4]">
                                                                           <field name="NUM">1</field>
                                                                         </shadow>
                                                                         <block type="math_arithmetic" id="[0q7%=gn?=+*bRL]!QXd">
                                                                           <field name="OP">ADD</field>
                                                                           <value name="A">
                                                                             <shadow type="math_number" id="aXh(3o(-g#ZOu!GE4PWO">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="variables_get" id="RQ#xM3,zwz$HHE(SIDm7">
                                                                               <field name="VAR" id=";Ff?1PdSbk,C.-Vm@JTG">1st</field>
                                                                             </block>
                                                                           </value>
                                                                           <value name="B">
                                                                             <shadow type="math_number" id="D~00dEt%m;7q9L|/0%vP">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="variables_get" id="2@/McBjF~)vT~`z]db9G">
                                                                               <field name="VAR" id="JjS$g?rzdQfb(ahmdPzQ">2nd</field>
                                                                             </block>
                                                                           </value>
                                                                         </block>
                                                                       </value>
                                                                       <value name="B">
                                                                         <shadow type="math_number" id="g6T[)bYtlseGZO9i7lVT">
                                                                           <field name="NUM">1</field>
                                                                         </shadow>
                                                                         <block type="math_arithmetic" id="uokZQTq^U57!cDE3$ngp">
                                                                           <field name="OP">ADD</field>
                                                                           <value name="A">
                                                                             <shadow type="math_number">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="variables_get" id="gyl~1tAD~XxwEKJq9Fa7">
                                                                               <field name="VAR" id="Gv!D!pu4xtPryuoqLv*C">3rd</field>
                                                                             </block>
                                                                           </value>
                                                                           <value name="B">
                                                                             <shadow type="math_number">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="variables_get" id="wlI/|qpU{/!Es?=m.CIU">
                                                                               <field name="VAR" id="oio=zjEIiTyzvlu8WOXn">4th</field>
                                                                             </block>
                                                                           </value>
                                                                         </block>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                   <value name="B">
                                                                     <shadow type="math_number" id="hJ@H;WSM~8Z8t0:42TAf">
                                                                       <field name="NUM">1</field>
                                                                     </shadow>
                                                                     <block type="math_arithmetic" id="$;Z(jLS8MqiU*aDjhrRI">
                                                                       <field name="OP">ADD</field>
                                                                       <value name="A">
                                                                         <shadow type="math_number" id="}YxDMC-{DV02x)qIHP6-">
                                                                           <field name="NUM">1</field>
                                                                         </shadow>
                                                                         <block type="variables_get" id="Jv/+0x1e~4.|:0pc5X2Z">
                                                                           <field name="VAR" id="QraX}+^E~r~2(d0x4`9g">5th</field>
                                                                         </block>
                                                                       </value>
                                                                       <value name="B">
                                                                         <shadow type="math_number" id="]V4sq0KfD{r*T^~(h^F.">
                                                                           <field name="NUM">1</field>
                                                                         </shadow>
                                                                         <block type="math_arithmetic" id="PfQcwWVqUTJB%@ZKPHO[">
                                                                           <field name="OP">ADD</field>
                                                                           <value name="A">
                                                                             <shadow type="math_number" id=";cS*e3v;2$bAn}LW3w@G">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="variables_get" id="a}v#uE+k8az1d,faC^l;">
                                                                               <field name="VAR" id="9yO0u8_@!y1m-5b_wkyE">6th</field>
                                                                             </block>
                                                                           </value>
                                                                           <value name="B">
                                                                             <shadow type="math_number" id="2cjV*~1zd9AY/*,8-GhU">
                                                                               <field name="NUM">1</field>
                                                                             </shadow>
                                                                             <block type="math_arithmetic" id="9yxE+I_ePTz+nE?$ZZ7I">
                                                                               <field name="OP">ADD</field>
                                                                               <value name="A">
                                                                                 <shadow type="math_number" id="yvx$:#%%jO6[R0IC(a:Y">
                                                                                   <field name="NUM">1</field>
                                                                                 </shadow>
                                                                                 <block type="variables_get" id="RBKg?o{TX!MFhsP462?{">
                                                                                   <field name="VAR" id="AV:lS*1+8,;%f-NKchS$">7th</field>
                                                                                 </block>
                                                                               </value>
                                                                               <value name="B">
                                                                                 <shadow type="math_number" id="^koh7bkV^^Era4rgLgEl">
                                                                                   <field name="NUM">1</field>
                                                                                 </shadow>
                                                                                 <block type="math_arithmetic" id="+Er)hr2=iXIeS#+I#A}:">
                                                                                   <field name="OP">ADD</field>
                                                                                   <value name="A">
                                                                                     <shadow type="math_number" id="sKXja0=-=G)j_CW6z?!N">
                                                                                       <field name="NUM">1</field>
                                                                                     </shadow>
                                                                                     <block type="variables_get" id="[.]Y1#@4bmTT=g.=]wEI">
                                                                                       <field name="VAR" id="Tg3E9)ZPmbROaS+|*@FV">8th</field>
                                                                                     </block>
                                                                                   </value>
                                                                                   <value name="B">
                                                                                     <shadow type="math_number" id="DsL/2%UeC)PCI-~[1Wa{">
                                                                                       <field name="NUM">1</field>
                                                                                     </shadow>
                                                                                     <block type="math_arithmetic" id="Rz!1m,muhW3MjtZ9?y:M">
                                                                                       <field name="OP">ADD</field>
                                                                                       <value name="A">
                                                                                         <shadow type="math_number" id="v9`)L?Jg.m=?:M4may3U">
                                                                                           <field name="NUM">1</field>
                                                                                         </shadow>
                                                                                         <block type="variables_get" id="FfSI]MtE`QrJ4R,O3oV7">
                                                                                           <field name="VAR" id="D=jARPkr+qrMi7-)w=1u">9th</field>
                                                                                         </block>
                                                                                       </value>
                                                                                       <value name="B">
                                                                                         <shadow type="math_number" id=".#,/T8AO{+ub|UmSa}*y">
                                                                                           <field name="NUM">1</field>
                                                                                         </shadow>
                                                                                         <block type="variables_get" id="3qMj]_-k/5uIlTq`-J7e">
                                                                                           <field name="VAR" id="s2mC7-7N|ALEh.Io}9rV">10th</field>
                                                                                         </block>
                                                                                       </value>
                                                                                     </block>
                                                                                   </value>
                                                                                 </block>
                                                                               </value>
                                                                             </block>
                                                                           </value>
                                                                         </block>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                 </block>
                                                               </value>
                                                               <value name="B">
                                                                 <shadow type="math_number" id="L?7!=h]IDNY6`|AuPe%5">
                                                                   <field name="NUM">10</field>
                                                                 </shadow>
                                                               </value>
                                                             </block>
                                                           </value>
                                                         </block>
                                                       </value>
                                                       <next>
                                                         <block type="timeouts_settimeout" id="*=m0Hi)O2T+tCucwuIh{" disabled="true">
                                                           <field name="NAME">timeout10</field>
                                                           <field name="DELAY">20</field>
                                                           <field name="UNIT">ms</field>
                                                           <statement name="STATEMENT">
                                                             <block type="debug" id="VW6I|IWH{(-aec7J8@;Q">
                                                               <field name="Severity">log</field>
                                                               <value name="TEXT">
                                                                 <shadow type="text" id="[Dt[09t~o6zzx0F*3#dY">
                                                                   <field name="TEXT">test</field>
                                                                 </shadow>
                                                                 <block type="get_value" id=":fM#N7DpYg0JYJ)O8V)}">
                                                                   <field name="ATTR">val</field>
                                                                   <field name="OID">smartmeter.0.1-0:16_7_0__255.value</field>
                                                                 </block>
                                                               </value>
                                                               <next>
                                                                 <block type="debug" id="9_uWb7F.0lnEyCMZl,d0">
                                                                   <field name="Severity">log</field>
                                                                   <value name="TEXT">
                                                                     <shadow type="text" id="ZxGUMgUiK5C:MJV!@/p,">
                                                                       <field name="TEXT">test</field>
                                                                     </shadow>
                                                                     <block type="variables_get" id="=9`E9K+Sr[hsNL7.yK)f">
                                                                       <field name="VAR" id="JjS$g?rzdQfb(ahmdPzQ">2nd</field>
                                                                     </block>
                                                                   </value>
                                                                   <next>
                                                                     <block type="debug" id="u9)MD_5=:}WExD!Y1s,S">
                                                                       <field name="Severity">log</field>
                                                                       <value name="TEXT">
                                                                         <shadow type="text">
                                                                           <field name="TEXT">test</field>
                                                                         </shadow>
                                                                         <block type="variables_get" id="|KACv6N5e_hp1`Es!;PW">
                                                                           <field name="VAR" id="Gv!D!pu4xtPryuoqLv*C">3rd</field>
                                                                         </block>
                                                                       </value>
                                                                       <next>
                                                                         <block type="debug" id="Y,e/uWdi:jS0$W2^hbvU">
                                                                           <field name="Severity">log</field>
                                                                           <value name="TEXT">
                                                                             <shadow type="text">
                                                                               <field name="TEXT">test</field>
                                                                             </shadow>
                                                                             <block type="variables_get" id="WH+ShWj=e-5X/c53{RMh">
                                                                               <field name="VAR" id="oio=zjEIiTyzvlu8WOXn">4th</field>
                                                                             </block>
                                                                           </value>
                                                                           <next>
                                                                             <block type="debug" id="E^6*(0FWnW#E.;2@5{2D">
                                                                               <field name="Severity">log</field>
                                                                               <value name="TEXT">
                                                                                 <shadow type="text">
                                                                                   <field name="TEXT">test</field>
                                                                                 </shadow>
                                                                                 <block type="variables_get" id="ld?:N+ZhwKuAbk4pVP5a">
                                                                                   <field name="VAR" id="QraX}+^E~r~2(d0x4`9g">5th</field>
                                                                                 </block>
                                                                               </value>
                                                                               <next>
                                                                                 <block type="debug" id="*VJg)#Kv}=k0f}*paJZ)">
                                                                                   <field name="Severity">log</field>
                                                                                   <value name="TEXT">
                                                                                     <shadow type="text">
                                                                                       <field name="TEXT">test</field>
                                                                                     </shadow>
                                                                                     <block type="variables_get" id="^J-b`s,F:),se;)IE-eI">
                                                                                       <field name="VAR" id="9yO0u8_@!y1m-5b_wkyE">6th</field>
                                                                                     </block>
                                                                                   </value>
                                                                                   <next>
                                                                                     <block type="debug" id="QVBf_;3NyE[vQ9RY2jwX">
                                                                                       <field name="Severity">log</field>
                                                                                       <value name="TEXT">
                                                                                         <shadow type="text">
                                                                                           <field name="TEXT">test</field>
                                                                                         </shadow>
                                                                                         <block type="variables_get" id="*p]Gznuex{d=rGu/c|d#">
                                                                                           <field name="VAR" id="AV:lS*1+8,;%f-NKchS$">7th</field>
                                                                                         </block>
                                                                                       </value>
                                                                                       <next>
                                                                                         <block type="debug" id="89O7drv;[?t_-X78~Pb5">
                                                                                           <field name="Severity">log</field>
                                                                                           <value name="TEXT">
                                                                                             <shadow type="text">
                                                                                               <field name="TEXT">test</field>
                                                                                             </shadow>
                                                                                             <block type="variables_get" id="l6q2+1%Olo.~mD|?T.Vz">
                                                                                               <field name="VAR" id="Tg3E9)ZPmbROaS+|*@FV">8th</field>
                                                                                             </block>
                                                                                           </value>
                                                                                           <next>
                                                                                             <block type="debug" id="U4ScmqAO#!1Z,UL8ypei">
                                                                                               <field name="Severity">log</field>
                                                                                               <value name="TEXT">
                                                                                                 <shadow type="text">
                                                                                                   <field name="TEXT">test</field>
                                                                                                 </shadow>
                                                                                                 <block type="variables_get" id=",Frex/8|,M-F/L[wO34d">
                                                                                                   <field name="VAR" id="D=jARPkr+qrMi7-)w=1u">9th</field>
                                                                                                 </block>
                                                                                               </value>
                                                                                               <next>
                                                                                                 <block type="debug" id="WHO2vBnrIGlW2Ojlf8kh">
                                                                                                   <field name="Severity">log</field>
                                                                                                   <value name="TEXT">
                                                                                                     <shadow type="text">
                                                                                                       <field name="TEXT">test</field>
                                                                                                     </shadow>
                                                                                                     <block type="variables_get" id="N0IJWJXykI6-i`|H($$i">
                                                                                                       <field name="VAR" id="s2mC7-7N|ALEh.Io}9rV">10th</field>
                                                                                                     </block>
                                                                                                   </value>
                                                                                                 </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>
            </next>
          </block>
        </statement>
        

        </block>
        </xml>

        [/s]
        1 Reply Last reply Reply Quote 0
        • Homoran
          Homoran Global Moderator Administrators last edited by Homoran

          @uwessmarthome das geht viel einfacher mit Listen
          Screenshot_20210225-083727_Firefox.jpg

          die letzten beiden Zeilen können auch noch vereinfacht werden, da gibtes noch einenen nimm den Mittelwert block

          U lobomau 2 Replies Last reply Reply Quote 0
          • U
            UwesSmartHome @Homoran last edited by

            @homoran

            ja das habe ich am Anfang auch so gemacht, leider ist es von der Messdauer abhängig. Wie ist diese hier definiert? Da geing dann ja nur zeitabhängig.
            Bei meiner Lösung ist es zeitlich unabhängig und jerder neue Wert erzeugt auch gleich einen neuen Mittelwert. Bei deiner Lösung wird der Mittelwert nach der Messdauer ezeugt?

            Grüsse

            paul53 Homoran 2 Replies Last reply Reply Quote 0
            • paul53
              paul53 @UwesSmartHome last edited by

              @uwessmarthome sagte: von der Messdauer abhängig. Wie ist diese hier definiert?

              Wie man am Vergleich sieht: Anzahl der Werte in der Liste.

              @uwessmarthome sagte in Schieberegister für gleitenden Mittelwert Smartmeter:

              leider ist es von der Messdauer abhängig.

              Der Trigger kann der gleiche wie in Deiner Lösung sein.

              1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @UwesSmartHome last edited by

                @uwessmarthome sagte in Schieberegister für gleitenden Mittelwert Smartmeter:

                Wie ist diese hier definiert?

                Ich habe den gleichen Trigger wie du.
                Die Messdauer wird dann über die Anzahl Werte definiert, die ja in einheitlichem Abstand kommen (bei mir in 6 Sekunden Abstand)
                Also Mess"dauer" [Anzahl] x6 Sekunden ist Zeit

                1 Reply Last reply Reply Quote 0
                • Asgothian
                  Asgothian Developer last edited by

                  @uwessmarthome sagte in Schieberegister für gleitenden Mittelwert Smartmeter:

                  Bei meiner Lösung ist es zeitlich unabhängig und jerder neue Wert erzeugt auch gleich einen neuen Mittelwert.

                  Das ist sie nur wenn du sicher stellen kannst das dein Trigger in regelmässigen Abständen aktualisiert wird. Das ist aber nicht immer so. Bei unregelmässigen Triggern wird das Skript aber nur unwesentlich komplexer:
                  Screenshot 2021-02-25 at 15.52.36.png

                  Das Beispiel berechnet den Durchschnitt über die letzte Stunde, wobei bei jeder Wertänderung neu berechnet wird, sprich wenn ein Wert über eine Stunde unverändert bleibt passt der Durchschnitt erst bei der nächsten Änderung. Ansonsten ist egal wie schnell die Wertänderungen herein kommen.

                  A.

                  U 1 Reply Last reply Reply Quote 0
                  • U
                    UwesSmartHome @Asgothian last edited by

                    @asgothian
                    Auch eine gute Lösung, danke für diesen guten Vorschlag.

                    Grüsse

                    1 Reply Last reply Reply Quote 0
                    • lobomau
                      lobomau @Homoran last edited by

                      @homoran sagte in Schieberegister für gleitenden Mittelwert Smartmeter:

                      @uwessmarthome das geht viel einfacher mit Listen
                      Screenshot_20210225-083727_Firefox.jpg

                      die letzten beiden Zeilen können auch noch vereinfacht werden, da gibt es noch einenen nimm den Mittelwert block

                      Ich werde leider noch nicht ganz schlau mit dieser "Listenfunktion".
                      Wo mache ich einen Denkfehler. Bezug_Test ist einfach ein erstellter number Datenpunkt unter userdata.0., den ich manuell mit einer Zahl belegen kann. Ich dachte es würde nun eine Liste erstellt aus max. 10 Zahlen, wo immer die letzte Zahl neu dazu kommt und die erste gelöscht wird:

                      4ef4a202-37c9-4c81-9cee-c8c908bbda1e-image.png

                      javascript.0	2022-04-23 10:28:33.771	error	(357) at processImmediate (internal/timers.js:464:21)
                      javascript.0	2022-04-23 10:28:33.771	error	(357) at Immediate.<anonymous> (/opt/iobroker/node_modules/@iobroker/js-controller-adapter/src/lib/adapter/adapter.js:5909:56)
                      javascript.0	2022-04-23 10:28:33.771	error	(357) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:567:29)
                      javascript.0	2022-04-23 10:28:33.770	error	(357) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1167:38)
                      javascript.0	2022-04-23 10:28:33.770	error	(357) at Object.<anonymous> (script.js.common.Energie.Bezug-Einspeise_mittel:8:20)
                      javascript.0	2022-04-23 10:28:33.769	error	(357) script.js.common.Energie.Bezug-Einspeise_mittel: TypeError: Cannot read property 'push' of undefined
                      
                      Asgothian 1 Reply Last reply Reply Quote 0
                      • Asgothian
                        Asgothian Developer @lobomau last edited by

                        @lobomau Du musst deine Liste schon initialisieren.

                        Am besten via den Baustein
                        Screen Shot 2022-04-23 at 11.25.33 .png

                        Ansonsten weiss Blockly nicht das "Ueberschussliste" eine Liste sein soll.

                        A.

                        lobomau 1 Reply Last reply Reply Quote 1
                        • lobomau
                          lobomau @Asgothian last edited by lobomau

                          Edit: habe es hinbekommen 👍

                          e637b47a-6e3d-49ee-8981-5ce6f362de2e-image.png

                          javascript.0	2022-04-23 13:01:05.561	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7,22,1,-5,66,120,-50]
                          javascript.0	2022-04-23 13:01:01.153	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7,22,1,-5,66,120]
                          javascript.0	2022-04-23 13:00:57.853	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7,22,1,-5,66]
                          javascript.0	2022-04-23 13:00:51.799	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7,22,1,-5]
                          javascript.0	2022-04-23 13:00:48.196	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7,22,1]
                          javascript.0	2022-04-23 13:00:44.491	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7,22]
                          javascript.0	2022-04-23 13:00:41.171	info	(357) script.js.common.Energie.Bezug-Einspeise_mittel: [3,5,7]
                          
                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          725
                          Online

                          32.1k
                          Users

                          80.6k
                          Topics

                          1.3m
                          Posts

                          5
                          11
                          615
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo