Skip to content

Garagentor mit zwei Geräten _ Kontaktsensor und potentialfreien Kontakt

Nico Hartung edited this page Jun 9, 2020 · 1 revision

Ich habe bei mir einen HomeKit GaragenDoorOpener umgesetzt, dazu benötigt man einem Kontaktsensor (bei mir, Devolo MT2648) und einem Aktor der einen potentialfreien Kontakt schalten kann (bei mir, Qubino Flush 1D).

Yahka

Es werden zwei Datenpunkt in ioBroker benötigt.

Service-Typ: GaragenDoorOpener

Characteristic: CurrentDoorState
InOut: ioBroker.State
 State: 0_userdata.0.garagentor.varCurrentDoorState
Conversion: passthrough
Characteristic: TargetDoorState
InOut: ioBroker.State
 State: 0_userdata.0.garagentor.varTargetDoorState
Conversion: passthrough

Skripts

Nun noch zwei Skripts in ioBroker, hier Blockly.

Skript #1

Um die Funktionalität abzubilden, damit etwas passiert wenn die Variablen geschaltet werden.

🚨 Natürlich müssen die Datenpunkte ausgetauscht werden!

<xml xmlns="https://developers.google.com/blockly/xml">
  <variables>
    <variable type="timeout" id="timeout">timeout</variable>
  </variables>
  <block type="comment" id="o}(@`wPvkYK+d^H%xkz{" x="38" y="363">
    <field name="COMMENT">https://forum.iobroker.net/topic/15996/garagentor-mit-sonoff-und-reedkontakte-in-yahka-homekit/33</field>
    <next>
      <block type="on_ext" id="?eKDJrwYwcM-d.=V-rku">
        <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
        <field name="CONDITION">ne</field>
        <field name="ACK_CONDITION">false</field>
        <value name="OID0">
          <shadow type="field_oid" id="Ppyr(nj*pW~c{`NjKeI/">
            <field name="oid">0_userdata.0.garagentor.varTargetDoorState</field>
          </shadow>
        </value>
        <statement name="STATEMENT">
          <block type="control" id="iCdF*jtMQQx$th35QpZ(">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">zwave.0.NODE12.SWITCH_BINARY.Switch_1</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="3TRo3^JndLEbF_epMF=1">
                <field name="BOOL">TRUE</field>
              </block>
            </value>
            <next>
              <block type="control" id="LTW@57BCR8%%sSWeV.cJ">
                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                <field name="OID">zwave.0.NODE12.SWITCH_BINARY.Switch_1</field>
                <field name="WITH_DELAY">TRUE</field>
                <field name="DELAY_MS">200</field>
                <field name="UNIT">ms</field>
                <field name="CLEAR_RUNNING">FALSE</field>
                <value name="VALUE">
                  <block type="logic_boolean" id="W6KWqp*KgSj0}iWX#?%b">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
                <next>
                  <block type="telegram" id="C0}Ma!F2;RY/27/:0eWQ">
                    <field name="INSTANCE">.1</field>
                    <field name="LOG">log</field>
                    <field name="SILENT">FALSE</field>
                    <field name="PARSEMODE">default</field>
                    <value name="MESSAGE">
                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="Rn^(0Ui^p,dNWYAN4B3z">
                        <field name="TEXT">text</field>
                      </shadow>
                      <block type="text" id="S6k{=d$A5#IYH[MxO(*B">
                        <field name="TEXT">🚌 Garagentor über HomeKit gesteuert: Garagentorantrieb eingeschaltet, direkt wieder aus</field>
                      </block>
                    </value>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
        <next>
          <block type="on_ext" id="!hp:e_ne-SkbWff+[a3~">
            <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="C8qX$1Soa0LBgFAb9d~=">
                <field name="oid">zwave.0.NODE9.SENSOR_BINARY.Sensor_1</field>
              </shadow>
            </value>
            <statement name="STATEMENT">
              <block type="comment" id="7=kTnkwyJM*hKcyFE|x]">
                <field name="COMMENT">Garage geschlossen: false || falsch || unwahr</field>
                <next>
                  <block type="controls_if" id="g|Y8e}%}LSKGmg{C,+iy">
                    <value name="IF0">
                      <block type="logic_compare" id="5XQ5w#M/2`?_5#}`~r|H">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="get_value" id="6JY]oE.g,[@+s9Ln6KpT">
                            <field name="ATTR">val</field>
                            <field name="OID">zwave.0.NODE9.SENSOR_BINARY.Sensor_1</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="logic_boolean" id="ef/?.oY]r{ZI.^$tKgmf">
                            <field name="BOOL">FALSE</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="update" id="2lj6`6g_LcmM%,eKcQEH">
                        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                        <field name="OID">0_userdata.0.garagentor.varTargetDoorState</field>
                        <field name="WITH_DELAY">FALSE</field>
                        <value name="VALUE">
                          <block type="math_number" id="h[t6ASKpP;@=LJ=O-NGa">
                            <field name="NUM">1</field>
                          </block>
                        </value>
                        <next>
                          <block type="update" id="oZGZ}PS.:K)7~i%Nc{tA">
                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                            <field name="OID">0_userdata.0.garagentor.varCurrentDoorState</field>
                            <field name="WITH_DELAY">FALSE</field>
                            <value name="VALUE">
                              <block type="math_number" id="Zra!fHm{S=ZjBrmc$%91">
                                <field name="NUM">1</field>
                              </block>
                            </value>
                            <next>
                              <block type="telegram" id="-_lKm%{V6/II;Y?Aoq5x">
                                <field name="INSTANCE">.1</field>
                                <field name="LOG">log</field>
                                <field name="SILENT">FALSE</field>
                                <field name="PARSEMODE">default</field>
                                <value name="MESSAGE">
                                  <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="Rn^(0Ui^p,dNWYAN4B3z">
                                    <field name="TEXT">text</field>
                                  </shadow>
                                  <block type="text" id="Q2hknVEY]uq4%Y0~[JPd">
                                    <field name="TEXT">🚌 Garagentorkontakt geschlossen: HomeKit-Status auf 'geschlossen'</field>
                                  </block>
                                </value>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <next>
                      <block type="comment" id="uIl9n7_LK$C$!ba`X2]1">
                        <field name="COMMENT">Garage offen: true || wahr</field>
                        <next>
                          <block type="controls_if" id="gCRLCIK?$M7M%iyCbw-O">
                            <value name="IF0">
                              <block type="logic_compare" id="=hu;9UU*Y[Va+(^9]rL,">
                                <field name="OP">EQ</field>
                                <value name="A">
                                  <block type="get_value" id="nq[MPL6NZllx?1CMU_l_">
                                    <field name="ATTR">val</field>
                                    <field name="OID">zwave.0.NODE9.SENSOR_BINARY.Sensor_1</field>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="logic_boolean" id=".y2b;2-Q|XKe`2tLT|Y$">
                                    <field name="BOOL">TRUE</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="update" id="73%c48|~ORABc|xbxF-@">
                                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                <field name="OID">0_userdata.0.garagentor.varTargetDoorState</field>
                                <field name="WITH_DELAY">FALSE</field>
                                <value name="VALUE">
                                  <block type="math_number" id="Uvc$es#(Rq_-m-mk*.76">
                                    <field name="NUM">0</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="telegram" id="F})o^[{emvfc866mOY)1">
                                    <field name="INSTANCE">.1</field>
                                    <field name="LOG">log</field>
                                    <field name="SILENT">FALSE</field>
                                    <field name="PARSEMODE">default</field>
                                    <value name="MESSAGE">
                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="Rn^(0Ui^p,dNWYAN4B3z">
                                        <field name="TEXT">text</field>
                                      </shadow>
                                      <block type="text" id="1aBwwJ])siM}:l]wVw8l">
                                        <field name="TEXT">🚌 Garagentorkontakt geöffnet: HomeKit-Status auf 'wird geöffnet'</field>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="timeouts_settimeout" id="0,m|zmAXQK$3NW+@(zEQ">
                                        <field name="NAME">timeout</field>
                                        <field name="DELAY">15000</field>
                                        <field name="UNIT">ms</field>
                                        <statement name="STATEMENT">
                                          <block type="controls_if" id="?2NMsIj7Iz#XtNDS{^PL">
                                            <value name="IF0">
                                              <block type="logic_compare" id="!mn3q3Q$A?x|9B(Qr;3Q">
                                                <field name="OP">EQ</field>
                                                <value name="A">
                                                  <block type="get_value" id="?vuFHyDsWKtw@HeXR)4-">
                                                    <field name="ATTR">val</field>
                                                    <field name="OID">zwave.0.NODE9.SENSOR_BINARY.Sensor_1</field>
                                                  </block>
                                                </value>
                                                <value name="B">
                                                  <block type="logic_boolean" id="R{95U+bO=5FMDGfBnB`;">
                                                    <field name="BOOL">TRUE</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="update" id="N*vH1IkwP4^g0dSv4HUf">
                                                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                <field name="OID">0_userdata.0.garagentor.varCurrentDoorState</field>
                                                <field name="WITH_DELAY">FALSE</field>
                                                <value name="VALUE">
                                                  <block type="math_number" id="$,7tq=hu|OIUSXx5E_kU">
                                                    <field name="NUM">0</field>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="telegram" id="z%u*JzVw~SR.tkhbGWjL">
                                                    <field name="INSTANCE">.1</field>
                                                    <field name="LOG">log</field>
                                                    <field name="SILENT">FALSE</field>
                                                    <field name="PARSEMODE">default</field>
                                                    <value name="MESSAGE">
                                                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="Rn^(0Ui^p,dNWYAN4B3z">
                                                        <field name="TEXT">text</field>
                                                      </shadow>
                                                      <block type="text" id="`xeCAb3sl:ZgR=WHugR}">
                                                        <field name="TEXT">🚌 Garagentorkontakt geöffnet: HomeKit-Status auf 'geöffnet'</field>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="timeouts_cleartimeout" id="Nf+ZrIRhL(Vu[]*UT0}:">
                                                        <field name="NAME">timeout</field>
                                                      </block>
                                                    </next>
                                                  </block>
                                                </next>
                                              </block>
                                            </statement>
                                          </block>
                                        </statement>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </statement>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </statement>
          </block>
        </next>
      </block>
    </next>
  </block>
