Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Strom Verbrauch und separat Überschuss berechnen

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Strom Verbrauch und separat Überschuss berechnen

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

      @heidepower sagte: Wäre das so richtig?

      Die richtige Maßeinheit: kWh

      H 1 Reply Last reply Reply Quote 0
      • Duffy
        Duffy @heidepower last edited by

        @heidepower

        Bei mir schaut es so aus.

        IMG_2446.jpeg

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

          @paul53
          Ja klar, kWh ist mir garnicht aufgefallen, dass ich kW ausgewählt hatte. Danke

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

            @paul53

            Also habe das Script jetzt ein paar Tage getestet. Funktioniert leider nicht richtig.

            Jede Nacht setze ich die Datenpunkte entsprechend zurück. Anhand meinem PV Ertrag der mir mein Wechselrichter ausgibt, kann ich sehen das das Script nicht das macht was es machen soll.

            Hab den letzten Trigger auch schon auf „wurde geändert“ umgestellt. Hat aber leider auch nichts gebracht. Das seltsame ist, dass es Tage gibt da funktioniert das Script und Tage da stimmt es nicht. Wie jetzt gerade.

            3,35kWh PV Ertrag laut Wechselrichter und laut Script 10,96kWh
            1.png

            In Grafana habe ich den YieldTotal 2 Tage mitgeloggt, Startwert 1603,71kWh Endwert 1619,51.
            Also Sprünge sehe ich hier keine.
            1.png

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

              @heidepower sagte: Tage gibt da funktioniert das Script und Tage da stimmt es nicht.
              ... Sprünge sehe ich hier keine.

              Dann weiß ich auch nicht weiter.

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

                @paul53 sagte in Strom Verbrauch und separat Überschuss berechnen:

                Dann weiß ich auch nicht weiter.

                Kann es an der unterschiedlichen intervalle liegen?

                Der Stromzähler liefert mir alle 10sec einen Wert und der Wechselrichter alle 30sec!?

                Duffy 1 Reply Last reply Reply Quote 0
                • Duffy
                  Duffy @heidepower last edited by Duffy

                  @heidepower

                  so wie ich das erkenne schaust du nach den falschen Datenpunkten.

                  Du schaust auf die manuel erzeugten Datenpunkte. Um aber die z.B. Ersparnis pro Tag zu ermitteln musst du das über sourceanalytics machen. Siehe Hinweis von @paul53
                  Sourceanalytics gibt dir dann die Ersparnis für den jeweiligen Tag aus.

                  Bei mir sieht das in den manuellen Punkten so aus:

                  700af952-8f03-47d6-9503-7f4e9f6325c3-grafik.png

                  Das sind auch die Summen mehrerer Monate und unter Sourceanalytics z.B. für den Ertrag:

                  86c13c94-ce40-42dd-b25a-fe2b9d63aa7c-grafik.png

                  Hier sieht man das current day mit dem Wert aus der DTU übereinstimmt*:

                  28978fb8-d639-4e6e-a0b7-25c0157a11ca-grafik.png

                  *) Durch den Zeitversatz bei den Screenshots gibt es eine kleine Abweichung

                  Also sourceanalytics installieren einrichten und los gehts.

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    heidepower @Duffy last edited by

                    @duffy sagte in Strom Verbrauch und separat Überschuss berechnen:

                    aber die z.B. Ersparnis pro Tag zu ermitteln musst du das über sourceanalytics machen.

                    Ja da hast du recht. Da ich die manuel erzeugte Datenpunkte jede Nacht genullt habe, passt das doch wenn ich darauf schaue!? den in SA stehen die gleiche falsche Werte drin.

                    Ich habe jetzt gesehen das ich im IoBroker "Protokoll" mehrere JavaScript Fehler von andere Scripte habe. Die habe ich jetzt deaktiviert, evtl liegt es daran!?

                    Duffy 1 Reply Last reply Reply Quote 0
                    • Duffy
                      Duffy @heidepower last edited by Duffy

                      @heidepower

                      Ich bin jetzt kein Blockly Experte so wie @paul53 (auch mein Blockly stammt aus der Feder von Paul53) aber vielleicht steht nach dem nullen immer noch etwas in den Variablen was dann wieder hineingeschrieben wird. Sollte sich aber in Soureanalytics schon am 2. Tag nicht mehr auswirken.

                      Wie du in meinen Screenshots gesehen hast funktioniert aber das Blockly.

                      Hier noch mal mein tagesaktuelles Blockly:

                      <xml xmlns="https://developers.google.com/blockly/xml">
                        <variables>
                          <variable id="8QfIKsruysJpkfI_Laz=">Einspeiseenergie</variable>
                          <variable id="SDbPbz:OQ}DXoHFlfr6;">PV_Ertrag</variable>
                        </variables>
                        <block type="comment" id="/{Ww84~KL%rt`1Ipa4+M" x="188" y="63">
                          <field name="COMMENT">https://forum.iobroker.net/topic/63844/strom-verbrauch-und-separat-überschuss-berechnen/75</field>
                          <next>
                            <block type="variables_set" id="mbhzmxw}Olt:RED`$HM?">
                              <field name="VAR" id="8QfIKsruysJpkfI_Laz=">Einspeiseenergie</field>
                              <value name="VALUE">
                                <block type="get_value" id="fv.Pyn+=XNj3mBR^O*y#">
                                  <field name="ATTR">val</field>
                                  <field name="OID">0_userdata.0.PV_Einspeisung.PV_Einspeisung_Wh</field>
                                </block>
                              </value>
                              <next>
                                <block type="comment" id="zB]aZ2A+Q7t}Zj)v/Mp0">
                                  <field name="COMMENT">Leistung (W)</field>
                                  <next>
                                    <block type="on_ext" id="_s6W/4RK2_,Ax/VDHl=g">
                                      <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=".vLIJp|1X|EY%Ed2HG54">
                                          <field name="oid">sonoff.0.Stromzähler.MT681_Power_cur</field>
                                        </shadow>
                                      </value>
                                      <statement name="STATEMENT">
                                        <block type="controls_if" id="Ah1T+%Zg,Jwu12qd{clW">
                                          <value name="IF0">
                                            <block type="logic_compare" id="!}L8R}/%Elp$%K5Sl(9|">
                                              <field name="OP">LT</field>
                                              <value name="A">
                                                <block type="on_source" id="@I~zpvc}htlNbY?ce!NV">
                                                  <field name="ATTR">oldState.val</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <block type="math_number" id="[T?_,mrEXTI=ga^+u3N`">
                                                  <field name="NUM">0</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <statement name="DO0">
                                            <block type="comment" id="Oo~f?,+KUpsHqmTcN[WZ">
                                              <field name="COMMENT">Energie Wh</field>
                                              <next>
                                                <block type="math_change" id="pTtl{hR/]%qAvX;A2Fz=">
                                                  <field name="VAR" id="8QfIKsruysJpkfI_Laz=">Einspeiseenergie</field>
                                                  <value name="DELTA">
                                                    <shadow type="math_number" id="Uk@[+;hZ(9z{7j!R!*)~">
                                                      <field name="NUM">1</field>
                                                    </shadow>
                                                    <block type="math_arithmetic" id="WX:QVL4gOAnA.cJH9H`x" inline="false">
                                                      <field name="OP">DIVIDE</field>
                                                      <value name="A">
                                                        <shadow type="math_number" id="q*0#7)IKIdS}sN%W7tfw">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="math_arithmetic" id="BNX`[d!HLVfIwcXs86Ep">
                                                          <field name="OP">MULTIPLY</field>
                                                          <value name="A">
                                                            <shadow type="math_number" id="J)-A5vC7c^f~YA_D,D,?">
                                                              <field name="NUM">1</field>
                                                            </shadow>
                                                            <block type="on_source" id="gl7iH#}}_gADCuUu0y@8">
                                                              <field name="ATTR">oldState.val</field>
                                                            </block>
                                                          </value>
                                                          <value name="B">
                                                            <shadow type="math_number" id="l{SbNq,AT{hE]hFEqSB2">
                                                              <field name="NUM">1</field>
                                                            </shadow>
                                                            <block type="math_arithmetic" id="alN.)HWWpj`ZQ~Rfl5@{">
                                                              <field name="OP">MINUS</field>
                                                              <value name="A">
                                                                <shadow type="math_number" id="%(VU0;/9G!^AX,q%]9cr">
                                                                  <field name="NUM">1</field>
                                                                </shadow>
                                                                <block type="on_source" id="y(?#xOCCF%vh.)x/JL~!">
                                                                  <field name="ATTR">state.lc</field>
                                                                </block>
                                                              </value>
                                                              <value name="B">
                                                                <shadow type="math_number" id="j=obz_-g%yDMlIBeJ^aH">
                                                                  <field name="NUM">1</field>
                                                                </shadow>
                                                                <block type="on_source" id="TOgG)hcm*3c;`(IzwF`o">
                                                                  <field name="ATTR">oldState.lc</field>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <shadow type="math_number" id="@J,i[0seFL!841-ytv/]">
                                                          <field name="NUM">-3600000</field>
                                                        </shadow>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="update" id="p+(#|mvOG}YZ0iHd9]PX">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                      <field name="OID">0_userdata.0.PV_Einspeisung.PV_Einspeisung_Wh</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="math_round" id="`p6;Gl}=kxuj.7[Ft;Qh">
                                                          <field name="OP">ROUND</field>
                                                          <value name="NUM">
                                                            <shadow type="math_number" id="sETaomKPsuK^N:/J5Xpp">
                                                              <field name="NUM">3.1</field>
                                                            </shadow>
                                                            <block type="variables_get" id="v6mCa0tEa)Q%VFC$ULdS">
                                                              <field name="VAR" id="8QfIKsruysJpkfI_Laz=">Einspeiseenergie</field>
                                                            </block>
                                                          </value>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="comment" id="~Y5$,;#Tj$t)NCjk.%s9">
                                                          <field name="COMMENT">kWh</field>
                                                          <next>
                                                            <block type="update" id="SWrTagNZQwe(2KATCQS9">
                                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                              <field name="OID">0_userdata.0.PV_Einspeisung.PV_Einspeisung_kWh</field>
                                                              <field name="WITH_DELAY">FALSE</field>
                                                              <value name="VALUE">
                                                                <block type="math_rndfixed" id="rJP5R]kttn]Ed$IWmVAl">
                                                                  <field name="n">2</field>
                                                                  <value name="x">
                                                                    <shadow type="math_number" id="{Y|ngg7w[4zjmaTV:ZL0">
                                                                      <field name="NUM">3.1234</field>
                                                                    </shadow>
                                                                    <block type="math_arithmetic" id="s0df=%jV0^edxx?OPKbk">
                                                                      <field name="OP">DIVIDE</field>
                                                                      <value name="A">
                                                                        <shadow type="math_number" id="?@AC3,[p[pY]*pzs/uqL">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="variables_get" id="iF[Ynm5;JlzOvt3[R`I}">
                                                                          <field name="VAR" id="8QfIKsruysJpkfI_Laz=">Einspeiseenergie</field>
                                                                        </block>
                                                                      </value>
                                                                      <value name="B">
                                                                        <shadow type="math_number" id="j@Rsu6yq3w4Ti+ZJ7$V7">
                                                                          <field name="NUM">1000</field>
                                                                        </shadow>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </next>
                                                </block>
                                              </next>
                                            </block>
                                          </statement>
                                        </block>
                                      </statement>
                                      <next>
                                        <block type="variables_set" id="Hq?}d)?smw_)GbI[X%_O">
                                          <field name="VAR" id="SDbPbz:OQ}DXoHFlfr6;">PV_Ertrag</field>
                                          <value name="VALUE">
                                            <block type="get_value" id="8eFA4h.5dy5i4BTB5mgW">
                                              <field name="ATTR">val</field>
                                              <field name="OID">0_userdata.0.PV_Ertrag.PV_Ertrag</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="on_ext" id="39Zyh3,]?dT$Snl?%Iju">
                                              <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="0BA(E[a8n0|p]kHrF(JB">
                                                  <field name="oid">opendtu.0.total.yieldtotal</field>
                                                </shadow>
                                              </value>
                                              <statement name="STATEMENT">
                                                <block type="math_change" id="h%%#,jKHpq1uu*I+0M)H">
                                                  <field name="VAR" id="SDbPbz:OQ}DXoHFlfr6;">PV_Ertrag</field>
                                                  <value name="DELTA">
                                                    <shadow type="math_number" id=":2|w+1{Z4wgjt.jm8/NV">
                                                      <field name="NUM">1</field>
                                                    </shadow>
                                                    <block type="math_arithmetic" id="z{iBC$3[A!q~q,p-qCWo">
                                                      <field name="OP">MINUS</field>
                                                      <value name="A">
                                                        <shadow type="math_number" id="#cf[4jtT2a$7wH6ai.7/">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="on_source" id="`%4:X]97$%4iza!OkG5}">
                                                          <field name="ATTR">state.val</field>
                                                        </block>
                                                      </value>
                                                      <value name="B">
                                                        <shadow type="math_number" id="u:0W0|1=v%?MyadaBn1H">
                                                          <field name="NUM">1</field>
                                                        </shadow>
                                                        <block type="on_source" id="LUhI|.bpz85EPa8ENhHx">
                                                          <field name="ATTR">oldState.val</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </value>
                                                  <next>
                                                    <block type="update" id="ag%ciS8dt92qUrV8Gu8%">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                      <field name="OID">0_userdata.0.PV_Ertrag.PV_Ertrag</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="variables_get" id="ts63{FF??1N7X]~oPL{W">
                                                          <field name="VAR" id="SDbPbz:OQ}DXoHFlfr6;">PV_Ertrag</field>
                                                        </block>
                                                      </value>
                                                      <next>
                                                        <block type="update" id="(csCPu{!sQBEgT[`,XJ2">
                                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                          <field name="OID">0_userdata.0.PV_Ersparnis.Ersparnis_kWh</field>
                                                          <field name="WITH_DELAY">FALSE</field>
                                                          <value name="VALUE">
                                                            <block type="math_rndfixed" id="%ZF=}T8DCk7,f%7twN~p">
                                                              <field name="n">2</field>
                                                              <value name="x">
                                                                <shadow type="math_number" id="(RpiGL[FCghz3wNH28|!">
                                                                  <field name="NUM">3.1234</field>
                                                                </shadow>
                                                                <block type="math_arithmetic" id="?g*)8}Sn2{Nv7c^mv)(%">
                                                                  <field name="OP">MINUS</field>
                                                                  <value name="A">
                                                                    <shadow type="math_number" id="D3}dw(Z6W2`5HEyk[@Kb">
                                                                      <field name="NUM">1</field>
                                                                    </shadow>
                                                                    <block type="variables_get" id="cRRG5Xp/`uyu_%xjS;iN">
                                                                      <field name="VAR" id="SDbPbz:OQ}DXoHFlfr6;">PV_Ertrag</field>
                                                                    </block>
                                                                  </value>
                                                                  <value name="B">
                                                                    <shadow type="math_number" id="EDrD2WO$F#1Cw%|{U)7_">
                                                                      <field name="NUM">1</field>
                                                                    </shadow>
                                                                    <block type="math_arithmetic" id="j+UCQApe[olx#Vbe8$Z:">
                                                                      <field name="OP">DIVIDE</field>
                                                                      <value name="A">
                                                                        <shadow type="math_number" id="p=^0~m8DpJCAliSe)5X3">
                                                                          <field name="NUM">1</field>
                                                                        </shadow>
                                                                        <block type="variables_get" id="qcbR.0#nEY0r0]PvzXsi">
                                                                          <field name="VAR" id="8QfIKsruysJpkfI_Laz=">Einspeiseenergie</field>
                                                                        </block>
                                                                      </value>
                                                                      <value name="B">
                                                                        <shadow type="math_number" id="gsLF;/(,M)2)utesU;o+">
                                                                          <field name="NUM">1000</field>
                                                                        </shadow>
                                                                      </value>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </value>
                                                          <next>
                                                            <block type="debug" id="#T[Pl*fwLqYq*8EK}Nl)">
                                                              <field name="Severity">info</field>
                                                              <value name="TEXT">
                                                                <shadow type="text" id="6QdvIXj_d3va[i.l2pL8">
                                                                  <field name="TEXT">test</field>
                                                                </shadow>
                                                                <block type="text_join" id="`%((7Q{A2XMLeRy4xE29">
                                                                  <mutation items="2"></mutation>
                                                                  <value name="ADD0">
                                                                    <block type="variables_get" id=";UjjaW^%:SbBU]wPA^7G">
                                                                      <field name="VAR" id="SDbPbz:OQ}DXoHFlfr6;">PV_Ertrag</field>
                                                                    </block>
                                                                  </value>
                                                                </block>
                                                              </value>
                                                            </block>
                                                          </next>
                                                        </block>
                                                      </next>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </xml>
                      

                      VG Duffy

                      H 1 Reply Last reply Reply Quote 0
                      • H
                        heidepower @Duffy last edited by heidepower

                        @duffy

                        Das deakiveren der Scripte die Fehlermlungen bringen, hat nichts gebracht. Aufjedenfall passt es heuet wieder nicht. Ich Nulle es jetz mal nicht und schau dann in denn SA Datenpunkte nach. Evtl. ist das so, dass der erste Tage nicht stimmt. Kanns mir aber kaum vorstellen.

                        Mir ist aufgefallen, wenn ich die Werte mitten im Tag Nulle. Und dann Abends in den Datenpunkte nachschau, passt es!

                        Duffy 1 Reply Last reply Reply Quote 0
                        • Duffy
                          Duffy @heidepower last edited by

                          @heidepower

                          Klappt es jetzt ?

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          311
                          Online

                          31.7k
                          Users

                          79.8k
                          Topics

                          1.3m
                          Posts

                          18
                          155
                          15634
                          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