Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Strom Tagesverbrauch aus Datenbank

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Strom Tagesverbrauch aus Datenbank

    This topic has been deleted. Only users with topic management privileges can see it.
    • paul53
      paul53 @Aphofis last edited by

      @aphofis
      Aqua-Voltage in W?
      Um den Energieverbrauch zu ermitteln, benötigt man nur die Leistung (in W).

      1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @Aphofis last edited by paul53

        @aphofis
        Wenn Du es nicht mit Sourceanalytix machen möchtest, dann ermittle die Energie so (Leistung in W):

        Bild_2021-09-25_152541.png

        <xml xmlns="https://developers.google.com/blockly/xml">
         <variables>
           <variable id="=}(t[?(kyO6G;_5{47zw">energie</variable>
           <variable id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</variable>
         </variables>
         <block type="comment" id="hQraEeWfHpLGYW97I+DF" x="13" y="-38">
           <field name="COMMENT">kWh</field>
           <next>
             <block type="variables_set" id="G;SczN+pnoC0.C-Qe`C+">
               <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
               <value name="VALUE">
                 <block type="get_value" id="^zKNE#ta?kxb4g)gwVP7">
                   <field name="ATTR">val</field>
                   <field name="OID">0_userdata.0.Aqua_Control.Stromzaehler.Total</field>
                 </block>
               </value>
               <next>
                 <block type="on_ext" id="Y8qNI3:jg^#*MWHeg?#h">
                   <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                   <field name="CONDITION">ne</field>
                   <field name="ACK_CONDITION"></field>
                   <value name="OID0">
                     <shadow type="field_oid" id="$8eD5S!}r|AQlC#uLB4l">
                       <field name="oid">0_userdata.0.Aqua_Control.Stromverbrauch.Leistung</field>
                     </shadow>
                   </value>
                   <statement name="STATEMENT">
                     <block type="math_change" id="?{JM=9{pk(Z6LoI6cxQE">
                       <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                       <value name="DELTA">
                         <shadow type="math_number" id="Xf[d~|kq/aP_DDr]DK1l">
                           <field name="NUM">1</field>
                         </shadow>
                         <block type="math_arithmetic" id="jJYI,7@dx)qZAG@va]_." inline="false">
                           <field name="OP">DIVIDE</field>
                           <value name="A">
                             <shadow type="math_number" id="=$N|b~CMlpLQkVj]ChTX">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="math_arithmetic" id="+)/#ivXT|4U-`QOw,xSf">
                               <field name="OP">MULTIPLY</field>
                               <value name="A">
                                 <shadow type="math_number" id="?MAStt72g7n3yIy5#),L">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="on_source" id="jk5ZtHcPTZxIJ9**dT.a">
                                   <field name="ATTR">oldState.val</field>
                                 </block>
                               </value>
                               <value name="B">
                                 <shadow type="math_number" id="%rMg4hLIG8=;w:Aw(6s%">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="math_arithmetic" id="xl,~%fsgoDoc(jGFkn(3">
                                   <field name="OP">MINUS</field>
                                   <value name="A">
                                     <shadow type="math_number" id="9MU=I%OuetykN3Zbxcj`">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="on_source" id="|[g`7q;E;C}sAlQ^|2hK">
                                       <field name="ATTR">state.lc</field>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number" id="8z13T?Bu?$~.iKDR9m#0">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="on_source" id="{Xxuo?BM~S7)mhYX[6}{">
                                       <field name="ATTR">oldState.lc</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <value name="B">
                             <shadow type="math_number" id="`,WX5Lw*~W`N6I9_JIv5">
                               <field name="NUM">3600000000</field>
                             </shadow>
                           </value>
                         </block>
                       </value>
                       <next>
                         <block type="update" id="7;=+:MQY5gvy#wxD$E9y">
                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                           <field name="OID">0_userdata.0.Aqua_Control.Stromzaehler.Total</field>
                           <field name="WITH_DELAY">FALSE</field>
                           <value name="VALUE">
                             <block type="math_rndfixed" id="=zTyO$T{|F{x#aruTU{1">
                               <field name="n">2</field>
                               <value name="x">
                                 <shadow type="math_number" id="]Ci$6#5q*i||oO%yTX$L">
                                   <field name="NUM">3.1234</field>
                                 </shadow>
                                 <block type="variables_get" id="I++a7,|Ag:L;T}v{DnFN">
                                   <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <next>
                             <block type="variables_set" id="0$$G4,492Crm7Qp^fvhQ">
                               <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                               <value name="VALUE">
                                 <block type="math_arithmetic" id="jo2({_QE1,!7H,)%i+c%">
                                   <field name="OP">MINUS</field>
                                   <value name="A">
                                     <shadow type="math_number" id="p~D[c1OhSg6yE%D?0U`S">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="variables_get" id="#`6CkJT-F54W2]Ln-F=B">
                                       <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number" id="sgz+%W6FFv$cBl#_eP](">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="hizt:4X.JcU!hND,z^EZ">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Aqua_Control.Stromzaehler.Mitternacht</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="update" id="5(A(1PCekzhf2%D(/({~">
                                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                   <field name="OID">0_userdata.0.Aqua_Control.Stromverbrauch.Aktuell</field>
                                   <field name="WITH_DELAY">FALSE</field>
                                   <value name="VALUE">
                                     <block type="math_rndfixed" id="cG)G/,P:O,EmkP)t_?(%">
                                       <field name="n">2</field>
                                       <value name="x">
                                         <shadow type="math_number">
                                           <field name="NUM">3.1234</field>
                                         </shadow>
                                         <block type="variables_get" id="ucfMpk(paE-yhCg$-]r)">
                                           <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                   </statement>
                   <next>
                     <block type="schedule" id="5L@5J0fW$;xp/^dgNg2F">
                       <field name="SCHEDULE">59 59 23 * * *</field>
                       <statement name="STATEMENT">
                         <block type="update" id=":|C=ZeFE%G4t]HU4G,GX">
                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                           <field name="OID">0_userdata.0.Aqua_Control.Stromverbrauch.Gestern</field>
                           <field name="WITH_DELAY">FALSE</field>
                           <value name="VALUE">
                             <block type="math_rndfixed" id="8J`C*Gj|/~?j=Kx3B/7H">
                               <field name="n">2</field>
                               <value name="x">
                                 <shadow type="math_number">
                                   <field name="NUM">3.1234</field>
                                 </shadow>
                                 <block type="variables_get" id="s-73/vJV!W-H)A(c;K:_">
                                   <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <next>
                             <block type="update" id="f,A}%Bt4g30WGa]GTlwN">
                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                               <field name="OID">0_userdata.0.Aqua_Control.Stromzaehler.Mitternacht</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="math_rndfixed" id="+^7Gd0J`n)J${Yur#yj+">
                                   <field name="n">2</field>
                                   <value name="x">
                                     <shadow type="math_number">
                                       <field name="NUM">3.1234</field>
                                     </shadow>
                                     <block type="variables_get" id="!k6k?zl^moYh}-|zn1)v">
                                       <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                             </block>
                           </next>
                         </block>
                       </statement>
                     </block>
                   </next>
                 </block>
               </next>
             </block>
           </next>
         </block>
        </xml>
        

        Aphofis 1 Reply Last reply Reply Quote 1
        • Aphofis
          Aphofis @paul53 last edited by Aphofis

          @paul53
          Sieht schon mal Top aus.
          Was ist denn Stromzähler total ?
          Wss ist Stromverbrauch Leistung ?
          Was ist Stromzähler Mitternacht ?
          meine kWh Tag steuerung speichert alle stunde den gemessenen Watt wert in einem Datenpunkt kann man die nicht einbeziehen !?

          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Aphofis last edited by paul53

            @aphofis sagte: Was ist denn Stromzähler total ?

            Das ist der Zählerwert, der ständig hochgezählt wird wie bei einem Stromzähler.

            @aphofis sagte in Strom Tagesverbrauch aus Datenbank:

            Wss ist Stromverbrauch Leistung ?

            Das ist die momentane Leistungsaufnahme in W. Sollte der Datenpunkt "hs100.0.192_168_0_28.power" liefern?

            @aphofis sagte in Strom Tagesverbrauch aus Datenbank:

            Was ist Stromzähler Mitternacht ?

            Das ist der Zählerstand beim letzten Tageswechsel. Wird benötigt, um den Tagesverbrauch zu ermitteln.

            Man kann auch noch um einen Monatsverbrauch und einen Jahresverbrauch ergänzen.

            Bild_2021-09-25_224310.png

            Aphofis 1 Reply Last reply Reply Quote 0
            • Aphofis
              Aphofis @paul53 last edited by Aphofis

              @paul53

              ist es so korrekt !?

              <xml xmlns="https://developers.google.com/blockly/xml">
                <variables>
                  <variable id="=}(t[?(kyO6G;_5{47zw">energie</variable>
                  <variable id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</variable>
                </variables>
                <block type="comment" id="hQraEeWfHpLGYW97I+DF" x="13" y="-38">
                  <field name="COMMENT">kWh</field>
                  <next>
                    <block type="variables_set" id="G;SczN+pnoC0.C-Qe`C+">
                      <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                      <value name="VALUE">
                        <block type="get_value" id="^zKNE#ta?kxb4g)gwVP7">
                          <field name="ATTR">val</field>
                          <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total</field>
                        </block>
                      </value>
                      <next>
                        <block type="on_ext" id="Y8qNI3:jg^#*MWHeg?#h">
                          <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                          <field name="CONDITION">ne</field>
                          <field name="ACK_CONDITION"></field>
                          <value name="OID0">
                            <shadow type="field_oid" id="$8eD5S!}r|AQlC#uLB4l">
                              <field name="oid">hs100.0.192_168_0_28.power</field>
                            </shadow>
                          </value>
                          <statement name="STATEMENT">
                            <block type="math_change" id="?{JM=9{pk(Z6LoI6cxQE">
                              <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                              <value name="DELTA">
                                <shadow type="math_number" id="Xf[d~|kq/aP_DDr]DK1l">
                                  <field name="NUM">1</field>
                                </shadow>
                                <block type="math_arithmetic" id="jJYI,7@dx)qZAG@va]_." inline="false">
                                  <field name="OP">DIVIDE</field>
                                  <value name="A">
                                    <shadow type="math_number" id="=$N|b~CMlpLQkVj]ChTX">
                                      <field name="NUM">1</field>
                                    </shadow>
                                    <block type="math_arithmetic" id="+)/#ivXT|4U-`QOw,xSf">
                                      <field name="OP">MULTIPLY</field>
                                      <value name="A">
                                        <shadow type="math_number" id="?MAStt72g7n3yIy5#),L">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="on_source" id="jk5ZtHcPTZxIJ9**dT.a">
                                          <field name="ATTR">oldState.val</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number" id="%rMg4hLIG8=;w:Aw(6s%">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="math_arithmetic" id="xl,~%fsgoDoc(jGFkn(3">
                                          <field name="OP">MINUS</field>
                                          <value name="A">
                                            <shadow type="math_number" id="9MU=I%OuetykN3Zbxcj`">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="on_source" id="|[g`7q;E;C}sAlQ^|2hK">
                                              <field name="ATTR">state.lc</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="8z13T?Bu?$~.iKDR9m#0">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="on_source" id="{Xxuo?BM~S7)mhYX[6}{">
                                              <field name="ATTR">oldState.lc</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <shadow type="math_number" id="`,WX5Lw*~W`N6I9_JIv5">
                                      <field name="NUM">3600000000</field>
                                    </shadow>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="update" id="7;=+:MQY5gvy#wxD$E9y">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="math_rndfixed" id="=zTyO$T{|F{x#aruTU{1">
                                      <field name="n">2</field>
                                      <value name="x">
                                        <shadow type="math_number" id="]Ci$6#5q*i||oO%yTX$L">
                                          <field name="NUM">3.1234</field>
                                        </shadow>
                                        <block type="variables_get" id="I++a7,|Ag:L;T}v{DnFN">
                                          <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="0$$G4,492Crm7Qp^fvhQ">
                                      <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                      <value name="VALUE">
                                        <block type="math_arithmetic" id="jo2({_QE1,!7H,)%i+c%">
                                          <field name="OP">MINUS</field>
                                          <value name="A">
                                            <shadow type="math_number" id="p~D[c1OhSg6yE%D?0U`S">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="variables_get" id="#`6CkJT-F54W2]Ln-F=B">
                                              <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="sgz+%W6FFv$cBl#_eP](">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id="hizt:4X.JcU!hND,z^EZ">
                                              <field name="ATTR">val</field>
                                              <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="update" id="5(A(1PCekzhf2%D(/({~">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Aktuell</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="math_rndfixed" id="cG)G/,P:O,EmkP)t_?(%">
                                              <field name="n">2</field>
                                              <value name="x">
                                                <shadow type="math_number">
                                                  <field name="NUM">3.1234</field>
                                                </shadow>
                                                <block type="variables_get" id="ucfMpk(paE-yhCg$-]r)">
                                                  <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </statement>
                          <next>
                            <block type="schedule" id="5L@5J0fW$;xp/^dgNg2F">
                              <field name="SCHEDULE">59 59 23 * * *</field>
                              <statement name="STATEMENT">
                                <block type="update" id=":|C=ZeFE%G4t]HU4G,GX">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Gestern</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="math_rndfixed" id="8J`C*Gj|/~?j=Kx3B/7H">
                                      <field name="n">2</field>
                                      <value name="x">
                                        <shadow type="math_number">
                                          <field name="NUM">3.1234</field>
                                        </shadow>
                                        <block type="variables_get" id="s-73/vJV!W-H)A(c;K:_">
                                          <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="update" id="f,A}%Bt4g30WGa]GTlwN">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_rndfixed" id="+^7Gd0J`n)J${Yur#yj+">
                                          <field name="n">2</field>
                                          <value name="x">
                                            <shadow type="math_number">
                                              <field name="NUM">3.1234</field>
                                            </shadow>
                                            <block type="variables_get" id="!k6k?zl^moYh}-|zn1)v">
                                              <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </xml>
              

              stromverbrauch.png

              Datenpunkte die ich als Zahl angelegt habe:
              Stromzähler_Total
              Stromzähler_Mitternacht
              Stromverbrauch_Aktuell
              Stromverbrauch_Gestern
              Stromzähler_Mitternacht
              und Trigger Datenpunkt ist Aqua_Voltage_Watt_Aktuell
              aus dem hs100

              Stromverbrauch_Aktuell zeigt 0,05 was ist das kwh !?

              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @Aphofis last edited by paul53

                @aphofis sagte: was ist das kwh !?

                Alle eigenen Datenpunkte sind in kWh.

                "type": "number",
                "unit": "kWh",
                

                Bei den Zählwerten können Anfangswerte manuell eingegeben werden. Sie werden dann von diesem Wert aus weiter gezählt.

                Aphofis 1 Reply Last reply Reply Quote 0
                • Aphofis
                  Aphofis @paul53 last edited by Aphofis

                  @paul53
                  OK !
                  ist es soweit korrekt ???

                  stromverbrauch.png

                  <xml xmlns="https://developers.google.com/blockly/xml">
                    <variables>
                      <variable id="=}(t[?(kyO6G;_5{47zw">energie</variable>
                      <variable id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</variable>
                      <variable id="_6-y]Y9]t#{T,8m8Nld|">morgen</variable>
                    </variables>
                    <block type="comment" id="hQraEeWfHpLGYW97I+DF" x="13" y="-38">
                      <field name="COMMENT">kWh</field>
                      <next>
                        <block type="variables_set" id="G;SczN+pnoC0.C-Qe`C+">
                          <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                          <value name="VALUE">
                            <block type="get_value" id="^zKNE#ta?kxb4g)gwVP7">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total</field>
                            </block>
                          </value>
                          <next>
                            <block type="on_ext" id="Y8qNI3:jg^#*MWHeg?#h">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                              <field name="CONDITION">ne</field>
                              <field name="ACK_CONDITION"></field>
                              <value name="OID0">
                                <shadow type="field_oid" id="$8eD5S!}r|AQlC#uLB4l">
                                  <field name="oid">hs100.0.192_168_0_28.power</field>
                                </shadow>
                              </value>
                              <statement name="STATEMENT">
                                <block type="math_change" id="?{JM=9{pk(Z6LoI6cxQE">
                                  <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                  <value name="DELTA">
                                    <shadow type="math_number" id="Xf[d~|kq/aP_DDr]DK1l">
                                      <field name="NUM">1</field>
                                    </shadow>
                                    <block type="math_arithmetic" id="jJYI,7@dx)qZAG@va]_." inline="false">
                                      <field name="OP">DIVIDE</field>
                                      <value name="A">
                                        <shadow type="math_number" id="=$N|b~CMlpLQkVj]ChTX">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="math_arithmetic" id="+)/#ivXT|4U-`QOw,xSf">
                                          <field name="OP">MULTIPLY</field>
                                          <value name="A">
                                            <shadow type="math_number" id="?MAStt72g7n3yIy5#),L">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="on_source" id="jk5ZtHcPTZxIJ9**dT.a">
                                              <field name="ATTR">oldState.val</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="%rMg4hLIG8=;w:Aw(6s%">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="math_arithmetic" id="xl,~%fsgoDoc(jGFkn(3">
                                              <field name="OP">MINUS</field>
                                              <value name="A">
                                                <shadow type="math_number" id="9MU=I%OuetykN3Zbxcj`">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="on_source" id="|[g`7q;E;C}sAlQ^|2hK">
                                                  <field name="ATTR">state.lc</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <shadow type="math_number" id="8z13T?Bu?$~.iKDR9m#0">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="on_source" id="{Xxuo?BM~S7)mhYX[6}{">
                                                  <field name="ATTR">oldState.lc</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number" id="`,WX5Lw*~W`N6I9_JIv5">
                                          <field name="NUM">3600000000</field>
                                        </shadow>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="update" id="7;=+:MQY5gvy#wxD$E9y">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_rndfixed" id="=zTyO$T{|F{x#aruTU{1">
                                          <field name="n">2</field>
                                          <value name="x">
                                            <shadow type="math_number" id="]Ci$6#5q*i||oO%yTX$L">
                                              <field name="NUM">3.1234</field>
                                            </shadow>
                                            <block type="variables_get" id="I++a7,|Ag:L;T}v{DnFN">
                                              <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="0$$G4,492Crm7Qp^fvhQ">
                                          <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                          <value name="VALUE">
                                            <block type="math_arithmetic" id="jo2({_QE1,!7H,)%i+c%">
                                              <field name="OP">MINUS</field>
                                              <value name="A">
                                                <shadow type="math_number" id="p~D[c1OhSg6yE%D?0U`S">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="#`6CkJT-F54W2]Ln-F=B">
                                                  <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <shadow type="math_number" id="sgz+%W6FFv$cBl#_eP](">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="get_value" id="hizt:4X.JcU!hND,z^EZ">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="update" id="5(A(1PCekzhf2%D(/({~">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Aktuell</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="math_rndfixed" id="cG)G/,P:O,EmkP)t_?(%">
                                                  <field name="n">2</field>
                                                  <value name="x">
                                                    <shadow type="math_number">
                                                      <field name="NUM">3.1234</field>
                                                    </shadow>
                                                    <block type="variables_get" id="ucfMpk(paE-yhCg$-]r)">
                                                      <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                              <next>
                                <block type="schedule" id="5L@5J0fW$;xp/^dgNg2F">
                                  <field name="SCHEDULE">59 59 23 * * *</field>
                                  <statement name="STATEMENT">
                                    <block type="update" id=":|C=ZeFE%G4t]HU4G,GX">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Gestern</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_rndfixed" id="8J`C*Gj|/~?j=Kx3B/7H">
                                          <field name="n">2</field>
                                          <value name="x">
                                            <shadow type="math_number">
                                              <field name="NUM">3.1234</field>
                                            </shadow>
                                            <block type="variables_get" id="s-73/vJV!W-H)A(c;K:_">
                                              <field name="VAR" id="77Wt!M~fc;QCn4*b~)yF">verbrauch_heute</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="update" id="f,A}%Bt4g30WGa]GTlwN">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="math_rndfixed" id="+^7Gd0J`n)J${Yur#yj+">
                                              <field name="n">2</field>
                                              <value name="x">
                                                <shadow type="math_number">
                                                  <field name="NUM">3.1234</field>
                                                </shadow>
                                                <block type="variables_get" id="!k6k?zl^moYh}-|zn1)v">
                                                  <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="variables_set" id="~U:saO7D4o2LncPD,$zJ">
                                              <field name="VAR" id="_6-y]Y9]t#{T,8m8Nld|">morgen</field>
                                              <value name="VALUE">
                                                <block type="math_arithmetic" id="%?pT5iAdIb,Cj~SD?g=k">
                                                  <field name="OP">ADD</field>
                                                  <value name="A">
                                                    <shadow type="math_number" id=")jmzPSW};.V6b+2@i5eD">
                                                      <field name="NUM">1</field>
                                                    </shadow>
                                                    <block type="time_get" id="jHhduk?.rJa7Q(WC2W2W">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                      <field name="OPTION">object</field>
                                                    </block>
                                                  </value>
                                                  <value name="B">
                                                    <shadow type="math_number" id="b-VxX~PvK`j^J?{T2Irv">
                                                      <field name="NUM">2000</field>
                                                    </shadow>
                                                  </value>
                                                </block>
                                              </value>
                                              <next>
                                                <block type="controls_if" id="}.7+3h;NdT^5s9c.3Vae">
                                                  <value name="IF0">
                                                    <block type="logic_compare" id="p)4g6@/nlzWJ2fJVY`mb">
                                                      <field name="OP">EQ</field>
                                                      <value name="A">
                                                        <block type="convert_from_date" id="?8CaQ3WXs]T.MCig`3^F">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                          <field name="OPTION">d</field>
                                                          <value name="VALUE">
                                                            <block type="variables_get" id="2DwPFc;$Q9WDv{n(D.6@">
                                                              <field name="VAR" id="_6-y]Y9]t#{T,8m8Nld|">morgen</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <block type="math_number" id="@%/xTRH:]%|r8E]]rM/M">
                                                          <field name="NUM">1</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <statement name="DO0">
                                                    <block type="update" id="efm:)%PS{1H%^87@H}[Q">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                      <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letzter_Monat</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="math_rndfixed" id="pe?8NRCD)LyeA[aJ,w+G">
                                                          <field name="n">2</field>
                                                          <value name="x">
                                                            <shadow type="math_number" id="C6nfJzqfl40`vUOA7bK0">
                                                              <field name="NUM">3.1234</field>
                                                            </shadow>
                                                            <block type="math_arithmetic" id="cFsB;G3B|IJItb:;7dun">
                                                              <field name="OP">MINUS</field>
                                                              <value name="A">
                                                                <shadow type="math_number" id="QV@Rpbbz-*PS;AIi8g1B">
                                                                  <field name="NUM">1</field>
                                                                </shadow>
                                                                <block type="variables_get" id="e+.3i!bZf2Y}x`e88TL=">
                                                                  <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                                                </block>
                                                              </value>
                                                              <value name="B">
                                                                <shadow type="math_number" id="0W/uAFcI7r2Zo(;@(Br:">
                                                                  <field name="NUM">1</field>
                                                                </shadow>
                                                                <block type="get_value" id="f8)az8=xs0,xElE/2?~I">
                                                                  <field name="ATTR">val</field>
                                                                  <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende</field>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="update" id="K)a|UPpQHP}0#}oM0,,u">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                          <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Zahlwert_Monatsende</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <block type="math_rndfixed" id="6@t{cc91iP1jCoF8dlIg">
                                                              <field name="n">2</field>
                                                              <value name="x">
                                                                <shadow type="math_number" id="r;_Vule$5+w?pZqfy6,L">
                                                                  <field name="NUM">3.1234</field>
                                                                </shadow>
                                                                <block type="variables_get" id="$LHW]-?]O}qeSRMpi4v.">
                                                                  <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                          <next>
                                                            <block type="controls_if" id="A5?c6a^o-I%|]=giP]X%">
                                                              <value name="IF0">
                                                                <block type="logic_compare" id="uGr1B3D+]Kfc)KQg$IXQ">
                                                                  <field name="OP">EQ</field>
                                                                  <value name="A">
                                                                    <block type="convert_from_date" id="6KRF+EEuu9-]a@eW@Y74">
                                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                      <field name="OPTION">M</field>
                                                                      <value name="VALUE">
                                                                        <block type="variables_get" id="o!khYDv4C$j?/EG1P@EH">
                                                                          <field name="VAR" id="_6-y]Y9]t#{T,8m8Nld|">morgen</field>
                                                                        </block>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                  <value name="B">
                                                                    <block type="math_number" id=".Si1uKF/KOVCYhCfl-lZ">
                                                                      <field name="NUM">1</field>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                              <statement name="DO0">
                                                                <block type="update" id="hPTu@CRozsyZL%OJ)r-`">
                                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                  <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letztes_Jahr</field>
                                                                  <field name="WITH_DELAY">FALSE</field>
                                                                  <value name="VALUE">
                                                                    <block type="math_rndfixed" id="!hZyNV]dqhcWO4^[O!A@">
                                                                      <field name="n">2</field>
                                                                      <value name="x">
                                                                        <shadow type="math_number" id="kd@_3s.FD__2K560^zTW">
                                                                          <field name="NUM">3.1234</field>
                                                                        </shadow>
                                                                        <block type="math_arithmetic" id="brezP^ABzjiLeIByXUOM">
                                                                          <field name="OP">MINUS</field>
                                                                          <value name="A">
                                                                            <shadow type="math_number">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="variables_get" id="Dmc%=h~c:^IM:SNxmR.T">
                                                                              <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                                                            </block>
                                                                          </value>
                                                                          <value name="B">
                                                                            <shadow type="math_number" id="yg8fL_$?XWU{AjA(b2D-">
                                                                              <field name="NUM">1</field>
                                                                            </shadow>
                                                                            <block type="get_value" id="dMUa.TVZ8^@p8`l(wts?">
                                                                              <field name="ATTR">val</field>
                                                                              <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende</field>
                                                                            </block>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                  <next>
                                                                    <block type="update" id="-eBmB,R_Ta0ks9!fo,io">
                                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                      <field name="OID">0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende</field>
                                                                      <field name="WITH_DELAY">FALSE</field>
                                                                      <value name="VALUE">
                                                                        <block type="math_rndfixed" id="1L5@],}r8lfE,mp@F]14">
                                                                          <field name="n">2</field>
                                                                          <value name="x">
                                                                            <shadow type="math_number">
                                                                              <field name="NUM">3.1234</field>
                                                                            </shadow>
                                                                            <block type="variables_get" id="_+PGSUL?:6nLvv)4jg,j">
                                                                              <field name="VAR" id="=}(t[?(kyO6G;_5{47zw">energie</field>
                                                                            </block>
                                                                          </value>
                                                                        </block>
                                                                      </value>
                                                                    </block>
                                                                  </next>
                                                                </block>
                                                              </statement>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </statement>
                                                </block>
                                              </next>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </xml>
                  

                  Kan man auch die Tages, Monats und Jahreskosten mit in die Rechnung übernehmen !?

                  paul53 1 Reply Last reply Reply Quote 0
                  • paul53
                    paul53 @Aphofis last edited by paul53

                    @aphofis sagte: Kan man auch die Tages, Monats und Jahreskosten mit in die Rechnung übernehmen !?

                    Ja, es ist ja nur ein Faktor zu berücksichtigen.

                    @aphofis sagte in Strom Tagesverbrauch aus Datenbank:

                    ist es soweit korrekt ???

                    Sieht gut aus. Es ist für mich einfacher, wenn Du den erzeugten Javascript-Code ohne die letzte Zeile in Code tags postest.

                    EDIT: Für den Zählwert am Monatsende hast Du zwei verschiedene Datenpunkte verwendet!

                    Aphofis 1 Reply Last reply Reply Quote 0
                    • Aphofis
                      Aphofis @paul53 last edited by

                      @paul53
                      Sorry Ich vergaß!
                      EDIT: Für den Zählwert am Monatsende hast Du zwei verschiedene Datenpunkte verwendet!
                      Wo meinst du???

                      Aphofis 1 Reply Last reply Reply Quote 0
                      • Aphofis
                        Aphofis @Aphofis last edited by

                        Du meinst so !?

                        var energie, verbrauch_heute, morgen;
                        
                        
                        // kWh
                        energie = getState("0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total").val;
                        on({id: 'hs100.0.192_168_0_28.power', change: "ne"}, async function (obj) {
                          var value = obj.state.val;
                          var oldValue = obj.oldState.val;
                          energie = (typeof energie == 'number' ? energie : 0) + ((obj.oldState ? obj.oldState.val : "") * ((obj.state ? obj.state.lc : "") - (obj.oldState ? obj.oldState.lc : ""))) / 3600000000;
                          setState("0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total"/*Stomzähler_Total*/, Math.round(energie*100)/100, true);
                          verbrauch_heute = energie - getState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht").val;
                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Aktuell"/*Stromverbrauch_Aktuell*/, Math.round(verbrauch_heute*100)/100, true);
                        });
                        schedule("59 59 23 * * *", async function () {
                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Gestern"/*Stromverbrauch_Gestern*/, Math.round(verbrauch_heute*100)/100, true);
                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht"/*Stromzähler_Mitternacht*/, Math.round(energie*100)/100, true);
                          morgen = (new Date().getTime()) + 2000;
                          if (getDateObject(morgen).getDate() == 1) {
                            setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letzter_Monat"/*Stromverbrauch_letzter_Monat*/, Math.round((energie - getState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende").val)*100)/100, true);
                            setState("0_userdata.0.Aqua_Control.0.Strom.Zahlwert_Monatsende"/*Zahlwert_Monatsende*/, Math.round(energie*100)/100, true);
                            if ((getDateObject(morgen).getMonth() + 1) == 1) {
                              setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letztes_Jahr"/*Stromverbrauch_letztes_Jahr*/, Math.round((energie - getState("0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende").val)*100)/100, true);
                              setState("0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende"/*Zählwert_Jahresende*/, Math.round(energie*100)/100, true);
                            }
                          }
                        });
                        
                        paul53 Aphofis 2 Replies Last reply Reply Quote 0
                        • paul53
                          paul53 @Aphofis last edited by paul53

                          @aphofis sagte in Strom Tagesverbrauch aus Datenbank:

                          Du meinst so !?

                          Ja.

                          @aphofis sagte in Strom Tagesverbrauch aus Datenbank:

                          Wo meinst du???

                          Erst Wert von "0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende", dann aktualisiere "0_userdata.0.Aqua_Control.0.Strom.Zahlwert_Monatsende".

                          1 Reply Last reply Reply Quote 0
                          • Aphofis
                            Aphofis @Aphofis last edited by

                            Errechnet denn die Steuerung die unterschiedlichen Watt änderungen die Tagsüber so geschehen !?

                            paul53 1 Reply Last reply Reply Quote 0
                            • paul53
                              paul53 @Aphofis last edited by

                              @aphofis sagte: Errechnet denn die Steuerung die unterschiedlichen Watt änderungen die Tagsüber so geschehen !?

                              Bei jeder Wattänderung wird getriggert und neu berechnet.

                              Aphofis 1 Reply Last reply Reply Quote 0
                              • Aphofis
                                Aphofis @paul53 last edited by

                                @paul53
                                Das ja cool!
                                Es kann so einfach sein, wenn man weiß wie es geht.
                                EDIT: Erst Wert von "0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende", dann aktualisiere "0_userdata.0.Aqua_Control.0.Strom.Zahlwert_Monatsende".

                                finde ich irgendwie nicht
                                wie du das meinst

                                paul53 1 Reply Last reply Reply Quote 0
                                • paul53
                                  paul53 @Aphofis last edited by

                                  @aphofis sagte: finde ich irgendwie nicht

                                  Bild_2021-09-26_111610.png

                                  Es muss der gleiche Datenpunkt verwendet werden!

                                  Aphofis 1 Reply Last reply Reply Quote 0
                                  • Aphofis
                                    Aphofis @paul53 last edited by

                                    @paul53

                                    var energie, verbrauch_heute, morgen;
                                    
                                    
                                    // kWh
                                    energie = getState("0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total").val;
                                    on({id: 'hs100.0.192_168_0_28.power', change: "ne"}, async function (obj) {
                                      var value = obj.state.val;
                                      var oldValue = obj.oldState.val;
                                      energie = (typeof energie == 'number' ? energie : 0) + ((obj.oldState ? obj.oldState.val : "") * ((obj.state ? obj.state.lc : "") - (obj.oldState ? obj.oldState.lc : ""))) / 3600000000;
                                      setState("0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total"/*Stomzähler_Total*/, Math.round(energie*100)/100, true);
                                      verbrauch_heute = energie - getState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht").val;
                                      setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Aktuell"/*Stromverbrauch_Aktuell*/, Math.round(verbrauch_heute*100)/100, true);
                                    });
                                    schedule("59 59 23 * * *", async function () {
                                      setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Gestern"/*Stromverbrauch_Gestern*/, Math.round(verbrauch_heute*100)/100, true);
                                      setState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht"/*Stromzähler_Mitternacht*/, Math.round(energie*100)/100, true);
                                      morgen = (new Date().getTime()) + 2000;
                                      if (getDateObject(morgen).getDate() == 1) {
                                        setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letzter_Monat"/*Stromverbrauch_letzter_Monat*/, Math.round((energie - getState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende").val)*100)/100, true);
                                        setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letzter_Monat"/*Stromverbrauch_letzter_Monat*/, Math.round(energie*100)/100, true);
                                        if ((getDateObject(morgen).getMonth() + 1) == 1) {
                                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letztes_Jahr"/*Stromverbrauch_letztes_Jahr*/, Math.round((energie - getState("0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende").val)*100)/100, true);
                                          setState("0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende"/*Zählwert_Jahresende*/, Math.round(energie*100)/100, true);
                                        }
                                      }
                                    });
                                    

                                    jetzt aber !
                                    Wo packe ich denn kosten Tag, Monat und Jahr rein !?

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

                                      @aphofis sagte: jetzt aber !

                                      Nein, richtig:

                                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende", Math.round(energie*100)/100, true);
                                      
                                      Aphofis 1 Reply Last reply Reply Quote 0
                                      • Aphofis
                                        Aphofis @paul53 last edited by

                                        @paul53

                                        var energie, verbrauch_heute, morgen;
                                        
                                        
                                        // kWh
                                        energie = getState("0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total").val;
                                        on({id: 'hs100.0.192_168_0_28.power', change: "ne"}, async function (obj) {
                                          var value = obj.state.val;
                                          var oldValue = obj.oldState.val;
                                          energie = (typeof energie == 'number' ? energie : 0) + ((obj.oldState ? obj.oldState.val : "") * ((obj.state ? obj.state.lc : "") - (obj.oldState ? obj.oldState.lc : ""))) / 3600000000;
                                          setState("0_userdata.0.Aqua_Control.0.Strom.Stomzähler_Total"/*Stomzähler_Total*/, Math.round(energie*100)/100, true);
                                          verbrauch_heute = energie - getState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht").val;
                                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Aktuell"/*Stromverbrauch_Aktuell*/, Math.round(verbrauch_heute*100)/100, true);
                                        });
                                        schedule("59 59 23 * * *", async function () {
                                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_Gestern"/*Stromverbrauch_Gestern*/, Math.round(verbrauch_heute*100)/100, true);
                                          setState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Mitternacht"/*Stromzähler_Mitternacht*/, Math.round(energie*100)/100, true);
                                          morgen = (new Date().getTime()) + 2000;
                                          if (getDateObject(morgen).getDate() == 1) {
                                            setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letzter_Monat"/*Stromverbrauch_letzter_Monat*/, Math.round((energie - getState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende").val)*100)/100, true);
                                            setState("0_userdata.0.Aqua_Control.0.Strom.Stromzähler_Monatsende"/*Stromzähler_Monatsende*/, Math.round(energie*100)/100, true);
                                            if ((getDateObject(morgen).getMonth() + 1) == 1) {
                                              setState("0_userdata.0.Aqua_Control.0.Strom.Stromverbrauch_letztes_Jahr"/*Stromverbrauch_letztes_Jahr*/, Math.round((energie - getState("0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende").val)*100)/100, true);
                                              setState("0_userdata.0.Aqua_Control.0.Strom.Zählwert_Jahresende"/*Zählwert_Jahresende*/, Math.round(energie*100)/100, true);
                                            }
                                          }
                                        });
                                        
                                        1 Reply Last reply Reply Quote 0
                                        • paul53
                                          paul53 @Aphofis last edited by paul53

                                          @aphofis sagte: Wo packe ich denn kosten Tag, Monat und Jahr rein !?

                                          Hier angedeutet für Tag (gestern) und Monat:

                                          Bild_2021-09-26_113437.png

                                          Man sollte intern immer mit ungerundeten Werten rechnen - deshalb die zusätzlichen Variablen.

                                          Aphofis 1 Reply Last reply Reply Quote 0
                                          • Aphofis
                                            Aphofis @paul53 last edited by Aphofis

                                            @paul53 komme ich nicht wirklich mit klar!
                                            Ist das dann ein komplett neuer Trigger ?

                                            paul53 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            776
                                            Online

                                            32.0k
                                            Users

                                            80.4k
                                            Topics

                                            1.3m
                                            Posts

                                            blockly monitoring
                                            3
                                            54
                                            2255
                                            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