@codierknecht
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="BN!a@q$SEAU4^)xo:SRJ">max_WR_Leistung</variable>
<variable id="AcYpB0Ty+wVObL7=Y.a.">saldierte_Leistung</variable>
<variable id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</variable>
<variable id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</variable>
<variable id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</variable>
</variables>
<block type="schedule" id="OO@|Rtoh_rlRKcPbfGAo" x="-1862" y="-1263">
<field name="SCHEDULE">0,10,20,30,40,50 * * * * *</field>
<statement name="STATEMENT">
<block type="comment" id="!%pL=9LkG.9?H[$qx2YI">
<field name="COMMENT">wenn Nachteinspeisung aktiv</field>
<next>
<block type="controls_if" id="7T?Z|?Y5.p-:678Tx$Ti">
<value name="IF0">
<block type="get_value" id=")N-S8Ay5cnSc#BmbZ.=w">
<field name="ATTR">val</field>
<field name="OID">sonoff.0.Steckdose_2.POWER</field>
</block>
</value>
<statement name="DO0">
<block type="comment" id="un41CmgNYK(Y]/a|36h]">
<field name="COMMENT">Variablen beschreiben</field>
<next>
<block type="variables_set" id="EqaM{MYS7M6`-h;!zF93">
<field name="VAR" id="BN!a@q$SEAU4^)xo:SRJ">max_WR_Leistung</field>
<value name="VALUE">
<block type="math_number" id="^w]xAxYJ7wN]m6;vk(fV">
<field name="NUM">200</field>
</block>
</value>
<next>
<block type="variables_set" id="wR,+k_F;sMBf]aAYh+~t">
<field name="VAR" id="AcYpB0Ty+wVObL7=Y.a.">saldierte_Leistung</field>
<value name="VALUE">
<block type="get_value" id="RX$n4zq((b9U%h@.fnK,">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.Stromverbrauch.var_Bezug_Summe_Leistung_saldiert</field>
</block>
</value>
<next>
<block type="variables_set" id="~RRNE/ol!3MoTz;#)`PK">
<field name="VAR" id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</field>
<value name="VALUE">
<block type="get_value" id="5CvJRCtL/p)gjkP2,A%K">
<field name="ATTR">val</field>
<field name="OID">opendtu.0.112184710720.ac.phase_1.power</field>
</block>
</value>
<next>
<block type="variables_set" id="mZ+[ru,M.bbbDx$!%cbd">
<field name="VAR" id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</field>
<value name="VALUE">
<block type="math_arithmetic" id="rv08p$|]!!eg`$;G4?[t">
<field name="OP">ADD</field>
<value name="A">
<shadow type="math_number" id="n}1O70OfJnrAub1M8c[r">
<field name="NUM">1</field>
</shadow>
<block type="math_arithmetic" id="3y=~@f2Qw!_YiJJ7yyxq">
<field name="OP">ADD</field>
<value name="A">
<shadow type="math_number" id="qLf/8W@9:(9C9tZ0)%zs">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="0N8%)B@Js@QKG(.|9C;/">
<field name="VAR" id="AcYpB0Ty+wVObL7=Y.a.">saldierte_Leistung</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="N@J09x*NDsor:$]CWIb)">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="k8CjoP?zy$q5sYiz|fp`">
<field name="VAR" id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</field>
</block>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id="RrKwrA08I}5~xOXJTY=l">
<field name="NUM">0</field>
</shadow>
</value>
</block>
</value>
<next>
<block type="comment" id="%`DgcG;amO_v`JekW7X#">
<field name="COMMENT">maximal WR Leistung einstellen</field>
<next>
<block type="controls_if" id="X.V3jJA5CZkZQUc%Yn{;">
<mutation elseif="3"></mutation>
<value name="IF0">
<block type="logic_compare" id="TKLqCZMY~Wns-BS@K,K2">
<field name="OP">GTE</field>
<value name="A">
<block type="variables_get" id="?B6HLx3_C%j{i`W3_h~4">
<field name="VAR" id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</field>
</block>
</value>
<value name="B">
<block type="variables_get" id="=j*pkdNV[O*7=,LmG^hL">
<field name="VAR" id="BN!a@q$SEAU4^)xo:SRJ">max_WR_Leistung</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="T{[2|VMAG8kqI|/hwnX.">
<field name="VAR" id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</field>
<value name="VALUE">
<block type="variables_get" id="YULaab+c`U9LO`fH91iU">
<field name="VAR" id="BN!a@q$SEAU4^)xo:SRJ">max_WR_Leistung</field>
</block>
</value>
<next>
<block type="comment" id="EK7aa~/95cKP_*9jtj~u">
<field name="COMMENT">Vermeidung W Änderungen > 10W wegen Schwingen</field>
</block>
</next>
</block>
</statement>
<value name="IF1">
<block type="logic_compare" id="gVY;LPML8z$4uv`|Pif0">
<field name="OP">GTE</field>
<value name="A">
<block type="variables_get" id="(@i,:QFP%Ui#$Qc#}9zK">
<field name="VAR" id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</field>
</block>
</value>
<value name="B">
<block type="math_arithmetic" id="qS;D4lv4a]J5@{4bq}}[">
<field name="OP">ADD</field>
<value name="A">
<shadow type="math_number" id="I_UEM;1#-apn7r1ubP.Q">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="E`wS@czP,1f}|UDsLxWy">
<field name="VAR" id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="vc]UO5xK#u/;a[$nc{7L">
<field name="NUM">1</field>
</shadow>
<block type="math_number" id="=1.lbX$$-%3|HK%5O1s6">
<field name="NUM">10</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO1">
<block type="variables_set" id="2hh%7nQbUqWU/c/oD;1]">
<field name="VAR" id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</field>
<value name="VALUE">
<block type="math_arithmetic" id="B0B7N@oj(qhgq.[CfLrm">
<field name="OP">ADD</field>
<value name="A">
<shadow type="math_number" id="I_UEM;1#-apn7r1ubP.Q">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="~U[j;IW!IuC97gq%wTiT">
<field name="VAR" id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="vc]UO5xK#u/;a[$nc{7L">
<field name="NUM">1</field>
</shadow>
<block type="math_number" id="npdn`ZMsF.UU%sumAg]f">
<field name="NUM">10</field>
</block>
</value>
</block>
</value>
<next>
<block type="comment" id="+52id[cI4NLN3rH@}5+9">
<field name="COMMENT">Vermeidung W Änderungen < 10W wegen Schwingen</field>
</block>
</next>
</block>
</statement>
<value name="IF2">
<block type="logic_compare" id="cp:Gbx*F@Z)|d?I_*NM[">
<field name="OP">LTE</field>
<value name="A">
<block type="variables_get" id="!m{sPTYgujd)08}F(iiw">
<field name="VAR" id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</field>
</block>
</value>
<value name="B">
<block type="math_arithmetic" id="@tgzHg%Ae%v`SEE4*4Vh">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="I_UEM;1#-apn7r1ubP.Q">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="D:an~$hFrNvX$+lLY*).">
<field name="VAR" id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="vc]UO5xK#u/;a[$nc{7L">
<field name="NUM">1</field>
</shadow>
<block type="math_number" id="c;wHpOxmnU[,woPIEeV^">
<field name="NUM">10</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO2">
<block type="variables_set" id="0K$GCJ,wp=x$|NNUk}tJ">
<field name="VAR" id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</field>
<value name="VALUE">
<block type="math_arithmetic" id="J^O#Rg+68T:Xnfp?_IAb">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="I_UEM;1#-apn7r1ubP.Q">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="E@NrHLM:p${9Orq}X6^w">
<field name="VAR" id="1}Q0686mMw0ZGk)e+r?(">IST-Wert_WR</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="vc]UO5xK#u/;a[$nc{7L">
<field name="NUM">1</field>
</shadow>
<block type="math_number" id="~LDPUO1B|3*vKw~E+7Ji">
<field name="NUM">10</field>
</block>
</value>
</block>
</value>
</block>
</statement>
<value name="IF3">
<block type="logic_operation" id="P_uomd33Pm,$sKLHaK?8">
<field name="OP">OR</field>
<value name="A">
<block type="logic_compare" id="%9^pqGFOAdF_Q4+I_kk|">
<field name="OP">GTE</field>
<value name="A">
<block type="variables_get" id="3FJ;ccWjMMWY975Kj@5s">
<field name="VAR" id="AcYpB0Ty+wVObL7=Y.a.">saldierte_Leistung</field>
</block>
</value>
<value name="B">
<block type="math_number" id="3[DVAMar{wt_rK:[kRtU">
<field name="NUM">10</field>
</block>
</value>
</block>
</value>
<value name="B">
<block type="logic_compare" id="H(i+-mX%!VeQT-k-dSW~">
<field name="OP">LTE</field>
<value name="A">
<block type="variables_get" id="If*V!EDhw)-mx.R1T4n|">
<field name="VAR" id="AcYpB0Ty+wVObL7=Y.a.">saldierte_Leistung</field>
</block>
</value>
<value name="B">
<block type="math_number" id="Ba7:PVdMPz2$p~*KFDnQ">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO3">
<block type="comment" id="f1T,}m=[3vLl{OBvCavV">
<field name="COMMENT">benötigte Leistung einstellen</field>
<next>
<block type="variables_set" id="N2`__2dpmt+NXIcxENW/">
<field name="VAR" id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</field>
<value name="VALUE">
<block type="variables_get" id=";3S?@Jd,;,GMMI=X8X,0">
<field name="VAR" id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="comment" id="5V:8{H(Wby#lc(I7TXo3">
<field name="COMMENT">Vermeidung das SOLL-Wert < 10W wird</field>
<next>
<block type="controls_if" id="z~i9;MPg9rNBrD:.ZcHx">
<value name="IF0">
<block type="logic_compare" id="#wA@uq;vFm}184]3,XTf">
<field name="OP">LTE</field>
<value name="A">
<block type="variables_get" id="b~F;nG1/8mo.0J8Qo;]3">
<field name="VAR" id="le#}gR{6G.yhW=x|6pS8">SOLL-Wert_WR</field>
</block>
</value>
<value name="B">
<block type="math_number" id="1a.@~,.{Y9?msC|}i!Eh">
<field name="NUM">10</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="y-1KyiEpr+hF9[GjI6yR">
<field name="VAR" id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</field>
<value name="VALUE">
<block type="math_number" id="ZCQw^kFMn*J`ypL@Xt.A">
<field name="NUM">10</field>
</block>
</value>
</block>
</statement>
<next>
<block type="control" id="%cOvD+Otu7dc3(7+Pt%?">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">opendtu.0.112184710720.power_control.limit_nonpersistent_absolute</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_round" id="qp8W?7#X`RyZcY2C7b7k">
<field name="OP">ROUND</field>
<value name="NUM">
<shadow type="math_number" id="OJ-sBUj]4[O=:~#bD`+/">
<field name="NUM">3.1</field>
</shadow>
<block type="variables_get" id="c;t^q^e_m6@Xsn@8(u`r">
<field name="VAR" id="av^_6@}eU-gIk%dJ,!,}">Stellwert_WR</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</statement>
</block>
</xml>