Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. [Vorlage] Blockly "Kommt oder geht jemand" oder Reihenfolge Aktorschaltung

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    16
    1
    244

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    4.5k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.3k

[Vorlage] Blockly "Kommt oder geht jemand" oder Reihenfolge Aktorschaltung

Scheduled Pinned Locked Moved Skripten / Logik
blocklytemplate
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • rantanplanR Offline
    rantanplanR Offline
    rantanplan
    wrote on last edited by rantanplan
    #1

    Hallo Zusammen

    Ich habe zwei HomeMatic Bewegungsmelder für die Außenbeleuchtung im Einsatz.
    Einer überwacht das Tor zum Grundstück der Andere den Eingang ins Haus.
    Nun habe ich mir gedacht, das sich die BM's bestimmt langweilen wenn sie nur das Licht im Dunkeln einschalten.
    Jetzt haben sie noch die weitere Aufgabe mir zu melden ob jemand kommt oder geht.

    Was geht nicht:
    Es können keine Personen gezählt werden.
    Wenn auf der überwachten Strecke laufend Personen hin- und herlaufen geht's auch schief.
    Für so etwas sind die BM's nicht geeignet.

    Aber so als Info, finde ich das ganz nett.
    Man könnte natürlich einen Zeitbereich besonders überwachen.
    Wenn jemand zwischen 0 Uhr und 2 Uhr kommt, Haus auf DEVCON 3 schalten. ;)
    (Aber aufpassen, ich habe z.B. festgestellt, dass unser Zeitungsbote sehr früh kommt.)

    Noch etwas.
    Die BM's von HomeMatic schalten ihren Datenpunkt "MOTION" bei Bewegung auf WAHR und wenn keine Bewegung mehr erkannt wird wieder auf "UNWAHR".
    Es gibt andere BM's die das leider nicht machen. Da müsste das Beispiel (irgendwie?!) angepasst werden.

    Man kann das Prinzip aber auch anderweitig übernehmen, wenn man wissen will in welcher Reihenfolge Aktoren geschaltet werden.

    Doch nun zum Blockly.
    Es wird eine globale Variable/Datenpunkt "InOrOut" angelegt.
    In diese Variable wird der "Endzustand" geschrieben. "Jemand kommt" oder "Jemand geht"
    Diese Variable kann man sich z.B. in VIS anzeigen lassen.
    Und/Oder man triggert sie auf Änderung und reagiert je nach Inhalt.

    Mit der lokalen Variablen "Status" wird die Reihenfolge/Richtung ermittelt.
    Der BM am Tor liefert ein "T" und der am Eingang ein "E"
    Ist "Status" = "TE" hat das Tor zuerst gemeldet und dann der Eingang ("Jemand kommt")
    Bei "Status" = "ET" hat der Eingang zuerst gemeldet und dann das Tor ("Jemand geht")

    Ach so.
    Beide Aktoren werden getriggert. Unterschieden wird dann über den Gerätenamen des ausgelösten Aktors.

    Ich hoffe es kann jemand gebrauchen.
    147_vorlage_inorout.png

    Export:

    <xml xmlns="http://www.w3.org/1999/xhtml">
      <block type="comment" id="!x(V1^2=W9uh.:LMVJ;O" x="-2163" y="-787">
        <field name="COMMENT">Variable anlegen und initialisieren</field>
        <next>
          <block type="create" id="q*o:idWJ}jVLgK%3FO7Q">
            <field name="NAME">InOrOut</field>
            <statement name="STATEMENT">
              <block type="control" id="al5d%qyR0b5EV0~ULW~K">
                <mutation delay_input="false"></mutation>
                <field name="OID">javascript.0.InOrOut</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="text" id="WOXF*eOfR{7tksGwR*G.">
                    <field name="TEXT"></field>
                  </block>
                </value>
              </block>
            </statement>
            <next>
              <block type="comment" id="nnIMM[-/~V@@N;Ya(xx*">
                <field name="COMMENT">Status triggern</field>
                <next>
                  <block type="on_ext" id="K{ZJv4p/A.D{}sYi2H95">
                    <mutation items="2"></mutation>
                    <field name="CONDITION">ne</field>
                    <field name="ACK_CONDITION"></field>
                    <value name="OID0">
                      <shadow type="field_oid" id=";UIf#j[NRj%^baNTo;=p">
                        <field name="oid">hm-rpc.0.KEQ0195267.1.MOTION</field>
                      </shadow>
                    </value>
                    <value name="OID1">
                      <shadow type="field_oid" id="!B[[(u:4cBg!dhA-UiFQ">
                        <field name="oid">hm-rpc.0.LEQ0169150.1.MOTION</field>
                      </shadow>
                    </value>
                    <statement name="STATEMENT">
                      <block type="controls_if" id=";=]U2/r+@6/3c@bHtw.M">
                        <value name="IF0">
                          <block type="logic_compare" id="D?yG8au]@nvFW4W[KdSR">
                            <field name="OP">EQ</field>
                            <value name="A">
                              <block type="on_source" id="*V1ZB?z,f!~2[(jwEMm,">
                                <field name="ATTR">deviceName</field>
                              </block>
                            </value>
                            <value name="B">
                              <block type="text" id="Af!4W(!=4`QDUuS]q1=g">
                                <field name="TEXT">MDIR-Tor</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <statement name="DO0">
                          <block type="controls_if" id="[PD-[k`a1b.f%a4}s4/x">
                            <mutation else="1"></mutation>
                            <value name="IF0">
                              <block type="logic_compare" id="~f{@#mkYC:YqU*mf4u*w">
                                <field name="OP">EQ</field>
                                <value name="A">
                                  <block type="get_value" id="U?lL954J*!@wwa.fFW/G">
                                    <field name="ATTR">val</field>
                                    <field name="OID">hm-rpc.0.KEQ0195267.1.MOTION</field>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="logic_boolean" id="/7bQ9um^~80lhcoaolzF">
                                    <field name="BOOL">TRUE</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="comment" id="!HCn8x*q~_t{;O0rTYTm">
                                <field name="COMMENT">Am Tor Bewegung</field>
                                <next>
                                  <block type="procedures_callnoreturn" id="ipf8QEz0--5p,uVD_{E_">
                                    <mutation name="setStatus">
                                      <arg name="myParameter"></arg>
                                    </mutation>
                                    <value name="ARG0">
                                      <block type="text" id="lUXSIns8V}nTy^;jwICD">
                                        <field name="TEXT">T</field>
                                      </block>
                                    </value>
                                  </block>
                                </next>
                              </block>
                            </statement>
                            <statement name="ELSE">
                              <block type="procedures_callnoreturn" id="wp?tnw]o`NNW],n|a9:i">
                                <mutation name="clearStatus"></mutation>
                              </block>
                            </statement>
                          </block>
                        </statement>
                        <next>
                          <block type="controls_if" id="l]K5+K7k`lA4qBS!hn}8">
                            <value name="IF0">
                              <block type="logic_compare" id="L7c0!LmC!|P#D-?nL}(c">
                                <field name="OP">EQ</field>
                                <value name="A">
                                  <block type="on_source" id="P|JXf^zWaIJ4g@Y}1VTB">
                                    <field name="ATTR">deviceName</field>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="text" id="H*uXC%_*!J|z_?`:hln^">
                                    <field name="TEXT">MDIR-Eingang</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="controls_if" id="_Ar3,XpA`ko+6f^Ojv85">
                                <mutation else="1"></mutation>
                                <value name="IF0">
                                  <block type="logic_compare" id="EdsuZ0MGdu=L??IgWs:S">
                                    <field name="OP">EQ</field>
                                    <value name="A">
                                      <block type="get_value" id="+Y,Gt+eBb(pS(Qp6_f[X">
                                        <field name="ATTR">val</field>
                                        <field name="OID">hm-rpc.0.LEQ0169150.1.MOTION</field>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <block type="logic_boolean" id="0k|z+#PS3~[@NRnoH#-s">
                                        <field name="BOOL">TRUE</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <statement name="DO0">
                                  <block type="comment" id="O6lBK|1Sv*f~r!Kol,m{">
                                    <field name="COMMENT">Am Eingang Bewegung</field>
                                    <next>
                                      <block type="procedures_callnoreturn" id="%fyAbaMQgmDL/o/mPH]1">
                                        <mutation name="setStatus">
                                          <arg name="myParameter"></arg>
                                        </mutation>
                                        <value name="ARG0">
                                          <block type="text" id="kf{m^V8)Z3eJ%khfO4Xm">
                                            <field name="TEXT">E</field>
                                          </block>
                                        </value>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                                <statement name="ELSE">
                                  <block type="procedures_callnoreturn" id="}5;M;Ty@yRA:Ud=69hL[">
                                    <mutation name="clearStatus"></mutation>
                                  </block>
                                </statement>
                              </block>
                            </statement>
                          </block>
                        </next>
                      </block>
                    </statement>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
      <block type="procedures_defnoreturn" id="r46;+jIw:T=zLPBt{}o7" x="-1462" y="-788">
        <mutation>
          <arg name="myParameter"></arg>
        </mutation>
        <field name="NAME">setStatus</field>
        <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
        <statement name="STACK">
          <block type="comment" id=")CYs-T[)n`Ni^Y@oI^^B">
            <field name="COMMENT">Status mit myParameter zusammenbauen</field>
            <next>
              <block type="text_append" id="*napB{=bYVq}21uFjAT8">
                <field name="VAR">Status</field>
                <value name="TEXT">
                  <shadow type="text" id=";C|IQW2AubMy{YCE,p,)">
                    <field name="TEXT"></field>
                  </shadow>
                  <block type="variables_get" id="2eBvu8+Xn~98(]^5#(oR">
                    <field name="VAR">myParameter</field>
                  </block>
                </value>
                <next>
                  <block type="controls_if" id="N5V;RGbp_:xazm?vvWW8">
                    <mutation elseif="1"></mutation>
                    <value name="IF0">
                      <block type="logic_compare" id="P8b(HuV:k6r]cZ?Le;3#">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="variables_get" id="cCm=h1v*pkX4h`BFjsB:">
                            <field name="VAR">Status</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="text" id="R^:.y!amlUdLay_8!7:C">
                            <field name="TEXT">TE</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="comment" id="4Vq9}fIU:V@4LaAgzAr?">
                        <field name="COMMENT">Bewegung vom Tor zum Eingang</field>
                        <next>
                          <block type="control" id=";vnRJ;9z]_skkHM!^oFw">
                            <mutation delay_input="false"></mutation>
                            <field name="OID">javascript.0.InOrOut</field>
                            <field name="WITH_DELAY">FALSE</field>
                            <value name="VALUE">
                              <block type="text" id="n,WcrZxMt#LTdq;bIQ-h">
                                <field name="TEXT">Jemand kommt</field>
                              </block>
                            </value>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <value name="IF1">
                      <block type="logic_compare" id="N=u_Ic2TMDL.pgck?U.D">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="variables_get" id="J^(a!xufk?[Q6{nAUF9~">
                            <field name="VAR">Status</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="text" id="qn-I4|8s1:nSohqMvu-%">
                            <field name="TEXT">ET</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO1">
                      <block type="comment" id="!tXX%F(YY;Db%}pC?Cyt">
                        <field name="COMMENT">Bewegung vom Eingang zum Tor</field>
                        <next>
                          <block type="control" id="pzTnRx,%PQ1[~`e}d`zv">
                            <mutation delay_input="false"></mutation>
                            <field name="OID">javascript.0.InOrOut</field>
                            <field name="WITH_DELAY">FALSE</field>
                            <value name="VALUE">
                              <block type="text" id="J`30k3(.snk!:cnPe9%V">
                                <field name="TEXT">Jemand geht</field>
                              </block>
                            </value>
                          </block>
                        </next>
                      </block>
                    </statement>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
      </block>
      <block type="procedures_defnoreturn" id="``eYk-a+gmHPS]h.er%2" x="-1462" y="-463">
        <field name="NAME">clearStatus</field>
        <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
        <statement name="STACK">
          <block type="comment" id="%OMX{f42N_qg@@S9k!~K">
            <field name="COMMENT">Wenn keine Bewegung mehr alles auf ""</field>
            <next>
              <block type="controls_if" id="Yj%3Wv-!l{C;Z9:?BcC~">
                <value name="IF0">
                  <block type="logic_operation" id="6rrVdNZ-HI,SZleh`NRy" inline="false">
                    <field name="OP">AND</field>
                    <value name="A">
                      <block type="logic_compare" id="|/~rDyLm?BQ%_+KXFy``">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="get_value" id="K2tqnZ4avJ9A2|vT`u^.">
                            <field name="ATTR">val</field>
                            <field name="OID">hm-rpc.0.KEQ0195267.1.MOTION</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="logic_boolean" id="b8?p%%t`qL!uDGr4.N=y">
                            <field name="BOOL">FALSE</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <value name="B">
                      <block type="logic_compare" id="Wg!Y@,nMByf!=u[x(l+I">
                        <field name="OP">EQ</field>
                        <value name="A">
                          <block type="get_value" id="Qg_+T=D#ulU=`NtZvm`1">
                            <field name="ATTR">val</field>
                            <field name="OID">hm-rpc.0.LEQ0169150.1.MOTION</field>
                          </block>
                        </value>
                        <value name="B">
                          <block type="logic_boolean" id="L6MkeOjTR{Lz%AJ,Rw0?">
                            <field name="BOOL">FALSE</field>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
                <statement name="DO0">
                  <block type="variables_set" id="CiU6J_A#~kF^#tZjq(_n">
                    <field name="VAR">Status</field>
                    <value name="VALUE">
                      <block type="text" id="|MEYXU,}V=xzgt2c-t=Y">
                        <field name="TEXT"></field>
                      </block>
                    </value>
                    <next>
                      <block type="control" id="gi2~~eaZP5LXcRU5cQpT">
                        <mutation delay_input="false"></mutation>
                        <field name="OID">javascript.0.InOrOut</field>
                        <field name="WITH_DELAY">FALSE</field>
                        <value name="VALUE">
                          <block type="variables_get" id="A~vO#+I~OC=2%v#VxNBS">
                            <field name="VAR">Status</field>
                          </block>
                        </value>
                      </block>
                    </next>
                  </block>
                </statement>
              </block>
            </next>
          </block>
        </statement>
      </block>
    </xml>
    

    Bei Fragen, fragen.

    Grüße

    Rantanplan

    CCU3 / MS Server 2019(VM) / Scripten mit Blockly

    1 Reply Last reply
    1
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    Support us

    ioBroker
    Community Adapters
    Donate

    596

    Online

    32.7k

    Users

    82.5k

    Topics

    1.3m

    Posts
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
    ioBroker Community 2014-2025
    logo
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Home
    • Recent
    • Tags
    • Unread 0
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe