@deta
Moin, habe keine dyn. Stromtarif, möchte aber mal simulieren, wie mein durchschnittlicher Strompreis damit wäre.
Da ich ohne Tibber Tarif den Adapter nicht nutzen kann, nehme ich den Awattar Adapter.
Musste ein wenig mit dem Arbeitspreis in der Config spielen, bis dieser für meinen Standort zum angezeigten auf der Awattar-Hourly Seite passt.
6276ca10-21a1-47ac-a5c9-34fffa041642-image.png
Dann habe ich folgendes Skript, welches am Anfang und Ende jeder Stunde den Zählerstand speichert.
Am Ende jeder Stunde der Verbrauch der vergangenen Stunde berechnet.
Es wird aus den Awattar Preisen der Preis für die vergangene Stunde ausgewählt und mit dem Verbrauch multipliziert und abgespeichert.
Hier die Hilfs-Objekte:
05f64c84-19c3-4875-a7fe-3c38eb2b030f-image.png
Hier das Blockly Skript:
Spoiler
<xml xmlns="
https://developers.google.com/blockly/xml">
<variables>
<variable id="Xax5n9,mB7j}?Xrh^pR">Z-Stand_Anfang</variable>
<variable type="timeout" id="timeout">timeout</variable>
<variable id="!O,HE!D@U7nS0jx,!4T2">Z-Stand_Ende</variable>
<variable id="xbcA[~MxIY[@O9AIMD?p">Verbrauch in Stunde</variable>
<variable id="P,SO]ENp+~zGbX^8:62S">i</variable>
<variable id="d+Ko|$Qe{H+1(Nu-wn8x">Pfad_ObjektID</variable>
<variable id="]$j[Kcke!!bHNEhXh#g5">Strompreis in Stunde</variable>
<variable id="_{p/QBUu5F5yK_2-G_;">Stromkosten in Stunde</variable> </variables> <block type="schedule" id="6@F}_zs4[mE-#M{z_%mp" x="-55" y="47"> <field name="SCHEDULE">*/60 * * * *</field> <statement name="STATEMENT"> <block type="variables_set" id="izhNz.S~C=fsFBR,+ZZa"> <field name="VAR" id="Xax5n9,mB7j}*?Xrh^pR">Z-Stand_Anfang</field> <value name="VALUE"> <block type="math_arithmetic" id="7#aQUB7JogiKZuueu7fp"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="4%w6u1hnkGEbB-1$~tHw"> <field name="NUM">1</field> </shadow> <block type="math_round" id="LU$#q@R=P^[EyQnw%F;O"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="j9iv,#9G(:.xc#]+OPqu"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="avlQ,f2r)VCW~a;MGE">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="|eC_t;OU_d5;@G(sC)2{">
<field name="NUM">1</field>
</shadow>
<block type="get_value" id="WwS3Frt.@wgUqT^T:}J">
<field name="ATTR">val</field>
<field name="OID">smartmeter.0.1-0:1_8_0__255.value</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="Mlv0%8v|~m0:Z6anoj64">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id=".jRhZ3^H4BZ+7~$Ud%l%">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</value>
<next>
<block type="debug" id="|r0f[G6%/kDY^/A0|o^h">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="6{u;wj25~vFK5]w;maY7">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="759f9LM_OlwSClR^ItT"> <field name="VAR" id="Xax5n9,mB7j}*?Xrh^pR">Z-Stand_Anfang</field> </block> </value> <next> <block type="timeouts_settimeout" id="ZMeBD%IfN7zD:=}x*NY?"> <field name="NAME">timeout</field> <field name="DELAY">3598</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="variables_set" id="0fXGxd.vkND2]GdGR0L_"> <field name="VAR" id="!O,HE!D@U7nS0jx,!4T2">Z-Stand_Ende</field> <value name="VALUE"> <block type="math_arithmetic" id="bG6jd|c68]O7L)EgN=HA"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="!g@5*rDIk=(vzZ;HI=Kx"> <field name="NUM">1</field> </shadow> <block type="math_round" id="3|IJi2IowPEG@w+,+u9+"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="H6[UzPl5T4Al*4!]U|Fg"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="!BpsZA;ERXj*9cI?eg0@"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="wt?^%N[pEXf1daGS@Jv]"> <field name="NUM">1</field> </shadow> <block type="get_value" id="(3]gehX6XzBorH7re)W1"> <field name="ATTR">val</field> <field name="OID">smartmeter.0.1-0:1_8_0__255.value</field> </block> </value> <value name="B"> <shadow type="math_number" id="}ez~~J$hcLlzd}dw@UI+"> <field name="NUM">100</field> </shadow> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="i{qKTXQg7=L4j3#{]KJZ"> <field name="NUM">100</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="G^doxIL1X*NiQhtr89Je"> <field name="VAR" id="xbcA[~MxIY[@O9AIMD?p">Verbrauch in Stunde</field> <value name="VALUE"> <block type="math_arithmetic" id="/_Fw55_o=M(sJY_+q;-6"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="mES0du6U4JhZFV*YCA#q"> <field name="NUM">1</field> </shadow> <block type="math_round" id="YM3(rn3bE^ezU*|20a^="> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="Rc:zs0@k^0G,5urE2Qal"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="UojT;fQjo.]V5h%.S(">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="zFc#fs[E~n!oG^58(@:v">
<field name="NUM">1</field>
</shadow>
<block type="math_arithmetic" id="#]:!er]zR5lGkGbi8tl"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="[0^YbW*yV|7;Xgm06!3a"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="l([-~yY:j{|7m^bh9sG/"> <field name="VAR" id="!O,HE!D@U7nS0jx,!4T2">Z-Stand_Ende</field> </block> </value> <value name="B"> <shadow type="math_number" id="YIdKK!a_2i]2i$|4bWN]"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="E6~@Jj8}}?#fdx|{BF">
<field name="VAR" id="Xax5n9,mB7j}?Xrh^pR">Z-Stand_Anfang</field>
</block>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id="qoy5e#=o4D[sOM6elp4{">
<field name="NUM">100</field>
</shadow>
</value>
</block>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id="Sy7qtw^:]d~:;N8a+nGm">
<field name="NUM">100</field>
</shadow>
</value>
</block>
</value>
<next>
<block type="controls_for" id="mCRnCVHY]KKI}#j954xP">
<field name="VAR" id="P,SO]ENp+~zGbX^8:62S">i</field>
<value name="FROM">
<shadow type="math_number" id="wf3guP1#U@KL8f3W5H#">
<field name="NUM">0</field>
</shadow>
</value>
<value name="TO">
<shadow type="math_number" id="IaYKFEE5J{oqZ(.TBe+">
<field name="NUM">23</field>
</shadow>
</value>
<value name="BY">
<shadow type="math_number" id="$Tf{rh])]=[ZE742X~8y">
<field name="NUM">1</field>
</shadow>
</value>
<statement name="DO">
<block type="controls_if" id="18MX{(BRnpseAVu#78E:">
<value name="IF0">
<block type="logic_compare" id="flG9pjJSW-WVI(A+0i{">
<field name="OP">EQ</field>
<value name="A">
<block type="time_get" id="{83u@(AD8+AW7gQ2;mnn">
<mutation xmlns="
http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">h</field>
</block>
</value>
<value name="B">
<block type="variables_get" id="ROSh*?;a{7G6vJ[W:k@7">
<field name="VAR" id="P,SO]ENp+~zGbX^8:62S">i</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="/Mc@?48)bj_hwY5[;AJ#">
<field name="VAR" id="d+Ko|$Qe{H+1(Nu-wn8x">Pfad_ObjektID</field>
<value name="VALUE">
<block type="text_join" id="?DW]f-c3kL8lC@Ew{@fn">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="text" id="d-uxsv^{!?=s82$Fh">
<field name="TEXT">awattar.0.prices.</field>
</block>
</value>
<value name="ADD1">
<block type="variables_get" id=";5Sry[LMFaYync!{ieGE">
<field name="VAR" id="P,SO]ENp+~zGbX^8:62S">i</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="YG#.;}s1q$Ror
l+=mS"> <field name="TEXT">.totalPriceKwh</field> </block> </value> </block> </value> <next> <block type="variables_set" id="9~NCVIU}=U%oIY00c+.:"> <field name="VAR" id="]$j[Kcke!!bHNEhXh#g5">Strompreis in Stunde</field> <value name="VALUE"> <block type="math_arithmetic" id="wXYcj?9?Bezubso%=Z4r"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="0,r[*3LTz,fK*LVN3Hx}"> <field name="NUM">1</field> </shadow> <block type="math_round" id="+Y{K}yL{fYW/xH4%_0Hd"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="v/~AV(BtSjoSm=rbj%Sv"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="$fx)iT_*fdgpkKx9SC*,"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="rcL{MmY~j]mNoDOy.{HO"> <field name="NUM">1</field> </shadow> <block type="get_value_var" id="bK%@A07W/2[LOMab#)hU"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id=",3nHOLUk{qIJdU/}U{.H"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="Dx10i2r6f(FFQjxiI)76"> <field name="VAR" id="d+Ko|$Qe{H+1(Nu-wn8x">Pfad_ObjektID</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="-X_J/rs+Rrs!6-DIx*u5"> <field name="NUM">10</field> </shadow> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="k^OJ/Z=Uy*mv_y65$/o!"> <field name="NUM">10</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="+3yyYS^+r$9zq1OrgBun"> <field name="VAR" id="_{p/QBUu5F5yK_2-G_;">Stromkosten in Stunde</field>
<value name="VALUE">
<block type="math_arithmetic" id="cJkk@?/S{~hUP)">
<field name="OP">DIVIDE</field>
<value name="A">
<shadow type="math_number" id="~imZOB?4)F=07|-BTE6c">
<field name="NUM">1</field>
</shadow>
<block type="math_round" id="I8itFC*MO9Et%k;XPgK">
<field name="OP">ROUND</field>
<value name="NUM">
<shadow type="math_number" id="3XZ@Ebt,[V5]qzDt=Mw"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="Ed$a6d8n*a2x(zbw:mDc"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="{+O.?hC%^UxI*Yfi+Y|t"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="w2QH8!tb8[yQLK{n:C*j"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="A71)lL_ZrUKtGijUmtlr"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="788-wp9|nasNPVJbGmWe"> <field name="VAR" id="]$j[Kcke!!bHNEhXh#g5">Strompreis in Stunde</field> </block> </value> <value name="B"> <shadow type="math_number" id="RTj(x2MdVv(A4b3{wL^B"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="bq}DFrBii-*]U20]4pBI"> <field name="VAR" id="xbcA[~MxIY[@O9AIMD?p">Verbrauch in Stunde</field> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="a/}P2,4%^E}0|%pIJfh1"> <field name="NUM">10</field> </shadow> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="6zzedaEwF$1M/-V6OSIx"> <field name="NUM">10</field> </shadow> </value> </block> </value> <next> <block type="debug" id="I3yf~k@tKva6?C:05@">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="Q))2Gd^Yx~$SshJWoE)D">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="|TV?/};(a5):iZaqJVx"> <field name="VAR" id="]$j[Kcke!!bHNEhXh#g5">Strompreis in Stunde</field> </block> </value> <next> <block type="debug" id="m.c%crMqFsbFIgQOL-t">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="nb0tUT5V.L_~H}1{{Hr1">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="dsWukQ9Su_J^HkL?P{?7">
<field name="VAR" id="xbcA[~MxIY[@O9AIMD?p">Verbrauch in Stunde</field>
</block>
</value>
<next>
<block type="debug" id="9a+8:yMzltfEQQI.K)3*">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="vnOUGo:SLg_}G{Sw5Y5W">
<field name="TEXT">test</field>
</shadow>
<block type="variables_get" id="kIKl_@b{vdL8=j+I~OhB">
<field name="VAR" id="{p/QBUu5F5yK_2-G_;">Stromkosten in Stunde</field> </block> </value> <next> <block type="debug" id="R!B1Frf)jyrcy$//gMFg"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="nFtoKF_@5Fr%$h{lzisM"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="qCN9W6Gp0!Em[N;k:3.-"> <field name="VAR" id="!O,HE!D@U7nS0jx,!4T2">Z-Stand_Ende</field> </block> </value> <next> <block type="control" id="?919gBH%K#gsnlYH.?RH"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Hauptzähler.Strompreis_in_der_Stunde</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="S!-5WBvfT+[GXoQ-DeSe"> <field name="VAR" id="]$j[Kcke!!bHNEhXh#g5">Strompreis in Stunde</field> </block> </value> <next> <block type="control" id="{5^0oCQ9od(D,]K;#ax;"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Hauptzähler.Stromkosten_in_Stunde</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="RYz{/!vbF3%L2.MOg6X5"> <field name="VAR" id="_{p/QBUu5F5yK_2-G;">Stromkosten in Stunde</field>
</block>
</value>
<next>
<block type="control" id="C20/VS)@;MMlBHNxa;mx">
<mutation xmlns="
http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">0_userdata.0.Hauptzähler.Verbrauch_in_Stunde</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id=":b=flbz1|*2gRWh)$h|T">
<field name="VAR" id="xbcA[~MxIY[@O9AIMD?p">Verbrauch in Stunde</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>
ab6c7eee-123a-48a4-ace8-b4c1877a42d1-image.png
In Grafana summiere ich dann die gesamten Stromkosten auf und teile sie durch die insgesamt verbrauchte elektrische Energie im selben Zeitraum, sodass ich den Mittelwert erhalte.
cc92f032-deb8-42e2-a723-eed2090e9998-image.png