Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Shelly Plus 2PM Rolladen Skript (Yahka)

    NEWS

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    Shelly Plus 2PM Rolladen Skript (Yahka)

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

      Hallo zusammen,

      basierend auf diesem Thread möchte ich meine überarbeitete Lösung mit euch teilen. Mit dem Skript lassen sich die Shelly Plus 2PM, zusammen mit dem Yahka-Adapter, optimal als Rollladensteuerung in iOS einbinden und werden korrekt dargestellt.

      Hier das Blockly-Skript:

      <xml xmlns="https://developers.google.com/blockly/xml">
        <variables>
          <variable type="timeout" id="timeout">timeout</variable>
          <variable type="timeout" id="timeout2">timeout2</variable>
        </variables>
        <block type="create" id="QjY0ukh0=t6v|T6y.k*t" x="112" y="-638">
          <field name="NAME">WUNSCHNAME_TargetPosition</field>
          <next>
            <block type="create" id="t;x8wz[mNFBB~hp;lT|F">
              <field name="NAME">WUNSCHNAME_Position</field>
              <next>
                <block type="create" id="lm^!),m:Ow5?(lGDkf4u">
                  <field name="NAME">WUNSCHNAME_Status</field>
                </block>
              </next>
            </block>
          </next>
        </block>
        <block type="on_ext" id="s{)XG`[uGGic2bR?WxPf" x="112" y="-163">
          <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="K[p:_r`=T{.7#9F3WKvw">
              <field name="oid">shellyplus2pm.Cover0.Status</field>
            </shadow>
          </value>
          <statement name="STATEMENT">
            <block type="controls_if" id="n0,88JV1J6V`:P%%9lV-">
              <mutation elseif="4"></mutation>
              <value name="IF0">
                <block type="logic_compare" id="DihvAeD*E_2vO73m=N!m">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="on_source" id="s;vs]Rp=#eyr)EI^Qf~:">
                      <field name="ATTR">state.val</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="text" id="#M@RY67mwv0tI~`J2u/1">
                      <field name="TEXT">closing</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO0">
                <block type="update" id="iBQU0$Z-F4.eYf`@(R$.">
                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                  <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="text" id="yNOQb@t$Zg{e!5K670r7">
                      <field name="TEXT">closing</field>
                    </block>
                  </value>
                </block>
              </statement>
              <value name="IF1">
                <block type="logic_compare" id="s+`u?F$Ie)S*J:`q$OR`">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="on_source" id="aNb+;CT6@V0(m3XgS|?B">
                      <field name="ATTR">state.val</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="text" id="!{GeT.q}iBIa)c}5PNwH">
                      <field name="TEXT">opening</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO1">
                <block type="update" id="f;F`A.s$VX950m25KyCL">
                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                  <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="text" id="2OrmdDVaxS@BUgXCgatP">
                      <field name="TEXT">opening</field>
                    </block>
                  </value>
                </block>
              </statement>
              <value name="IF2">
                <block type="logic_compare" id="qq_vX?@[`?tBcaw0[MZx">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="on_source" id="yG{K87j$(Pyx5+JA`6Bp">
                      <field name="ATTR">state.val</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="text" id="g!e`q2NxSu6B-wQKQbMW">
                      <field name="TEXT">open</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO2">
                <block type="update" id="wsx0j,)LRv(k0@WMw)^8">
                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                  <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="text" id="KIHD+-KhQo`7.D:5c?NF">
                      <field name="TEXT">stopped</field>
                    </block>
                  </value>
                  <next>
                    <block type="update" id="U#oo5zJ(SxBWNHxkTE]J">
                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                      <field name="OID">javascript.0.WUNSCHNAME_Position</field>
                      <field name="WITH_DELAY">FALSE</field>
                      <value name="VALUE">
                        <block type="math_number" id="(j7#!ZvKTlD]GSbp:UzF">
                          <field name="NUM">100</field>
                        </block>
                      </value>
                    </block>
                  </next>
                </block>
              </statement>
              <value name="IF3">
                <block type="logic_compare" id="?lQzXli5+d;;k9;m|8iz">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="on_source" id="s.)4QOGC`+kA*ci2J)6m">
                      <field name="ATTR">state.val</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="text" id="ixN4S{]-,7T#_:LPb[Qf">
                      <field name="TEXT">closed</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO3">
                <block type="update" id="A-|9%)aV8*`,p#,cSsj*">
                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                  <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="text" id="Y6TbdcR!jqZw=Gmy`o`0">
                      <field name="TEXT">stopped</field>
                    </block>
                  </value>
                  <next>
                    <block type="update" id="s.z.oz#qw?6)=a}8CJ)G">
                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                      <field name="OID">javascript.0.WUNSCHNAME_Position</field>
                      <field name="WITH_DELAY">FALSE</field>
                      <value name="VALUE">
                        <block type="math_number" id=":%NQv=/Gy+Gh+RgX|!`^">
                          <field name="NUM">0</field>
                        </block>
                      </value>
                    </block>
                  </next>
                </block>
              </statement>
              <value name="IF4">
                <block type="logic_compare" id="G1j1HNmvyaLE_WVM@YlX">
                  <field name="OP">EQ</field>
                  <value name="A">
                    <block type="on_source" id="{i3`lO%;TmqU86gz.*r%">
                      <field name="ATTR">state.val</field>
                    </block>
                  </value>
                  <value name="B">
                    <block type="text" id="R!57y#]ci`V[7$D=d|{8">
                      <field name="TEXT">stopped</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO4">
                <block type="update" id="stt@TpRlAwXS#`N1LJ*F">
                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                  <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                  <field name="WITH_DELAY">FALSE</field>
                  <value name="VALUE">
                    <block type="text" id="S]+d5#Z#4=_.EhwEx9u0">
                      <field name="TEXT">stopped</field>
                    </block>
                  </value>
                  <next>
                    <block type="update" id="AGXz:l]_;;atG$nJ0V4C">
                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                      <field name="OID">javascript.0.WUNSCHNAME_Position</field>
                      <field name="WITH_DELAY">FALSE</field>
                      <value name="VALUE">
                        <block type="get_value" id="skz-C9?-x}ZW2%3fR`@n">
                          <field name="ATTR">val</field>
                          <field name="OID">shellyplus2pm.Cover0.Position</field>
                        </block>
                      </value>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </statement>
        </block>
        <block type="on_ext" id="c3K,~!}yI}|]veUh:pc7" x="113" y="513">
          <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="mrB7dB.brwhIR#6Lk96H">
              <field name="oid">javascript.0.WUNSCHNAME_TargetPosition</field>
            </shadow>
          </value>
          <statement name="STATEMENT">
            <block type="control" id="rw`J`%mEy%{Ioy18{^8D">
              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
              <field name="OID">shellyplus2pm.Cover0.Position</field>
              <field name="WITH_DELAY">FALSE</field>
              <value name="VALUE">
                <block type="get_value" id="x?]g~TPhJrU_[fE=H3kB">
                  <field name="ATTR">val</field>
                  <field name="OID">javascript.0.WUNSCHNAME_TargetPosition</field>
                </block>
              </value>
            </block>
          </statement>
        </block>
        <block type="comment" id=".@6P|j@b^l*(*(ByLszz" x="113" y="687">
          <field name="COMMENT">Schalter runter</field>
          <next>
            <block type="on_ext" id="CA@,@pxV}%gZ$C0:H]#(">
              <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="wM#9{j]3d4yu6P3xH{PA">
                  <field name="oid">shellyplus2pm.Input0.Status</field>
                </shadow>
              </value>
              <statement name="STATEMENT">
                <block type="timeouts_cleartimeout" id="DPcxRE|okhF-s|Iu%1]s">
                  <field name="NAME">timeout</field>
                  <next>
                    <block type="timeouts_cleartimeout" id="sT0AApjz?DVGnu`o){J(">
                      <field name="NAME">timeout2</field>
                      <next>
                        <block type="controls_if" id="cf]UUYtd/sYu`J%qa4y8">
                          <mutation elseif="1"></mutation>
                          <value name="IF0">
                            <block type="logic_compare" id="k]z~F/fjMO9$^N3=p-IO">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="l%yLdPi0_:Jju`KL`}D}">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="!d^Ws/vTZ3$ka;:f]J?E">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO0">
                            <block type="update" id="/WrN-_6H]}zG+~)s6fcb">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">javascript.0.WUNSCHNAME_TargetPosition</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="math_number" id="~bT{+A]3mZKZ%IbNUPT-">
                                  <field name="NUM">0</field>
                                </block>
                              </value>
                            </block>
                          </statement>
                          <value name="IF1">
                            <block type="logic_compare" id="6Q3lXI4jBlc4QzV+}Ooq">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="$2OK2~_mzCMU0+ZMOs8v">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="}@uez},yABCyRj!9XBWl">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO1">
                            <block type="update" id="{QFpgdqm-FBR;}5(PwDT">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="text" id="UR?n[ZBl)M0$$%Ne)PeN">
                                  <field name="TEXT">stopped</field>
                                </block>
                              </value>
                              <next>
                                <block type="timeouts_settimeout" id="KJZGivw5UHWH4*mu].ow">
                                  <field name="NAME">timeout</field>
                                  <field name="DELAY">2</field>
                                  <field name="UNIT">sec</field>
                                  <statement name="STATEMENT">
                                    <block type="controls_if" id="CWB*V)/U-UO|Es;cLReF">
                                      <value name="IF0">
                                        <block type="logic_compare" id="D-_N,n|QP~5|c8J2p8{~">
                                          <field name="OP">EQ</field>
                                          <value name="A">
                                            <block type="on_source" id="Zu1e^T}K!HV~]]tVVZ^G">
                                              <field name="ATTR">state.val</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="logic_boolean" id="!buJ]sLhkeZP-?G5~!QW">
                                              <field name="BOOL">FALSE</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <statement name="DO0">
                                        <block type="update" id="x!ZQ./Eop)~WKCbxA~Ow">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">javascript.0.WUNSCHNAME_Position</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="get_value" id="V5{`d{z;6iYX0U-kW~L5">
                                              <field name="ATTR">val</field>
                                              <field name="OID">shellyplus2pm.Cover0.Position</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="update" id="+M_Va?.A%`y5jp~Gwo{8">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">javascript.0.WUNSCHNAME_TargetPosition</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="get_value" id="R:;|g?,_?}JQ%(nJeH0A">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">shellyplus2pm.Cover0.Position</field>
                                                </block>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </statement>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </statement>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </next>
        </block>
        <block type="comment" id="@Y*V,;=q9)]mj7~MlLM^" x="112" y="1262">
          <field name="COMMENT">Schalter hoch</field>
          <next>
            <block type="on_ext" id="Lh1LM/,18RU^t#fLpPx?">
              <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="3WHn2bTT,Z8T5@=#6yoA">
                  <field name="oid">shellyplus2pm.Input1.Status</field>
                </shadow>
              </value>
              <statement name="STATEMENT">
                <block type="timeouts_cleartimeout" id="JTkm7UaCVyXtU/p?ny6?">
                  <field name="NAME">timeout</field>
                  <next>
                    <block type="timeouts_cleartimeout" id="O~h0^J4-TqUE:O4_VXM`">
                      <field name="NAME">timeout2</field>
                      <next>
                        <block type="controls_if" id="Q$^VlH+=+s9h2^)!$!g]">
                          <mutation elseif="1"></mutation>
                          <value name="IF0">
                            <block type="logic_compare" id="N[UbyOc_a:z1b!Up7HhI">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="(zv);OHG|U|JpfdA;Tuz">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="Ir3@-iI]u]3:H?O(CI{_">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO0">
                            <block type="update" id="h)c6]-523VJoQ::=~N8o">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">javascript.0.WUNSCHNAME_TargetPosition</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="math_number" id="`4B]d:JgEB$`|zM2w1=4">
                                  <field name="NUM">100</field>
                                </block>
                              </value>
                            </block>
                          </statement>
                          <value name="IF1">
                            <block type="logic_compare" id="}cpg_VlO|T2O;erv.vQ=">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="on_source" id="!L[IF55kgm8Fu`TN?M3G">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="Xcu!6D#f3jP.ty6Qfzd5">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <statement name="DO1">
                            <block type="update" id="f=uV8bk9(_OTqUY!L,^!">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">javascript.0.WUNSCHNAME_Status</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="text" id="BB{c{RV%O)gH[@Ww~qqJ">
                                  <field name="TEXT">stopped</field>
                                </block>
                              </value>
                              <next>
                                <block type="timeouts_settimeout" id="GtOJ^UkQsS1{qE_BeFW,">
                                  <field name="NAME">timeout2</field>
                                  <field name="DELAY">2</field>
                                  <field name="UNIT">sec</field>
                                  <statement name="STATEMENT">
                                    <block type="controls_if" id="N7O)FyH)81-.qExj*(DY">
                                      <value name="IF0">
                                        <block type="logic_compare" id=".P,:Xfh4g${]HuIS5Dh7">
                                          <field name="OP">EQ</field>
                                          <value name="A">
                                            <block type="on_source" id="tM$2_hbq+wilI=@B%6PL">
                                              <field name="ATTR">state.val</field>
                                            </block>
                                          </value>
                                          <value name="B">
                                            <block type="logic_boolean" id="T*.6K9*W?g,]zf6W8`V8">
                                              <field name="BOOL">FALSE</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <statement name="DO0">
                                        <block type="update" id="$0uw4Z}zQN$h]/Wy.%B)">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                          <field name="OID">javascript.0.WUNSCHNAME_Position</field>
                                          <field name="WITH_DELAY">FALSE</field>
                                          <value name="VALUE">
                                            <block type="get_value" id="#Gp?!,FbSAZ#pa2/?5b!">
                                              <field name="ATTR">val</field>
                                              <field name="OID">shellyplus2pm.Cover0.Position</field>
                                            </block>
                                          </value>
                                          <next>
                                            <block type="update" id="u!uK?gO`Rd(Jd$!QJ5qE">
                                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                              <field name="OID">javascript.0.WUNSCHNAME_TargetPosition</field>
                                              <field name="WITH_DELAY">FALSE</field>
                                              <value name="VALUE">
                                                <block type="get_value" id="i1*UpLt?u4HjW-]}6LB(">
                                                  <field name="ATTR">val</field>
                                                  <field name="OID">shellyplus2pm.Cover0.Position</field>
                                                </block>
                                              </value>
                                            </block>
                                          </next>
                                        </block>
                                      </statement>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </statement>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </next>
        </block>
      </xml>
      

      Im Yahka-Adapter müssen folgende Werte genutzt werden:


      Yahka.jpg

      Wahrscheinlich lässt sich das Skript noch einfacher und effizienter gestalten. Vielleicht hat ja jemand Interesse, es zu verbessern.

      N 1 Reply Last reply Reply Quote 0
      • N
        NickWu @ionar last edited by NickWu

        @ionar Hallo!

        Super cool, dass du deine Arbeit hier geteilt hast, vielen Dank dafür! Ich habe die letzten Monate immer wieder versucht die Rollladen über den Shelly 2 PM in yahka zu bekommen und bin kläglich gescheitert.

        EDIT
        Nach etwas Probiererei habe ich es geschafft, dein Skript soweit einzurichten 🙂 Allerdings wird dauerhaft angezeigt "wird geöffnet".

        Kannst du sagen, was ich hier ggf. falsch gemacht habe?

        "EDIT-2*
        Ich habe jetzt den Datenpunkten den initialen Wert "open" gegeben - danach lief alles 🙂 Ganz vielen Dank nochmal für das Bereitstellen dieser tollen Lösung!

        Vielen Dank vorab!
        Nick

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

        Support us

        ioBroker
        Community Adapters
        Donate

        581
        Online

        31.6k
        Users

        79.5k
        Topics

        1.3m
        Posts

        blockly climate
        2
        2
        316
        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