</xml>

Skript #2

Damit der potentialfreie Kontakt, nach dem Schaltvorgang, wieder ausgeschaltet wird.

🚨 Natürlich müssen die Datenpunkte ausgetauscht werden!

<xml xmlns="https://developers.google.com/blockly/xml">
  <variables>
    <variable type="timeout" id="timeout">timeout</variable>
  </variables>
  <block type="on_ext" id="tQenwH4dQe+;Pl5g52[I" x="38" y="38">
    <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
    <field name="CONDITION">true</field>
    <field name="ACK_CONDITION">false</field>
    <value name="OID0">
      <shadow type="field_oid" id="_9L/Wkv`b?BPkmTCy{O%">
        <field name="oid">zwave.0.NODE12.SWITCH_BINARY.Switch_1</field>
      </shadow>
    </value>
    <statement name="STATEMENT">
      <block type="timeouts_settimeout" id="c#Fb)csGqCkqk)%,00A(">
        <field name="NAME">timeout</field>
        <field name="DELAY">2000</field>
        <field name="UNIT">ms</field>
        <statement name="STATEMENT">
          <block type="controls_if" id="w]d]k7!q)rEY#aT2[N4;">
            <value name="IF0">
              <block type="logic_compare" id="@A)CLJLB$^{S-9lu5Ulp">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="}2c}ggp[N+@yndpEsL.M">
                    <field name="ATTR">val</field>
                    <field name="OID">zwave.0.NODE12.SWITCH_BINARY.Switch_1</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="pF3SX4QDleU8xjPH2Eu{">
                    <field name="BOOL">TRUE</field>
                  </block>
                </value>
              </block>
            </value>
            <statement name="DO0">
              <block type="control" id="rgd6.BKoq$vl{aAppapk">
                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                <field name="OID">zwave.0.NODE12.SWITCH_BINARY.Switch_1</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="logic_boolean" id="(UHHPq{Ejs]N=}M_d3#-">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
                <next>
                  <block type="telegram" id="h:juW*i?%Zud!xQuP{Vz">
                    <field name="INSTANCE">.1</field>
                    <field name="LOG">log</field>
                    <field name="SILENT">FALSE</field>
                    <field name="PARSEMODE">default</field>
                    <value name="MESSAGE">
                      <shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="~R$2Zu/iu9V|K2%pY:jT">
                        <field name="TEXT">text</field>
                      </shadow>
                      <block type="text" id="sV~_Jc4ieGY,s^^*+QcE">
                        <field name="TEXT">🚌 Garagentorantrieb schon länger eingeschaltet: Garagentorantrieb aus</field>
                      </block>
                    </value>
                    <next>
                      <block type="timeouts_cleartimeout" id="Hd$ql1J`Q[[6m0{)G4LT">
                        <field name="NAME">timeout</field>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </statement>
          </block>
        </statement>
      </block>
    </statement>
  </block>
</xml>