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 @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

                        951
                        Online

                        31.9k
                        Users

                        80.2k
                        Topics

                        1.3m
                        Posts

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