Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Gelöst: dynamische strompreise berechnen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    Gelöst: dynamische strompreise berechnen

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

      Hi zusammen, ich bräuchte hier mal wieder eure Hilfe.

      Zum Problem: ich bin bei einem Stromanbieter mit dynamischen Preisen, das heißt jede Stunde neuer Strompreis, so nun würde ich dies gerne berechnen wenn meine Verbraucher eingeschaltet sind. Nur das Problem was ich habe, wenn die Laufzeit über die Stunde hinausgeht und eine neue Stunde angefangen wird, dann stehe ich auf dem Schlauch.

      Meine Datenpunkte:

      1. einen Boolean der auf True oder false geschalten wird um die Verbraucher zu steuern.
      2. Einen Datenpunkt wo die KWH berechnet werden.
      3. Datenpunkte für die Zeit z.B: 0Uhr bis 1 Uhr Preis von 0.3€, oder 1 Uhr bis 2 Uhr Preis 0,28€

      Mein Script sieht nun folgendermaßen aus.

      <xml xmlns="https://developers.google.com/blockly/xml">
        <variables>
          <variable id="DV2Z@YFTww|R_|`Mkr=1">festpreis-stromeinkauf</variable>
          <variable id="y7:6!S;8,wru/-v9E9^N">kwh-stand-netzbezug-alt</variable>
          <variable id="nY!}Wk.j6B!#/MAznG9e">kwh-stand-netzbezug-neu</variable>
          <variable id="Q)DM}zP6$u%B+C!anU5#">verbrauchte-kwh</variable>
          <variable id="_|I^SBh:7[Cc_y!5xTsV">preis-für verbrauchte-kwh</variable>
          <variable id="fhDR$~Xtk+~C5@`PZ^WP">preis-für-verbrauchte-kwh-festpreis</variable>
          <variable id="~lY~IrBDOLgQBEY4@Dj6">ersparnis</variable>
        </variables>
        <block type="on_ext" id="hQNuw`QjPkFy)hi*n{bX" x="188" y="63">
          <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="F%(6Ljdj,*g]{0KsJfhN">
              <field name="oid">0_userdata.0.SB_10_manuell_laden</field>
            </shadow>
          </value>
          <statement name="STATEMENT">
            <block type="variables_set" id="#|=]Nlv/~3Yt^xVVRa~O">
              <field name="VAR" id="DV2Z@YFTww|R_|`Mkr=1">festpreis-stromeinkauf</field>
              <value name="VALUE">
                <block type="math_number" id="lL9@d)AQc+[|~:n-y({A">
                  <field name="NUM">0.484</field>
                </block>
              </value>
              <next>
                <block type="comment" id="`r3nzygw;9icBXl`9rB$">
                  <field name="COMMENT">Preise für das Batterie laden</field>
                  <next>
                    <block type="controls_if" id="TXJfr|88+M:S=x_zSCv`">
                      <value name="IF0">
                        <block type="logic_compare" id="63w#Y-NP4]}tle4)vfv%">
                          <field name="OP">EQ</field>
                          <value name="A">
                            <block type="get_value" id="d*mi;RBKiw+@4Le%M5V$">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.SB_10_manuell_laden</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_boolean" id=")yt_eKi8(IgmTGU]JI,8">
                              <field name="BOOL">TRUE</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO0">
                        <block type="variables_set" id="sgJOnqV~wznY-BjS0odl">
                          <field name="VAR" id="y7:6!S;8,wru/-v9E9^N">kwh-stand-netzbezug-alt</field>
                          <value name="VALUE">
                            <block type="get_value" id="zj)8Fp?:p2:ukc7|jeWt">
                              <field name="ATTR">val</field>
                              <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                            </block>
                          </value>
                        </block>
                      </statement>
                      <next>
                        <block type="controls_if" id="[zQHZ/xyW{Zl];)$9RK[">
                          <value name="IF0">
                            <block type="logic_compare" id="yrwW,?AS=3KBcVK*IQe0">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="];lqSHHHd4OJM^(lc[$T">
                                  <field name="ATTR">val</field>
                                  <field name="OID">0_userdata.0.SB_10_manuell_laden</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="=E|?LV3X?2H@3nVD43.O">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO0">
                            <block type="variables_set" id="cekz$e)Tes?5t.{|%Og+">
                              <field name="VAR" id="nY!}Wk.j6B!#/MAznG9e">kwh-stand-netzbezug-neu</field>
                              <value name="VALUE">
                                <block type="get_value" id="?2+l5J-,5Yzy?%6^g@H?">
                                  <field name="ATTR">val</field>
                                  <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                </block>
                              </value>
                            </block>
                          </statement>
                          <next>
                            <block type="variables_set" id="L2C.pnnAX|t*Np3-k?!1">
                              <field name="VAR" id="Q)DM}zP6$u%B+C!anU5#">verbrauchte-kwh</field>
                              <value name="VALUE">
                                <block type="math_arithmetic" id="(HnS~@S-L1WH.3k?zGI?">
                                  <field name="OP">MINUS</field>
                                  <value name="A">
                                    <shadow type="math_number" id="@C*{(F+wxdBZ-Ot2YyEM">
                                      <field name="NUM">1</field>
                                    </shadow>
                                    <block type="variables_get" id="i3O|E]bp]$Ov7u5RoToE">
                                      <field name="VAR" id="nY!}Wk.j6B!#/MAznG9e">kwh-stand-netzbezug-neu</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <shadow type="math_number" id="pR!wKQ6Wn:VC,m{#7M_:">
                                      <field name="NUM">1</field>
                                    </shadow>
                                    <block type="variables_get" id="$@_d)`d1LN|($KVp#O[+">
                                      <field name="VAR" id="y7:6!S;8,wru/-v9E9^N">kwh-stand-netzbezug-alt</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="controls_if" id="^Q{Z|jelSuHoN_+N3:Ja">
                                  <value name="IF0">
                                    <block type="time_compare" id="%|?j8@A9/)n.x_Dh:J3~">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true"></mutation>
                                      <field name="OPTION">between</field>
                                      <field name="START_TIME">00:00</field>
                                      <field name="END_TIME">01:00</field>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="variables_set" id="G?,{zV}s*iT[wKd^n!9y">
                                      <field name="VAR" id="_|I^SBh:7[Cc_y!5xTsV">preis-für verbrauchte-kwh</field>
                                      <value name="VALUE">
                                        <block type="math_arithmetic" id="LbviU5^Wz((]Ee)@I,7V">
                                          <field name="OP">MULTIPLY</field>
                                          <value name="A">
                                            <shadow type="math_number" id="s_@2C;2:x4Q:0PTg,+K)">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="variables_get" id="bv9k%xZJ9uYp~uSZ`/,v">
                                              <field name="VAR" id="Q)DM}zP6$u%B+C!anU5#">verbrauchte-kwh</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id="{=f}fGP[x2v=,A5zf8g}">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id="oDmii2Po%Tfv0J/c.%[*">
                                              <field name="ATTR">val</field>
                                              <field name="OID">tibber.0.priceInfo.today.00.total</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="[3u@aG/ryu$UnjgqYiE`">
                                          <field name="VAR" id="fhDR$~Xtk+~C5@`PZ^WP">preis-für-verbrauchte-kwh-festpreis</field>
                                          <value name="VALUE">
                                            <block type="math_arithmetic" id="I%+La/_@MN)W9YZ(1~@W">
                                              <field name="OP">MULTIPLY</field>
                                              <value name="A">
                                                <shadow type="math_number">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="i`b,ie$y/c-)bXqzZadE">
                                                  <field name="VAR" id="Q)DM}zP6$u%B+C!anU5#">verbrauchte-kwh</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <shadow type="math_number" id="KL.Fi2;MGyQT3]~2P|TG">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="9{0APM/X|!|O~h:#=i$*">
                                                  <field name="VAR" id="DV2Z@YFTww|R_|`Mkr=1">festpreis-stromeinkauf</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="variables_set" id="Kh=;a4o)%x4z(kue@]4m">
                                              <field name="VAR" id="~lY~IrBDOLgQBEY4@Dj6">ersparnis</field>
                                              <value name="VALUE">
                                                <block type="math_arithmetic" id="Se5a57VMcj1qUP@ap,dA">
                                                  <field name="OP">MINUS</field>
                                                  <value name="A">
                                                    <shadow type="math_number" id="rxs:ImM:a[J[?]muK)r}">
                                                      <field name="NUM">1</field>
                                                    </shadow>
                                                    <block type="variables_get" id="t5[oPH4J(l+`#Y%PFe])">
                                                      <field name="VAR" id="fhDR$~Xtk+~C5@`PZ^WP">preis-für-verbrauchte-kwh-festpreis</field>
                                                    </block>
                                                  </value>
                                                  <value name="B">
                                                    <shadow type="math_number" id="+l[Mh^vvd$nm(5y15O*Z">
                                                      <field name="NUM">1</field>
                                                    </shadow>
                                                    <block type="variables_get" id="QFDa8D|k!knG4hXOmkZ?">
                                                      <field name="VAR" id="_|I^SBh:7[Cc_y!5xTsV">preis-für verbrauchte-kwh</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </next>
            </block>
          </statement>
        </block>
      </xml>
      

      Und als Bild:
      tibber strompreisberechnung.jpg

      Hat da jemand eine Idee, wie ich das umsetzen könnte.

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

        @babl sagte: jede Stunde neuer Strompreis

        In einem Datenpunkt ("total")? Dann triggere zusätzlich auf diesen Datenpunkt und führe die Berechnung mit dem neuen Strompreis fort.

        B 1 Reply Last reply Reply Quote 1
        • B
          babl @paul53 last edited by

          @paul53 danke dir, manchmal sieht man den wald vor lauter bäumen nicht, und wäre so einfach.

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

            @babl sagte: wäre so einfach.

            Vorschlag:

            Bild_2022-12-01_175822017.png

            B 1 Reply Last reply Reply Quote 1
            • B
              babl @paul53 last edited by

              @paul53 da war ich wohl wieder zu selbstsicher, mit dem wäre so einfach, habs selbst leider nicht hinbekommen, habe nun dein script nachgebaut, aber hier habe ich ein problem wenn es über die stunde springt, dann rechnet da irgendwas falsch. bin aber auch noch nicht dahintergekommen wie und was, dein script habe ich zum größten teil kapiert, bis auf das erhöhe, warum?

              wenn du vielleicht so nett wärst und mein script mal testest, und mir dann sagst wo hier der fehler liegen würde. vielleicht komme ich dann dahinter, ich weiß es nämlich nicht. im 2. teil des triggers werden aber die reichtigen werte (stunde vorher) genommen, entweder habe ich hier komplett was falsches zusammengerechnet. ich kopiers dir mal hier ganz rein.

              <xml xmlns="https://developers.google.com/blockly/xml">
                <variables>
                  <variable id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</variable>
                  <variable id="7f!Gru7lC=%kpN^~{Q,9">Kosten_letzte_Stunde</variable>
                  <variable id="mF/M_`BC;9tQ27;~)Kbi">Kosten</variable>
                  <variable id="XF(B8MHPNA|eIDK(5LE4">verbrauch_kwh</variable>
                </variables>
                <block type="variables_set" id="f(Impw@FbLMot:4tHn9)" x="63" y="88">
                  <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                  <value name="VALUE">
                    <block type="get_value" id="%zwH}7swA`wsSE_xpl!+">
                      <field name="ATTR">val</field>
                      <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                    </block>
                  </value>
                  <next>
                    <block type="variables_set" id="8QjP{,ABWGo{?@kz]]h/">
                      <field name="VAR" id="7f!Gru7lC=%kpN^~{Q,9">Kosten_letzte_Stunde</field>
                      <value name="VALUE">
                        <block type="math_number" id="krcx/{eaKV3ruP!2S.-m">
                          <field name="NUM">0</field>
                        </block>
                      </value>
                      <next>
                        <block type="on_ext" id="I|k$!JS[Z/E3JHtWDT_w">
                          <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="+bCQzw0[Z0*;H;%:CHoL">
                              <field name="oid">0_userdata.0.SB_10_manuell_laden</field>
                            </shadow>
                          </value>
                          <statement name="STATEMENT">
                            <block type="controls_if" id="G1EVoPhC%xx|%num]%Uz">
                              <mutation else="1"></mutation>
                              <value name="IF0">
                                <block type="on_source" id=",XiBVQbvl@]c[k9hE72P">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <statement name="DO0">
                                <block type="variables_set" id="{w-Wf*y?0BX-i]qsCny?">
                                  <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                  <value name="VALUE">
                                    <block type="get_value" id="VP$b-Gc*I#~TDnHt`y9N">
                                      <field name="ATTR">val</field>
                                      <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="L/}|ZJ){q4cQK`H7bI9M">
                                      <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                      <value name="VALUE">
                                        <block type="math_number" id="w,=2S;vWAQ]y(r3N#JvI">
                                          <field name="NUM">0</field>
                                        </block>
                                      </value>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                              <statement name="ELSE">
                                <block type="variables_set" id="ODF|]j6EfjBFxJUXDLYh">
                                  <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                  <value name="VALUE">
                                    <block type="math_arithmetic" id="1-g856BSw%8`7bV5y^YX" inline="false">
                                      <field name="OP">MULTIPLY</field>
                                      <value name="A">
                                        <shadow type="math_number" id=",YmSizo08~k2Kdu]nm_I">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="get_value" id="L2N[9lo,YwlVz;rraw4f">
                                          <field name="ATTR">val</field>
                                          <field name="OID">tibber.0.priceInfo.current.total</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number" id="J)vkcIKw#*]=8%=zSDVj">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="math_arithmetic" id="w%E~OkTN(e@o9+iVwvY0">
                                          <field name="OP">MINUS</field>
                                          <value name="A">
                                            <shadow type="math_number" id=".Yu#^d7D,*$t_XzR/sDW">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id="z3JeZ:FG1y3Nwn[8KTvA">
                                              <field name="ATTR">val</field>
                                              <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number" id=")yXjkl:.bV=bb2%|0N0;">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="variables_get" id="oJ6Yk,`3j%%Wz,379+M/">
                                              <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="^pPLl)OylG!.KRJ=AR3,">
                                      <field name="VAR" id="XF(B8MHPNA|eIDK(5LE4">verbrauch_kwh</field>
                                      <value name="VALUE">
                                        <block type="math_arithmetic" id="Kx@ha8z,xaB7;:b~r@}j">
                                          <field name="OP">MINUS</field>
                                          <value name="A">
                                            <shadow type="math_number">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id="scW%J4Z(hI2W@DY(dY-C">
                                              <field name="ATTR">val</field>
                                              <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="variables_get" id="T?/SP|*Y_#Wik.P76)FY">
                                              <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="update" id="EGM}$Q:?(5ru_6[n~i0k">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="math_arithmetic" id="R}e_S)A_6A5Ecctjzx(w">
                                              <field name="OP">ADD</field>
                                              <value name="A">
                                                <shadow type="math_number" id="0qv0ozo-bUpx5uhvhE^w">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="=k~m{lCc~%Q6[:mU,amL">
                                                  <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                                </block>
                                              </value>
                                              <value name="B">
                                                <shadow type="math_number" id="HP3;~AqR=pma7RBIJ^sk">
                                                  <field name="NUM">1</field>
                                                </shadow>
                                                <block type="variables_get" id="0$jUnP0UA-JD+7S@Q`hS">
                                                  <field name="VAR" id="7f!Gru7lC=%kpN^~{Q,9">Kosten_letzte_Stunde</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="update" id="o#$9,br8MrIrK:y1}|fS">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="variables_get" id="`9u~e342nZQ1AmKul^t2">
                                                  <field name="VAR" id="XF(B8MHPNA|eIDK(5LE4">verbrauch_kwh</field>
                                                </block>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </statement>
                          <next>
                            <block type="on_ext" id="xY{E]_r$nK7:GmjKI4HI">
                              <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="jC5AUn]cZ)!dR|zPhbd4">
                                  <field name="oid">tibber.0.priceInfo.current.total</field>
                                </shadow>
                              </value>
                              <statement name="STATEMENT">
                                <block type="variables_set" id="AHev;Wshm1x4K#iDUch5">
                                  <field name="VAR" id="7f!Gru7lC=%kpN^~{Q,9">Kosten_letzte_Stunde</field>
                                  <value name="VALUE">
                                    <block type="math_arithmetic" id="dC^+t{P9f+Sx9w;|nk@`">
                                      <field name="OP">MULTIPLY</field>
                                      <value name="A">
                                        <shadow type="math_number" id="ukRC~;/{9!0o]i{xymI*">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="on_source" id="qj/d~$DMnCBwc7^UnZz0">
                                          <field name="ATTR">oldState.val</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="math_arithmetic" id="4,Qb4`;adLZ?y?[yP3uT">
                                          <field name="OP">MINUS</field>
                                          <value name="A">
                                            <shadow type="math_number">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="get_value" id="_r_dqp:zvl7?_!eU?amF">
                                              <field name="ATTR">val</field>
                                              <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <shadow type="math_number">
                                              <field name="NUM">1</field>
                                            </shadow>
                                            <block type="variables_get" id="+2sd7tZ5/XyOM%R*jOtI">
                                              <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <next>
                                    <block type="variables_set" id="IMz-bO[CwqJ)(W1^7CQ4">
                                      <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                      <value name="VALUE">
                                        <block type="get_value" id="nvt1|ycu|YVOZn^#QO]w">
                                          <field name="ATTR">val</field>
                                          <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                        </block>
                                      </value>
                                    </block>
                                  </next>
                                </block>
                              </statement>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
                <block type="on_ext" id="{S+ieK;*:-7*^WRqLx.e" x="115" y="972">
                  <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=".FpvT~gI9q1M^BUf}]wH">
                      <field name="oid">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                    </shadow>
                  </value>
                  <statement name="STATEMENT">
                    <block type="update" id=":opV82uV:D8*8kDt$0xv">
                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                      <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                      <field name="WITH_DELAY">TRUE</field>
                      <field name="DELAY_MS">2</field>
                      <field name="UNIT">sec</field>
                      <field name="CLEAR_RUNNING">FALSE</field>
                      <value name="VALUE">
                        <block type="math_arithmetic" id="*q+s@hq[DePBP3B^|V4K">
                          <field name="OP">ADD</field>
                          <value name="A">
                            <shadow type="math_number" id="[:VaP^P^EmQVkY}1Sva%">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="get_value" id="zgppA70QM!W@A.{/]Kix">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                            </block>
                          </value>
                          <value name="B">
                            <shadow type="math_number">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="get_value" id="2FN_Orib60ub],,DZS+H">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </statement>
                </block>
                <block type="on_ext" id="tBmG-/JKxX_*w4KdWDbh" x="88" y="1238">
                  <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=")q6~lL^JKZdRQ;HXIV0~">
                      <field name="oid">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                    </shadow>
                  </value>
                  <statement name="STATEMENT">
                    <block type="update" id="xA*D=9/sy.zOp{3EasuY">
                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                      <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                      <field name="WITH_DELAY">FALSE</field>
                      <value name="VALUE">
                        <block type="math_arithmetic" id="H(|HOjm#Jd_fG9sqK|_R">
                          <field name="OP">ADD</field>
                          <value name="A">
                            <shadow type="math_number">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="get_value" id="lHbCy=:L?XI-1M]_j$8Y">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                            </block>
                          </value>
                          <value name="B">
                            <shadow type="math_number">
                              <field name="NUM">1</field>
                            </shadow>
                            <block type="get_value" id="z|/9gkc2z@zI}cj8$=bL">
                              <field name="ATTR">val</field>
                              <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <next>
                        <block type="update" id="-HNLF,(twL$fMSn@]-eN">
                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                          <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                          <field name="WITH_DELAY">FALSE</field>
                          <value name="VALUE">
                            <block type="math_arithmetic" id="E/6~-7Eb]ccHKE[|6wNB">
                              <field name="OP">MULTIPLY</field>
                              <value name="A">
                                <shadow type="math_number">
                                  <field name="NUM">1</field>
                                </shadow>
                                <block type="get_value" id="YDMlssEP$|C9#H{1m|?w">
                                  <field name="ATTR">val</field>
                                  <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                </block>
                              </value>
                              <value name="B">
                                <shadow type="math_number">
                                  <field name="NUM">1</field>
                                </shadow>
                                <block type="get_value" id="wtrjOCDXo+7vhl=ktZpr">
                                  <field name="ATTR">val</field>
                                  <field name="OID">0_userdata.0.Tibber.Strompreis_Festpreis</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <next>
                            <block type="update" id="VkHBz-t+mU7.d{8W+G|G">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="math_arithmetic" id="RB`(yw-{r5uiL:a*0|GY">
                                  <field name="OP">ADD</field>
                                  <value name="A">
                                    <shadow type="math_number">
                                      <field name="NUM">1</field>
                                    </shadow>
                                    <block type="get_value" id="kzl5nM?F1L1kfskZ`g9p">
                                      <field name="ATTR">val</field>
                                      <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                    </block>
                                  </value>
                                  <value name="B">
                                    <shadow type="math_number">
                                      <field name="NUM">1</field>
                                    </shadow>
                                    <block type="get_value" id="d9bWX@W,,G7`T[x,}EX/">
                                      <field name="ATTR">val</field>
                                      <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                                    </block>
                                  </value>
                                </block>
                              </value>
                              <next>
                                <block type="update" id="6:~X:]aqJoY1qRnzlWMX">
                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                  <field name="OID">0_userdata.0.Tibber.Ersparnis</field>
                                  <field name="WITH_DELAY">FALSE</field>
                                  <value name="VALUE">
                                    <block type="math_arithmetic" id="8}tP5Pmz:+#H.=Xfuv#r">
                                      <field name="OP">MINUS</field>
                                      <value name="A">
                                        <shadow type="math_number">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="get_value" id="{PB|VZ+FG6!Q3%MYx)UM">
                                          <field name="ATTR">val</field>
                                          <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <shadow type="math_number">
                                          <field name="NUM">1</field>
                                        </shadow>
                                        <block type="get_value" id=";hm`/`LUvZ|8mA,YrR({">
                                          <field name="ATTR">val</field>
                                          <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </statement>
                </block>
              </xml>
              
              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @babl last edited by paul53

                @babl sagte: bis auf das erhöhe, warum?

                Da sich der Arbeitspreis jede Stunde ändern kann, erhöhen sich die Kosten bei jeder Preisänderung um die Kosten mit dem vorherigen Preis. Die Variable KWH-Ein wird bei jeder Preisänderung nachgezogen. Sie taugt deshalb nicht zur Verbrauchsermittlung.

                <xml xmlns="https://developers.google.com/blockly/xml">
                 <variables>
                   <variable id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</variable>
                   <variable id="mF/M_`BC;9tQ27;~)Kbi">Kosten</variable>
                   <variable id="yli#ydUr0RWm~eEx_+qc">kWhStart</variable>
                   <variable id="GcZ0LGBgi2+CQDV+Ml8U">kWhEnde</variable>
                   <variable id="1FxLO6;u5+HXu78D?dr~">kWhStunde</variable>
                 </variables>
                 <block type="variables_set" id="f(Impw@FbLMot:4tHn9)" x="63" y="88">
                   <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                   <value name="VALUE">
                     <block type="get_value" id="%zwH}7swA`wsSE_xpl!+">
                       <field name="ATTR">val</field>
                       <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                     </block>
                   </value>
                   <next>
                     <block type="variables_set" id="8QjP{,ABWGo{?@kz]]h/">
                       <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                       <value name="VALUE">
                         <block type="math_number" id="krcx/{eaKV3ruP!2S.-m">
                           <field name="NUM">0</field>
                         </block>
                       </value>
                       <next>
                         <block type="variables_set" id="aKBC7~ZF5s-Y4ocrU3]-">
                           <field name="VAR" id="yli#ydUr0RWm~eEx_+qc">kWhStart</field>
                           <value name="VALUE">
                             <block type="variables_get" id="mKs:yvT6pf)(+m*DN@4[">
                               <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                             </block>
                           </value>
                           <next>
                             <block type="on_ext" id="I|k$!JS[Z/E3JHtWDT_w">
                               <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="+bCQzw0[Z0*;H;%:CHoL">
                                   <field name="oid">0_userdata.0.SB_10_manuell_laden</field>
                                 </shadow>
                               </value>
                               <statement name="STATEMENT">
                                 <block type="controls_if" id="G1EVoPhC%xx|%num]%Uz">
                                   <mutation else="1"></mutation>
                                   <value name="IF0">
                                     <block type="on_source" id=",XiBVQbvl@]c[k9hE72P">
                                       <field name="ATTR">state.val</field>
                                     </block>
                                   </value>
                                   <statement name="DO0">
                                     <block type="variables_set" id="{w-Wf*y?0BX-i]qsCny?">
                                       <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                       <value name="VALUE">
                                         <block type="get_value" id="VP$b-Gc*I#~TDnHt`y9N">
                                           <field name="ATTR">val</field>
                                           <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="variables_set" id="??:W/Nd/3Zp*@AhV=%$0">
                                           <field name="VAR" id="yli#ydUr0RWm~eEx_+qc">kWhStart</field>
                                           <value name="VALUE">
                                             <block type="variables_get" id="FPOd?Q-Ead?/U)muJonY">
                                               <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id="L/}|ZJ){q4cQK`H7bI9M">
                                               <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                               <value name="VALUE">
                                                 <block type="math_number" id="w,=2S;vWAQ]y(r3N#JvI">
                                                   <field name="NUM">0</field>
                                                 </block>
                                               </value>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </statement>
                                   <statement name="ELSE">
                                     <block type="variables_set" id="H-OWOCnVehtKG^6qiq@3">
                                       <field name="VAR" id="GcZ0LGBgi2+CQDV+Ml8U">kWhEnde</field>
                                       <value name="VALUE">
                                         <block type="get_value" id="z3JeZ:FG1y3Nwn[8KTvA">
                                           <field name="ATTR">val</field>
                                           <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="math_change" id="[15V=b-1%miyl`w}tky0">
                                           <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                           <value name="DELTA">
                                             <shadow type="math_number" id="8Sn,@`@iT_M2gG|:phv)">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="math_arithmetic" id="1-g856BSw%8`7bV5y^YX" inline="false">
                                               <field name="OP">MULTIPLY</field>
                                               <value name="A">
                                                 <shadow type="math_number" id=",YmSizo08~k2Kdu]nm_I">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="get_value" id="L2N[9lo,YwlVz;rraw4f">
                                                   <field name="ATTR">val</field>
                                                   <field name="OID">tibber.0.priceInfo.current.total</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number" id="J)vkcIKw#*]=8%=zSDVj">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="math_arithmetic" id="w%E~OkTN(e@o9+iVwvY0">
                                                   <field name="OP">MINUS</field>
                                                   <value name="A">
                                                     <shadow type="math_number" id=".Yu#^d7D,*$t_XzR/sDW">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="variables_get" id="o)Vcy_OR-bIC6+Loi0X4">
                                                       <field name="VAR" id="GcZ0LGBgi2+CQDV+Ml8U">kWhEnde</field>
                                                     </block>
                                                   </value>
                                                   <value name="B">
                                                     <shadow type="math_number" id=")yXjkl:.bV=bb2%|0N0;">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="variables_get" id="oJ6Yk,`3j%%Wz,379+M/">
                                                       <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="update" id="EGM}$Q:?(5ru_6[n~i0k">
                                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber</field>
                                               <field name="WITH_DELAY">FALSE</field>
                                               <value name="VALUE">
                                                 <block type="variables_get" id="=k~m{lCc~%Q6[:mU,amL">
                                                   <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="update" id="o#$9,br8MrIrK:y1}|fS">
                                                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                   <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                                   <field name="WITH_DELAY">FALSE</field>
                                                   <value name="VALUE">
                                                     <block type="math_arithmetic" id="Kx@ha8z,xaB7;:b~r@}j">
                                                       <field name="OP">MINUS</field>
                                                       <value name="A">
                                                         <shadow type="math_number" id="^.zS_dkuOK=azX[+q?eY">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="mQyiC#;hhvZ[`w@?asm_">
                                                           <field name="VAR" id="GcZ0LGBgi2+CQDV+Ml8U">kWhEnde</field>
                                                         </block>
                                                       </value>
                                                       <value name="B">
                                                         <shadow type="math_number">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="T?/SP|*Y_#Wik.P76)FY">
                                                           <field name="VAR" id="yli#ydUr0RWm~eEx_+qc">kWhStart</field>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </statement>
                                 </block>
                               </statement>
                               <next>
                                 <block type="on_ext" id="xY{E]_r$nK7:GmjKI4HI">
                                   <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="jC5AUn]cZ)!dR|zPhbd4">
                                       <field name="oid">tibber.0.priceInfo.current.total</field>
                                     </shadow>
                                   </value>
                                   <statement name="STATEMENT">
                                     <block type="variables_set" id=")cis05nu?2tVd%5.qDGf">
                                       <field name="VAR" id="1FxLO6;u5+HXu78D?dr~">kWhStunde</field>
                                       <value name="VALUE">
                                         <block type="get_value" id="nvt1|ycu|YVOZn^#QO]w">
                                           <field name="ATTR">val</field>
                                           <field name="OID">sourceanalytix.0.0_userdata__0__netzbezug.cumulativeReading</field>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="math_change" id="@e1vcrk3i[E#VpJ)R1Hc">
                                           <field name="VAR" id="mF/M_`BC;9tQ27;~)Kbi">Kosten</field>
                                           <value name="DELTA">
                                             <shadow type="math_number" id=",NINoZ;(8H(uZp/4U=Q~">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="math_arithmetic" id="dC^+t{P9f+Sx9w;|nk@`">
                                               <field name="OP">MULTIPLY</field>
                                               <value name="A">
                                                 <shadow type="math_number" id="ukRC~;/{9!0o]i{xymI*">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="on_source" id="qj/d~$DMnCBwc7^UnZz0">
                                                   <field name="ATTR">oldState.val</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="math_arithmetic" id="4,Qb4`;adLZ?y?[yP3uT">
                                                   <field name="OP">MINUS</field>
                                                   <value name="A">
                                                     <shadow type="math_number" id="eXhLomaNY*[fDJ|pMO8u">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="variables_get" id="c$SF*W,GMxORc|`Vu._b">
                                                       <field name="VAR" id="1FxLO6;u5+HXu78D?dr~">kWhStunde</field>
                                                     </block>
                                                   </value>
                                                   <value name="B">
                                                     <shadow type="math_number">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="variables_get" id="+2sd7tZ5/XyOM%R*jOtI">
                                                       <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id="IMz-bO[CwqJ)(W1^7CQ4">
                                               <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">KWH-Ein</field>
                                               <value name="VALUE">
                                                 <block type="variables_get" id="N`J{8y)MP?U#!R]a6t]l">
                                                   <field name="VAR" id="1FxLO6;u5+HXu78D?dr~">kWhStunde</field>
                                                 </block>
                                               </value>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </statement>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                   </next>
                 </block>
                 <block type="on_ext" id="{S+ieK;*:-7*^WRqLx.e" x="115" y="972">
                   <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=".FpvT~gI9q1M^BUf}]wH">
                       <field name="oid">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                     </shadow>
                   </value>
                   <statement name="STATEMENT">
                     <block type="update" id=":opV82uV:D8*8kDt$0xv">
                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                       <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                       <field name="WITH_DELAY">TRUE</field>
                       <field name="DELAY_MS">2</field>
                       <field name="UNIT">sec</field>
                       <field name="CLEAR_RUNNING">FALSE</field>
                       <value name="VALUE">
                         <block type="math_arithmetic" id="*q+s@hq[DePBP3B^|V4K">
                           <field name="OP">ADD</field>
                           <value name="A">
                             <shadow type="math_number" id="[:VaP^P^EmQVkY}1Sva%">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="get_value" id="zgppA70QM!W@A.{/]Kix">
                               <field name="ATTR">val</field>
                               <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                             </block>
                           </value>
                           <value name="B">
                             <shadow type="math_number">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="get_value" id="2FN_Orib60ub],,DZS+H">
                               <field name="ATTR">val</field>
                               <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                             </block>
                           </value>
                         </block>
                       </value>
                     </block>
                   </statement>
                 </block>
                 <block type="on_ext" id="tBmG-/JKxX_*w4KdWDbh" x="88" y="1238">
                   <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=")q6~lL^JKZdRQ;HXIV0~">
                       <field name="oid">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                     </shadow>
                   </value>
                   <statement name="STATEMENT">
                     <block type="update" id="xA*D=9/sy.zOp{3EasuY">
                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                       <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                       <field name="WITH_DELAY">FALSE</field>
                       <value name="VALUE">
                         <block type="math_arithmetic" id="H(|HOjm#Jd_fG9sqK|_R">
                           <field name="OP">ADD</field>
                           <value name="A">
                             <shadow type="math_number">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="get_value" id="lHbCy=:L?XI-1M]_j$8Y">
                               <field name="ATTR">val</field>
                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                             </block>
                           </value>
                           <value name="B">
                             <shadow type="math_number">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="get_value" id="z|/9gkc2z@zI}cj8$=bL">
                               <field name="ATTR">val</field>
                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber</field>
                             </block>
                           </value>
                         </block>
                       </value>
                       <next>
                         <block type="update" id="-HNLF,(twL$fMSn@]-eN">
                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                           <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                           <field name="WITH_DELAY">FALSE</field>
                           <value name="VALUE">
                             <block type="math_arithmetic" id="E/6~-7Eb]ccHKE[|6wNB">
                               <field name="OP">MULTIPLY</field>
                               <value name="A">
                                 <shadow type="math_number">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="get_value" id="YDMlssEP$|C9#H{1m|?w">
                                   <field name="ATTR">val</field>
                                   <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                 </block>
                               </value>
                               <value name="B">
                                 <shadow type="math_number">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="get_value" id="wtrjOCDXo+7vhl=ktZpr">
                                   <field name="ATTR">val</field>
                                   <field name="OID">0_userdata.0.Tibber.Strompreis_Festpreis</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <next>
                             <block type="update" id="VkHBz-t+mU7.d{8W+G|G">
                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="math_arithmetic" id="RB`(yw-{r5uiL:a*0|GY">
                                   <field name="OP">ADD</field>
                                   <value name="A">
                                     <shadow type="math_number">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="kzl5nM?F1L1kfskZ`g9p">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="d9bWX@W,,G7`T[x,}EX/">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="update" id="6:~X:]aqJoY1qRnzlWMX">
                                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                   <field name="OID">0_userdata.0.Tibber.Ersparnis</field>
                                   <field name="WITH_DELAY">FALSE</field>
                                   <value name="VALUE">
                                     <block type="math_arithmetic" id="8}tP5Pmz:+#H.=Xfuv#r">
                                       <field name="OP">MINUS</field>
                                       <value name="A">
                                         <shadow type="math_number">
                                           <field name="NUM">1</field>
                                         </shadow>
                                         <block type="get_value" id="{PB|VZ+FG6!Q3%MYx)UM">
                                           <field name="ATTR">val</field>
                                           <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                         </block>
                                       </value>
                                       <value name="B">
                                         <shadow type="math_number">
                                           <field name="NUM">1</field>
                                         </shadow>
                                         <block type="get_value" id=";hm`/`LUvZ|8mA,YrR({">
                                           <field name="ATTR">val</field>
                                           <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                   </statement>
                 </block>
                </xml>
                

                Bild_2022-12-03_145357509.png

                B crunchip 2 Replies Last reply Reply Quote 1
                • B
                  babl @paul53 last edited by

                  @paul53 ich bin immer wieder erstaunt, was alles machbar ist, wenn man nur weiß wie, aber leider kapiere ich dein blockly nun gar nicht mehr, ich versuche es mal hier zu entschlüsseln.

                  1. trigger
                    ok die variablen vor dem 1. trigger sind mir klar,
                    dann kommt der trigger, auch klar
                    logic block mit dem wert des triggers ist entweder true oder false, richtig?
                    variable kwh ein auf den wert vom zähler, ist klar
                    variable kwh ein ist zugleich variable kwstart, ist mir klar
                    variable kosten auf 0 setzen, warum?
                    logicblock sonst
                    variable kwhende ist der zähler beim stopp ist klar
                    erhöhe kosten ist mir nun auch klar
                    die beiden aktualisieren blöcke sind mir auch klar,

                  2. trigger

                  hier bin ich planlos was da gemacht wird und wie man da überhaupt draufkommen kann.

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

                    @babl sagte: logic block mit dem wert des triggers ist entweder true oder false, richtig?

                    Richtig.

                    @babl sagte in Gelöst: dynamische strompreise berechnen:

                    variable kosten auf 0 setzen, warum?

                    Weil sie noch die Kosten des vorherigen Durchlaufs enthält.

                    @babl sagte in Gelöst: dynamische strompreise berechnen:

                    was da gemacht wird

                    Bei Preisänderung wird getriggert. Nun werden die Kosten um die Kosten mit dem letzten Preis seit vorheriger Preisänderung bzw. seit Start (bei erster Preisänderung) erhöht. Der Zählerstand wird in Variable KWH-Ein für die nächste Kostenermittlung (Preisänderung oder Ende) gemerkt.

                    B 1 Reply Last reply Reply Quote 1
                    • B
                      babl @paul53 last edited by

                      @paul53 danke

                      1 Reply Last reply Reply Quote 0
                      • crunchip
                        crunchip Forum Testing Most Active @paul53 last edited by

                        @paul53 sagte in Gelöst: dynamische strompreise berechnen:

                        Da sich der Arbeitspreis jede Stunde ändern kann

                        Hallo Paul,
                        da ich auch zu tibber wechselte, habe mir dein Script für meinen Zweck mal angepasst, jedoch bin ich mir nicht ganz sicher ob das so richtig ist oder einen Denkfehler habe.
                        Könntest du bitte mal drüber schauen.

                        In meinem Fall,

                        • Stromzähler
                        • Stromzählerstand zu Jahresbeginn
                        • dynamischer Strompreis

                        für den aktuellen Monat Januar hab ich noch einen konstanten Strompreis(Strompreisberechnung stimmt soweit bis jetzt),
                        welcher ab Februar erst auf dynamisch wechselt.

                        905373af-7047-465c-8268-86e29686114e-image.png

                        <xml xmlns="https://developers.google.com/blockly/xml">
                         <variables>
                           <variable id="~bv5l}lJAJ*QvjiCf8}D">kWh</variable>
                           <variable id="``;8?y6]sW`g$l)FEf+$">kosten</variable>
                           <variable id="1FxLO6;u5+HXu78D?dr~">kWhStunde</variable>
                         </variables>
                         <block type="comment" id="C^+af*9Nxs1NE.5U$+$T" x="312" y="63">
                           <field name="COMMENT">Stromzähler</field>
                         </block>
                         <block type="variables_set" id="f(Impw@FbLMot:4tHn9)" x="63" y="88">
                           <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">kWh</field>
                           <value name="VALUE">
                             <block type="get_value" id="%zwH}7swA`wsSE_xpl!+">
                               <field name="ATTR">val</field>
                               <field name="OID">wiffi-wz.0.root.10_1_30_10.w_counter_1</field>
                             </block>
                           </value>
                           <next>
                             <block type="variables_set" id="8QjP{,ABWGo{?@kz]]h/">
                               <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                               <value name="VALUE">
                                 <block type="math_number" id="krcx/{eaKV3ruP!2S.-m">
                                   <field name="NUM">0</field>
                                 </block>
                               </value>
                               <next>
                                 <block type="on_ext" id="I|k$!JS[Z/E3JHtWDT_w">
                                   <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="+bCQzw0[Z0*;H;%:CHoL">
                                       <field name="oid">wiffi-wz.0.root.10_1_30_10.w_counter_1</field>
                                     </shadow>
                                   </value>
                                   <statement name="STATEMENT">
                                     <block type="controls_if" id="G1EVoPhC%xx|%num]%Uz">
                                       <value name="IF0">
                                         <block type="on_source" id=",XiBVQbvl@]c[k9hE72P">
                                           <field name="ATTR">state.val</field>
                                         </block>
                                       </value>
                                       <statement name="DO0">
                                         <block type="variables_set" id="{w-Wf*y?0BX-i]qsCny?">
                                           <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">kWh</field>
                                           <value name="VALUE">
                                             <block type="get_value" id="|UlmN%RUxps9;3}ACco;">
                                               <field name="ATTR">val</field>
                                               <field name="OID">wiffi-wz.0.root.10_1_30_10.w_counter_1</field>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id="L/}|ZJ){q4cQK`H7bI9M">
                                               <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                                               <value name="VALUE">
                                                 <block type="math_number" id="w,=2S;vWAQ]y(r3N#JvI">
                                                   <field name="NUM">0</field>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="math_change" id="[15V=b-1%miyl`w}tky0">
                                                   <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                                                   <value name="DELTA">
                                                     <shadow type="math_number" id="8Sn,@`@iT_M2gG|:phv)">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="math_arithmetic" id="1-g856BSw%8`7bV5y^YX" inline="false">
                                                       <field name="OP">MULTIPLY</field>
                                                       <value name="A">
                                                         <shadow type="math_number" id=",YmSizo08~k2Kdu]nm_I">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="get_value" id="L2N[9lo,YwlVz;rraw4f">
                                                           <field name="ATTR">val</field>
                                                           <field name="OID">tibberconnect.0.Homes.c9e2ebbe-ca02-4111-b9bf-726b93493aa5.CurrentPrice.total</field>
                                                         </block>
                                                       </value>
                                                       <value name="B">
                                                         <shadow type="math_number" id="J)vkcIKw#*]=8%=zSDVj">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="math_arithmetic" id="w%E~OkTN(e@o9+iVwvY0">
                                                           <field name="OP">MINUS</field>
                                                           <value name="A">
                                                             <shadow type="math_number" id=".Yu#^d7D,*$t_XzR/sDW">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="variables_get" id="oJ6Yk,`3j%%Wz,379+M/">
                                                               <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">kWh</field>
                                                             </block>
                                                           </value>
                                                           <value name="B">
                                                             <shadow type="math_number" id=")yXjkl:.bV=bb2%|0N0;">
                                                               <field name="NUM">1</field>
                                                             </shadow>
                                                             <block type="math_number" id="kP=uU)x]NfpWx,=~f{s:">
                                                               <field name="NUM">126515.053</field>
                                                             </block>
                                                           </value>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                   <next>
                                                     <block type="update" id="EGM}$Q:?(5ru_6[n~i0k">
                                                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                       <field name="OID">0_userdata.0.Stromkosten.Gesamtstrom</field>
                                                       <field name="WITH_DELAY">FALSE</field>
                                                       <value name="VALUE">
                                                         <block type="variables_get" id="=k~m{lCc~%Q6[:mU,amL">
                                                           <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </next>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </statement>
                                     </block>
                                   </statement>
                                   <next>
                                     <block type="on_ext" id="xY{E]_r$nK7:GmjKI4HI">
                                       <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="jC5AUn]cZ)!dR|zPhbd4">
                                           <field name="oid">tibberconnect.0.Homes.c9e2ebbe-ca02-4111-b9bf-726b93493aa5.CurrentPrice.total</field>
                                         </shadow>
                                       </value>
                                       <statement name="STATEMENT">
                                         <block type="variables_set" id=")cis05nu?2tVd%5.qDGf">
                                           <field name="VAR" id="1FxLO6;u5+HXu78D?dr~">kWhStunde</field>
                                           <value name="VALUE">
                                             <block type="get_value" id="p}-xZFGJ4Azjj]*D3~pu">
                                               <field name="ATTR">val</field>
                                               <field name="OID">wiffi-wz.0.root.10_1_30_10.w_counter_1</field>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="math_change" id="@e1vcrk3i[E#VpJ)R1Hc">
                                               <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                                               <value name="DELTA">
                                                 <shadow type="math_number" id=",NINoZ;(8H(uZp/4U=Q~">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="math_arithmetic" id="dC^+t{P9f+Sx9w;|nk@`">
                                                   <field name="OP">MULTIPLY</field>
                                                   <value name="A">
                                                     <shadow type="math_number" id="ukRC~;/{9!0o]i{xymI*">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="on_source" id="qj/d~$DMnCBwc7^UnZz0">
                                                       <field name="ATTR">oldState.val</field>
                                                     </block>
                                                   </value>
                                                   <value name="B">
                                                     <shadow type="math_number">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="math_arithmetic" id="4,Qb4`;adLZ?y?[yP3uT">
                                                       <field name="OP">MINUS</field>
                                                       <value name="A">
                                                         <shadow type="math_number" id="eXhLomaNY*[fDJ|pMO8u">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="c$SF*W,GMxORc|`Vu._b">
                                                           <field name="VAR" id="1FxLO6;u5+HXu78D?dr~">kWhStunde</field>
                                                         </block>
                                                       </value>
                                                       <value name="B">
                                                         <shadow type="math_number">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="+2sd7tZ5/XyOM%R*jOtI">
                                                           <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">kWh</field>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="variables_set" id="IMz-bO[CwqJ)(W1^7CQ4">
                                                   <field name="VAR" id="~bv5l}lJAJ*QvjiCf8}D">kWh</field>
                                                   <value name="VALUE">
                                                     <block type="variables_get" id="N`J{8y)MP?U#!R]a6t]l">
                                                       <field name="VAR" id="1FxLO6;u5+HXu78D?dr~">kWhStunde</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </statement>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                         <block type="comment" id="e5c3?+aV)u7!m9UA;wdp" x="512" y="262">
                           <field name="COMMENT">Strompreis</field>
                         </block>
                         <block type="comment" id="4=I:Bf;(Nhqz_GM=b0.S" x="612" y="312">
                           <field name="COMMENT">Zählerstand zu Jahresbeginn</field>
                         </block>
                         <block type="on_ext" id="{S+ieK;*:-7*^WRqLx.e" x="115" y="972">
                           <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=".FpvT~gI9q1M^BUf}]wH">
                               <field name="oid">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                             </shadow>
                           </value>
                           <statement name="STATEMENT">
                             <block type="update" id=":opV82uV:D8*8kDt$0xv">
                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                               <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                               <field name="WITH_DELAY">TRUE</field>
                               <field name="DELAY_MS">2</field>
                               <field name="UNIT">sec</field>
                               <field name="CLEAR_RUNNING">FALSE</field>
                               <value name="VALUE">
                                 <block type="math_arithmetic" id="*q+s@hq[DePBP3B^|V4K">
                                   <field name="OP">ADD</field>
                                   <value name="A">
                                     <shadow type="math_number" id="[:VaP^P^EmQVkY}1Sva%">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="zgppA70QM!W@A.{/]Kix">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="2FN_Orib60ub],,DZS+H">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                             </block>
                           </statement>
                         </block>
                         <block type="on_ext" id="tBmG-/JKxX_*w4KdWDbh" x="88" y="1238">
                           <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=")q6~lL^JKZdRQ;HXIV0~">
                               <field name="oid">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                             </shadow>
                           </value>
                           <statement name="STATEMENT">
                             <block type="update" id="xA*D=9/sy.zOp{3EasuY">
                               <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                               <field name="WITH_DELAY">FALSE</field>
                               <value name="VALUE">
                                 <block type="math_arithmetic" id="H(|HOjm#Jd_fG9sqK|_R">
                                   <field name="OP">ADD</field>
                                   <value name="A">
                                     <shadow type="math_number">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="lHbCy=:L?XI-1M]_j$8Y">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="get_value" id="z|/9gkc2z@zI}cj8$=bL">
                                       <field name="ATTR">val</field>
                                       <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber</field>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="update" id="-HNLF,(twL$fMSn@]-eN">
                                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                   <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                                   <field name="WITH_DELAY">FALSE</field>
                                   <value name="VALUE">
                                     <block type="math_arithmetic" id="E/6~-7Eb]ccHKE[|6wNB">
                                       <field name="OP">MULTIPLY</field>
                                       <value name="A">
                                         <shadow type="math_number">
                                           <field name="NUM">1</field>
                                         </shadow>
                                         <block type="get_value" id="YDMlssEP$|C9#H{1m|?w">
                                           <field name="ATTR">val</field>
                                           <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                         </block>
                                       </value>
                                       <value name="B">
                                         <shadow type="math_number">
                                           <field name="NUM">1</field>
                                         </shadow>
                                         <block type="get_value" id="wtrjOCDXo+7vhl=ktZpr">
                                           <field name="ATTR">val</field>
                                           <field name="OID">0_userdata.0.Tibber.Strompreis_Festpreis</field>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                   <next>
                                     <block type="update" id="VkHBz-t+mU7.d{8W+G|G">
                                       <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                       <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                       <field name="WITH_DELAY">FALSE</field>
                                       <value name="VALUE">
                                         <block type="math_arithmetic" id="RB`(yw-{r5uiL:a*0|GY">
                                           <field name="OP">ADD</field>
                                           <value name="A">
                                             <shadow type="math_number">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="get_value" id="kzl5nM?F1L1kfskZ`g9p">
                                               <field name="ATTR">val</field>
                                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                             </block>
                                           </value>
                                           <value name="B">
                                             <shadow type="math_number">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="get_value" id="d9bWX@W,,G7`T[x,}EX/">
                                               <field name="ATTR">val</field>
                                               <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="update" id="6:~X:]aqJoY1qRnzlWMX">
                                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                           <field name="OID">0_userdata.0.Tibber.Ersparnis</field>
                                           <field name="WITH_DELAY">FALSE</field>
                                           <value name="VALUE">
                                             <block type="math_arithmetic" id="8}tP5Pmz:+#H.=Xfuv#r">
                                               <field name="OP">MINUS</field>
                                               <value name="A">
                                                 <shadow type="math_number">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="get_value" id="{PB|VZ+FG6!Q3%MYx)UM">
                                                   <field name="ATTR">val</field>
                                                   <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="get_value" id=";hm`/`LUvZ|8mA,YrR({">
                                                   <field name="ATTR">val</field>
                                                   <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </statement>
                         </block>
                        </xml>
                        

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

                          @crunchip
                          "Gesamtkosten" soll die Kosten seit Jahresanfang enthalten?
                          Tibber liefert im Januar den aktuellen (konstanten) Preis?
                          Der Zähler-DP "11" liefert kWh?

                          Dann sollte es so ausreichen:

                          Bild_2023-01-04_114152572.png

                          <xml xmlns="https://developers.google.com/blockly/xml">
                           <variables>
                             <variable id="``;8?y6]sW`g$l)FEf+$">kosten</variable>
                           </variables>
                           <block type="variables_set" id="8QjP{,ABWGo{?@kz]]h/" x="63" y="116">
                             <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                             <value name="VALUE">
                               <block type="get_value_var" id="Zx`OZClw^aUkde)sN;x_">
                                 <field name="ATTR">val</field>
                                 <value name="OID">
                                   <shadow type="text" id="#HZ^0uFtJO;PNc7#|/=,">
                                     <field name="TEXT">0_userdata.0.Stromkosten.Gesamtstrom</field>
                                   </shadow>
                                 </value>
                               </block>
                             </value>
                             <next>
                               <block type="on_ext" id="I|k$!JS[Z/E3JHtWDT_w">
                                 <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                 <field name="CONDITION">gt</field>
                                 <field name="ACK_CONDITION"></field>
                                 <value name="OID0">
                                   <shadow type="field_oid" id="+bCQzw0[Z0*;H;%:CHoL">
                                     <field name="oid">wiffi-wz.0.root.10_1_30_10.w_counter_1</field>
                                   </shadow>
                                 </value>
                                 <statement name="STATEMENT">
                                   <block type="math_change" id="[15V=b-1%miyl`w}tky0">
                                     <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                                     <value name="DELTA">
                                       <shadow type="math_number" id="8Sn,@`@iT_M2gG|:phv)">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="math_arithmetic" id="1-g856BSw%8`7bV5y^YX" inline="false">
                                         <field name="OP">MULTIPLY</field>
                                         <value name="A">
                                           <shadow type="math_number" id=",YmSizo08~k2Kdu]nm_I">
                                             <field name="NUM">1</field>
                                           </shadow>
                                           <block type="get_value" id="L2N[9lo,YwlVz;rraw4f">
                                             <field name="ATTR">val</field>
                                             <field name="OID">tibberconnect.0.Homes.c9e2ebbe-ca02-4111-b9bf-726b93493aa5.CurrentPrice.total</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <shadow type="math_number" id="J)vkcIKw#*]=8%=zSDVj">
                                             <field name="NUM">1</field>
                                           </shadow>
                                           <block type="math_arithmetic" id="w%E~OkTN(e@o9+iVwvY0">
                                             <field name="OP">MINUS</field>
                                             <value name="A">
                                               <shadow type="math_number" id=".Yu#^d7D,*$t_XzR/sDW">
                                                 <field name="NUM">1</field>
                                               </shadow>
                                               <block type="on_source" id="ucPdY+4YTUB^-3MdPqp$">
                                                 <field name="ATTR">state.val</field>
                                               </block>
                                             </value>
                                             <value name="B">
                                               <shadow type="math_number" id=")yXjkl:.bV=bb2%|0N0;">
                                                 <field name="NUM">1</field>
                                               </shadow>
                                               <block type="on_source" id="KhcI]~db4LOeE!=iB$|#">
                                                 <field name="ATTR">oldState.val</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="update" id="EGM}$Q:?(5ru_6[n~i0k">
                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                         <field name="OID">0_userdata.0.Stromkosten.Gesamtstrom</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="variables_get" id="=k~m{lCc~%Q6[:mU,amL">
                                             <field name="VAR" id="``;8?y6]sW`g$l)FEf+$">kosten</field>
                                           </block>
                                         </value>
                                       </block>
                                     </next>
                                   </block>
                                 </statement>
                               </block>
                             </next>
                           </block>
                           <block type="comment" id="C^+af*9Nxs1NE.5U$+$T" x="488" y="163">
                             <field name="COMMENT">Stromzähler</field>
                           </block>
                           <block type="comment" id="e5c3?+aV)u7!m9UA;wdp" x="563" y="213">
                             <field name="COMMENT">Strompreis</field>
                           </block>
                           <block type="on_ext" id="{S+ieK;*:-7*^WRqLx.e" x="115" y="972">
                             <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=".FpvT~gI9q1M^BUf}]wH">
                                 <field name="oid">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                               </shadow>
                             </value>
                             <statement name="STATEMENT">
                               <block type="update" id=":opV82uV:D8*8kDt$0xv">
                                 <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                 <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                                 <field name="WITH_DELAY">TRUE</field>
                                 <field name="DELAY_MS">2</field>
                                 <field name="UNIT">sec</field>
                                 <field name="CLEAR_RUNNING">FALSE</field>
                                 <value name="VALUE">
                                   <block type="math_arithmetic" id="*q+s@hq[DePBP3B^|V4K">
                                     <field name="OP">ADD</field>
                                     <value name="A">
                                       <shadow type="math_number" id="[:VaP^P^EmQVkY}1Sva%">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="get_value" id="zgppA70QM!W@A.{/]Kix">
                                         <field name="ATTR">val</field>
                                         <field name="OID">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <shadow type="math_number">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="get_value" id="2FN_Orib60ub],,DZS+H">
                                         <field name="ATTR">val</field>
                                         <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                               </block>
                             </statement>
                           </block>
                           <block type="on_ext" id="tBmG-/JKxX_*w4KdWDbh" x="88" y="1238">
                             <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=")q6~lL^JKZdRQ;HXIV0~">
                                 <field name="oid">0_userdata.0.Tibber.verbrauchte_Kwh_gesamt</field>
                               </shadow>
                             </value>
                             <statement name="STATEMENT">
                               <block type="update" id="xA*D=9/sy.zOp{3EasuY">
                                 <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                 <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                 <field name="WITH_DELAY">FALSE</field>
                                 <value name="VALUE">
                                   <block type="math_arithmetic" id="H(|HOjm#Jd_fG9sqK|_R">
                                     <field name="OP">ADD</field>
                                     <value name="A">
                                       <shadow type="math_number">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="get_value" id="lHbCy=:L?XI-1M]_j$8Y">
                                         <field name="ATTR">val</field>
                                         <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                       </block>
                                     </value>
                                     <value name="B">
                                       <shadow type="math_number">
                                         <field name="NUM">1</field>
                                       </shadow>
                                       <block type="get_value" id="z|/9gkc2z@zI}cj8$=bL">
                                         <field name="ATTR">val</field>
                                         <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber</field>
                                       </block>
                                     </value>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="update" id="-HNLF,(twL$fMSn@]-eN">
                                     <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                     <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                                     <field name="WITH_DELAY">FALSE</field>
                                     <value name="VALUE">
                                       <block type="math_arithmetic" id="E/6~-7Eb]ccHKE[|6wNB">
                                         <field name="OP">MULTIPLY</field>
                                         <value name="A">
                                           <shadow type="math_number">
                                             <field name="NUM">1</field>
                                           </shadow>
                                           <block type="get_value" id="YDMlssEP$|C9#H{1m|?w">
                                             <field name="ATTR">val</field>
                                             <field name="OID">0_userdata.0.Tibber.verbrauchte-Kwh</field>
                                           </block>
                                         </value>
                                         <value name="B">
                                           <shadow type="math_number">
                                             <field name="NUM">1</field>
                                           </shadow>
                                           <block type="get_value" id="wtrjOCDXo+7vhl=ktZpr">
                                             <field name="ATTR">val</field>
                                             <field name="OID">0_userdata.0.Tibber.Strompreis_Festpreis</field>
                                           </block>
                                         </value>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="update" id="VkHBz-t+mU7.d{8W+G|G">
                                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                         <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                         <field name="WITH_DELAY">FALSE</field>
                                         <value name="VALUE">
                                           <block type="math_arithmetic" id="RB`(yw-{r5uiL:a*0|GY">
                                             <field name="OP">ADD</field>
                                             <value name="A">
                                               <shadow type="math_number">
                                                 <field name="NUM">1</field>
                                               </shadow>
                                               <block type="get_value" id="kzl5nM?F1L1kfskZ`g9p">
                                                 <field name="ATTR">val</field>
                                                 <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                               </block>
                                             </value>
                                             <value name="B">
                                               <shadow type="math_number">
                                                 <field name="NUM">1</field>
                                               </shadow>
                                               <block type="get_value" id="d9bWX@W,,G7`T[x,}EX/">
                                                 <field name="ATTR">val</field>
                                                 <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis</field>
                                               </block>
                                             </value>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="update" id="6:~X:]aqJoY1qRnzlWMX">
                                             <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                             <field name="OID">0_userdata.0.Tibber.Ersparnis</field>
                                             <field name="WITH_DELAY">FALSE</field>
                                             <value name="VALUE">
                                               <block type="math_arithmetic" id="8}tP5Pmz:+#H.=Xfuv#r">
                                                 <field name="OP">MINUS</field>
                                                 <value name="A">
                                                   <shadow type="math_number">
                                                     <field name="NUM">1</field>
                                                   </shadow>
                                                   <block type="get_value" id="{PB|VZ+FG6!Q3%MYx)UM">
                                                     <field name="ATTR">val</field>
                                                     <field name="OID">0_userdata.0.Tibber.Stromkosten_Tibber_Gesamt</field>
                                                   </block>
                                                 </value>
                                                 <value name="B">
                                                   <shadow type="math_number">
                                                     <field name="NUM">1</field>
                                                   </shadow>
                                                   <block type="get_value" id=";hm`/`LUvZ|8mA,YrR({">
                                                     <field name="ATTR">val</field>
                                                     <field name="OID">0_userdata.0.Tibber.Stromkosten_Festpreis_gesamt</field>
                                                   </block>
                                                 </value>
                                               </block>
                                             </value>
                                           </block>
                                         </next>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </statement>
                           </block>
                          </xml>
                          

                          Der Wert für "Gesamtstrom" muss nur einmal vor Skriptstart unter Berücksichtigung des Zählerstandes zu Jahresanfang initialisiert werden, was ja mit Deinem Skript bereits erfolgte. Im weiteren Verlauf bei schwankenden Preisen darf der Anfangszählerstand keine Rolle mehr spielen.

                          Soll zu Jahresanfang wieder von vorn begonnen werden, müssen per Zeitplan kosten und "Gesamtstrom" auf 0 zurück gesetzt werden.

                          1 Reply Last reply Reply Quote 2
                          • crunchip
                            crunchip Forum Testing Most Active last edited by

                            @paul53 sagte in Gelöst: dynamische strompreise berechnen:

                            "Gesamtkosten" soll die Kosten seit Jahresanfang enthalten?

                            ja

                            @paul53 sagte in Gelöst: dynamische strompreise berechnen:

                            Tibber liefert im Januar den aktuellen (konstanten) Preis?

                            ja, Vertrag wurde neu abgeschlossen, im ersten Monat bleibt er noch konstant, ab dem zweiten wird auf dynamisch umgestellt

                            @paul53 sagte in Gelöst: dynamische strompreise berechnen:

                            Der Zähler-DP "11" liefert kWh?

                            ja kommt vom wiffi-wz(ist noch ein Ferraris)

                            @paul53 sagte in Gelöst: dynamische strompreise berechnen:

                            Soll zu Jahresanfang wieder von vorn begonnen werden, müssen per Zeitplan kosten und "Gesamtstrom" auf 0 zurück gesetzt werden.

                            wäre dann ja erst für`s kommende Jahr wieder wichtig, hoffe bis dahin kommt sourceanalytics mit dynamischen Preisen klar

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

                              @crunchip sagte: im ersten Monat bleibt er noch konstant, ab dem zweiten wird auf dynamisch umgestellt

                              Ist der Preis in €/kWh oder in ct/kWh? Bei "aktualisiere Gesamtstrom" sollte entsprechend gerundet werden.

                              Bild_2023-01-04_120703826.png

                              crunchip 1 Reply Last reply Reply Quote 1
                              • crunchip
                                crunchip Forum Testing Most Active @paul53 last edited by

                                @paul53 sind ct
                                13c9cd31-b868-4cf3-b240-9f08c69bc907-image.png
                                fcaec324-3508-4cf6-bb62-3bdcd0dda77f-image.png

                                dann passe ich das Script mal an
                                ich Danke dir vielmals

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

                                  @crunchip sagte: sind ct

                                  Das wäre extrem preiswert! Sind wohl doch €?

                                  crunchip 1 Reply Last reply Reply Quote 0
                                  • crunchip
                                    crunchip Forum Testing Most Active @paul53 last edited by

                                    @paul53 sorry mein Fehler, ja in € angegeben, 37,4 ct

                                    das wäre allerdings sehr Preiswert😂

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

                                    Support us

                                    ioBroker
                                    Community Adapters
                                    Donate

                                    742
                                    Online

                                    31.9k
                                    Users

                                    80.2k
                                    Topics

                                    1.3m
                                    Posts

                                    3
                                    16
                                    1235
                                    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