<xml xmlns="https://developers.google.com/blockly/xml">
  <variables>
    <variable id="#ZO}puq!byH)d[RA8.u~">stufe</variable>
    <variable id="S`Q7El*S8|6o7zjVveF`">ueberschuss</variable>
    <variable type="timeout" id="delayOn">delayOn</variable>
    <variable type="timeout" id="delayOff">delayOff</variable>
  </variables>
  <block type="variables_set" id="V88W|+Iln7v+rgj)=Zch" x="13" y="-63">
    <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
    <value name="VALUE">
      <block type="math_arithmetic" id="UPGMM~b*V$d-a*#;tS[D" inline="false">
        <field name="OP">ADD</field>
        <value name="A">
          <shadow type="math_number" id="~wy?L?:xH(Ni)}x,PFCD">
            <field name="NUM">1</field>
          </shadow>
          <block type="logic_ternary" id="*J#=-SvRj,t10JsQT^g)" inline="true">
            <value name="IF">
              <block type="get_value" id="Di]!Es+iNie7c[+9)*;x">
                <field name="ATTR">val</field>
                <field name="OID">shelly.0.shellyplus1pm#d4d4da094ad0#1.Relay0.Switch</field>
              </block>
            </value>
            <value name="THEN">
              <block type="math_number" id="e=$;Dm*Kdv-Y8so-i~0#">
                <field name="NUM">1</field>
              </block>
            </value>
            <value name="ELSE">
              <block type="math_number" id="`O}G]nrYU1J(u^B(cJ4D">
                <field name="NUM">0</field>
              </block>
            </value>
          </block>
        </value>
        <value name="B">
          <shadow type="math_number" id="};}!|b@GbaTL{Y_1M4mO">
            <field name="NUM">1</field>
          </shadow>
          <block type="logic_ternary" id=";LD9IL!$vH=aILt*01D]" inline="true">
            <value name="IF">
              <block type="get_value" id="UP`ZrOpZ0?YW7(BPAKu=">
                <field name="ATTR">val</field>
                <field name="OID">shelly.0.shellyplus1pm#80646fd0fd48#1.Relay0.Switch</field>
              </block>
            </value>
            <value name="THEN">
              <block type="math_number" id="_#[$Y6bW6I=KD6W@i8-H">
                <field name="NUM">2</field>
              </block>
            </value>
            <value name="ELSE">
              <block type="math_number" id="a`){P].I3sR02/vH?$|t">
                <field name="NUM">0</field>
              </block>
            </value>
          </block>
        </value>
      </block>
    </value>
    <next>
      <block type="on_ext" id="^=k13pGi`kMjtE||vY.J">
        <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="n:wY~I3GQO$7,0:+.oY=">
            <field name="oid">evcc.0.status.gridPower</field>
          </shadow>
        </value>
        <statement name="STATEMENT">
          <block type="variables_set" id="U0g[6)DF7XBr6PjSBC1%">
            <field name="VAR" id="S`Q7El*S8|6o7zjVveF`">ueberschuss</field>
            <value name="VALUE">
              <block type="math_arithmetic" id="fF$hk1tVi-R05oeMt;V%">
                <field name="OP">MINUS</field>
                <value name="A">
                  <shadow type="math_number" id="ixiYq]/$A+RSmijBZE[,">
                    <field name="NUM">0</field>
                  </shadow>
                </value>
                <value name="B">
                  <shadow type="math_number" id="Cs,pKE7(!7+1jmwBW.2/">
                    <field name="NUM">1</field>
                  </shadow>
                  <block type="on_source" id="f=2?mi+jttya*Yya7dG.">
                    <field name="ATTR">state.val</field>
                  </block>
                </value>
              </block>
            </value>
            <next>
              <block type="comment" id="9X:XKXRgH!xZ!=zZbThm">
                <field name="COMMENT">3 mal 750 W</field>
                <next>
                  <block type="controls_if" id="?{[99~rn+X@-!776Gil$">
                    <mutation elseif="1"></mutation>
                    <value name="IF0">
                      <block type="logic_compare" id="d%IZlzT50i(a7nefKk6]">
                        <field name="OP">LT</field>
                        <value name="A">
                          <block type="variables_get" id="lg4*^=8|`oo@q1o#)S/S">
                            <field name="VAR" id="S`Q7El*S8|6o7zjVveF`">ueberschuss</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="math_number" id="vP_iZf?M;`@RCY1gD^i:">
                            <field name="NUM">1000</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="timeouts_cleartimeout" id="|#WysqWLOkMz:?pQ*-CZ">
                        <field name="NAME">delayOn</field>
                      </block>
                    </statement>
                    <value name="IF1">
                      <block type="logic_negate" id="dch2(fx(/ykyn#X-R`9x">
                        <value name="BOOL">
                          <block type="timeouts_gettimeout" id="xJVx:Mi5[U_(t*bw(Yq$">
                            <field name="NAME">delayOn</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO1">
                      <block type="timeouts_settimeout" id="=EI:`22NaF],y?uV^b1B">
                        <field name="NAME">delayOn</field>
                        <field name="DELAY">10</field>
                        <field name="UNIT">min</field>
                        <statement name="STATEMENT">
                          <block type="controls_if" id="L^8:G3aDU.xP#v0K7^n[">
                            <value name="IF0">
                              <block type="logic_compare" id="rRm-_cjXetCm)~hcAE~}">
                                <field name="OP">LT</field>
                                <value name="A">
                                  <block type="variables_get" id="k?Bzt4RS=S!C{E%~JKR%">
                                    <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="math_number" id="?UTjTS/9I`U;T!+,CaMi">
                                    <field name="NUM">3</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="math_change" id="j%wz0Z;.Z9l}/YcJ|u@O">
                                <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                                <value name="DELTA">
                                  <shadow type="math_number" id="*QTjL.s^?cd[t)LK(x*L">
                                    <field name="NUM">1</field>
                                  </shadow>
                                </value>
                                <next>
                                  <block type="procedures_callnoreturn" id="toS^1+[sVXvM12+04n~j">
                                    <mutation name="Heizstab"></mutation>
                                    <next>
                                      <block type="timeouts_cleartimeout" id="WJ?t^mxt0H|jM5A2zX=v">
                                        <field name="NAME">delayOn</field>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </statement>
                          </block>
                        </statement>
                      </block>
                    </statement>
                    <next>
                      <block type="controls_if" id="U^YFuAk{|bn.*b{Ep;B=">
                        <mutation elseif="1"></mutation>
                        <value name="IF0">
                          <block type="logic_compare" id="GddE`U/xj*}WZ:OC-j_5">
                            <field name="OP">GT</field>
                            <value name="A">
                              <block type="variables_get" id="Ji]v?2~|pv5`v!eeLtH`">
                                <field name="VAR" id="S`Q7El*S8|6o7zjVveF`">ueberschuss</field>
                              </block>
                            </value>
                            <value name="B">
                              <block type="math_number" id=":{IrB{m-gbX@X2|pVyXZ">
                                <field name="NUM">100</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <statement name="DO0">
                          <block type="timeouts_cleartimeout" id="_N.QOqsujv5EzF,e1:^`">
                            <field name="NAME">delayOff</field>
                          </block>
                        </statement>
                        <value name="IF1">
                          <block type="logic_negate" id="0(6[M7amQ.RY*S4wPkX3">
                            <value name="BOOL">
                              <block type="timeouts_gettimeout" id="pTQJfLPne.dmqq!4K#Q.">
                                <field name="NAME">delayOff</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <statement name="DO1">
                          <block type="timeouts_settimeout" id="b(4T]c7c@_xcR0^(IJQ#">
                            <field name="NAME">delayOff</field>
                            <field name="DELAY">5</field>
                            <field name="UNIT">min</field>
                            <statement name="STATEMENT">
                              <block type="controls_if" id="N`KrOVa}E?2GEgP!,hnz">
                                <value name="IF0">
                                  <block type="logic_compare" id="!!K9CK;|;n]ddqB#Sv9x">
                                    <field name="OP">GT</field>
                                    <value name="A">
                                      <block type="variables_get" id="(BxBl^T0kZqo1s{{@q2;">
                                        <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <block type="math_number" id="aJaeQbM-4{Urt]DVf9Q.">
                                        <field name="NUM">0</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <statement name="DO0">
                                  <block type="math_change" id="Sq6c}B`kReZUISESR)FH">
                                    <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                                    <value name="DELTA">
                                      <shadow type="math_number" id="!F{}xNQ_117l8Vz1)Bw-">
                                        <field name="NUM">-1</field>
                                      </shadow>
                                    </value>
                                    <next>
                                      <block type="procedures_callnoreturn" id="$}C4r;1}f|vwd?j_@rJ*">
                                        <mutation name="Heizstab"></mutation>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                                <next>
                                  <block type="timeouts_cleartimeout" id="`D+24l9JDFvo/:O-kz6]">
                                    <field name="NAME">delayOff</field>
                                  </block>
                                </next>
                              </block>
                            </statement>
                          </block>
                        </statement>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
      </block>
    </next>
  </block>
  <block type="procedures_defnoreturn" id="Q6,+1QdD4Bq`#0DA-`[=" x="412" y="237">
    <field name="NAME">Heizstab</field>
    <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
    <statement name="STACK">
      <block type="control" id="qYesRpdij9z`93JQ2~w%">
        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
        <field name="OID">shelly.0.shellyplus1pm#d4d4da094ad0#1.Relay0.Switch</field>
        <field name="WITH_DELAY">FALSE</field>
        <value name="VALUE">
          <block type="math_number_property" id="2[3jGAZF1c!_#4rLN^lK">
            <mutation divisor_input="false"></mutation>
            <field name="PROPERTY">ODD</field>
            <value name="NUMBER_TO_CHECK">
              <shadow type="math_number" id="^mbt0I.5NcdGL)U11cys">
                <field name="NUM">0</field>
              </shadow>
              <block type="variables_get" id="8/kAAEJZB_bXT3h*p`y9">
                <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
              </block>
            </value>
          </block>
        </value>
        <next>
          <block type="control" id="S(zYFzv^}$AcCYB-`Q`e">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">shelly.0.shellyplus1pm#80646fd0fd48#1.Relay0.Switch</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_compare" id="2L^iKhb3yF2tiPb$(%l$">
                <field name="OP">GTE</field>
                <value name="A">
                  <block type="variables_get" id="/QAECrxs6x0t8U~:B%E*">
                    <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="math_number" id="PH|,U:I~$fQ*Ja^o2^h0">
                    <field name="NUM">2</field>
                  </block>
                </value>
              </block>
            </value>
            <next>
              <block type="telegram" id="z/3Pq0u?zYU2o$t#/UAa">
                <field name="INSTANCE"></field>
                <field name="LOG"></field>
                <field name="SILENT">FALSE</field>
                <field name="PARSEMODE">default</field>
                <field name="ESCAPING">FALSE</field>
                <field name="DISABLE_WEB_PAGE_PREVIEW">FALSE</field>
                <value name="MESSAGE">
                  <shadow type="text" id="UNDeozYk*CL[92C}[Au=">
                    <field name="TEXT"></field>
                  </shadow>
                  <block type="text_join" id="f^:ycs#*P(R:|84zvCT^">
                    <mutation items="5"></mutation>
                    <value name="ADD0">
                      <block type="text" id="8RKF;A8nAvV3XoGI4*Z{">
                        <field name="TEXT">Heizstab 750 W</field>
                      </block>
                    </value>
                    <value name="ADD1">
                      <block type="logic_ternary" id="~~tVV~oA1rDOnkItJbuy" inline="true">
                        <value name="IF">
                          <block type="math_number_property" id="C@4rz^-}.Zt)woz7L^}.">
                            <mutation divisor_input="false"></mutation>
                            <field name="PROPERTY">ODD</field>
                            <value name="NUMBER_TO_CHECK">
                              <shadow type="math_number" id="j%9`$v-IFqp4d]CD#Ky/">
                                <field name="NUM">0</field>
                              </shadow>
                              <block type="variables_get" id="fM|xH{svM|{GTl9WzSZ1">
                                <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <value name="THEN">
                          <block type="text" id="w=yh:evG@jBi#%vv4VW(">
                            <field name="TEXT"> Ein</field>
                          </block>
                        </value>
                        <value name="ELSE">
                          <block type="text" id="Eu3]O!V@4{7arYrY^DHn">
                            <field name="TEXT"> Aus</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <value name="ADD2">
                      <block type="text_newline" id=":Cr#6muo9{1}yvD_n=l%">
                        <field name="Type">\n</field>
                      </block>
                    </value>
                    <value name="ADD3">
                      <block type="text" id="=Pp3lLJI/a29j2y^K!nv">
                        <field name="TEXT">Heizstab 1,5 kW</field>
                      </block>
                    </value>
                    <value name="ADD4">
                      <block type="logic_ternary" id="/$$,E$8Y*Ych?=fna1ve" inline="true">
                        <value name="IF">
                          <block type="logic_compare" id="hk6,1HRWvh8pKE,h!)Zc">
                            <field name="OP">GTE</field>
                            <value name="A">
                              <block type="variables_get" id="C:T6fXDC/v~SKcpqCS0(">
                                <field name="VAR" id="#ZO}puq!byH)d[RA8.u~">stufe</field>
                              </block>
                            </value>
                            <value name="B">
                              <block type="math_number" id="AeRKfQfc+7c@VUQulbX~">
                                <field name="NUM">2</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <value name="THEN">
                          <block type="text" id="IF(:Z,A-U1(rKR[qQxxV">
                            <field name="TEXT"> Ein</field>
                          </block>
                        </value>
                        <value name="ELSE">
                          <block type="text" id="iU1+m14WQ3PZuIfD@yvs">
                            <field name="TEXT"> Aus</field>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </next>
      </block>
    </statement>
  </block>
</xml>