Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Lichttaster: Szenen wechseln mit "aus" wenn an

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Lichttaster: Szenen wechseln mit "aus" wenn an

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

      Guten Abend,

      ich versuche gerade meine Zigbee2mqtt-Lichtgruppen via Blockly zu steuern.

      Trigger ist ein Taster.

      Ich hätte es gerne so:

      • Wenn Licht aus, dann schaltet der Taster die Szenen durch (letzte Szene ist "Licht aus", nach 4 Sekunden ohne Tastendruck setzt der Zähler wieder auf Null).

      • Wenn Licht (länger als die 4 Sekunden Szenenwechselzeitfenster) an, dann soll der erst Klick "Licht aus" sein und danach die weiteren Szenen angehen.

      So dass man es ganz intuitiv hat: Licht ist aus, man wechselt über den Taster in die gewünschte Szene; ist das Licht an, ist der erste Klick aus.

      Screenshot 2023-02-15 211559.png

      Mein Problem:
      So wie dargestellt ist der erste Klick immer "Licht aus". Das heißt, wenn das Licht aus ist, klicke ich 2x bis zum ersten Szenenlicht.
      Wenn ich eine "Wenn Licht an dann aus" davorsetze dann komme ich aber nie in die anderen Lichtszenen...ein Teufelskreis.
      Hat jemand eine IDee?

      Cinimod 1 Reply Last reply Reply Quote 0
      • Cinimod
        Cinimod Most Active @Solear last edited by

        @solear

        Frag doch erst ab ob das Licht schon aus ist, wenn das so ist erhöhe den Zähler einfach um eine weitere 1, dann überspringst du doch die erste Szene.

        etwa so:

        Bildschirmfoto 2023-02-15 um 21.54.44.png

        S 1 Reply Last reply Reply Quote 1
        • S
          Solear @Cinimod last edited by

          @cinimod
          Vielen Dank!
          Aber dann kann ich das Licht nie wieder ausschalten, oder? Da der dann immer sofort um 1 erhöht und damit den Aus-Trigger überspringt?

          Cinimod 1 Reply Last reply Reply Quote 0
          • Cinimod
            Cinimod Most Active @Solear last edited by Cinimod

            @solear
            Der Zähler wird doch nur erhöht wenn das Licht der Küchenzeile schon aus ist. Sollte das nicht der fall sein, läuft dein script wie du es vorher geschrieben hast.

            Ich hab dir zum Skriptstart auch noch eingesetzt das der Zähler auf 0 gesetzt wird.

            S 1 Reply Last reply Reply Quote 1
            • S
              Solear @Cinimod last edited by Solear

              @cinimod Vielen Dank! Ich habe es jetzt nachgebaut. An sich funktioniert das wie gewünscht, aber wenn man über einen Zyklus durchschaltet dann fängt er mit Szene 3 (ultrahell) an.

              Aber du hast mich auf den richtigen Weg gebracht, ich probiere mal weiter und berichte hier.
              Vielen Dank!

              1 Reply Last reply Reply Quote 0
              • S
                Solear last edited by Solear

                Jetzt geht es, wie ich es mir wünsche.
                Er schaltet die Szenen endlos durch, und wenn nach 4 Sekunden der erste Klick erst kommt dann ist die erste Szene "ausschalten".
                Perfekt.
                Und für andere Schalter kann ich das als Vorlage nehmen und beliebig viele Szenen ohne großen Umbau mit dazwischenschieben.

                Vielen Dank für die Unterstützung, @cinimod!

                jaaaaaa.png

                Blocklycode:

                <xml xmlns="https://developers.google.com/blockly/xml">
                  <variables>
                    <variable id="!]2uNISp)(2z[:rRlh[K">Klicks</variable>
                    <variable type="timeout" id="timeout">timeout</variable>
                  </variables>
                  <block type="comment" id="K_L^@~T6I$hSAIs7?XvC" x="137" y="-38">
                    <field name="COMMENT">Szenenwechsel bei jedem Klick</field>
                    <next>
                      <block type="comment" id="r}C#a.(4@J{{9^.=8gn,">
                        <field name="COMMENT">Nach 4s Pause ist die 1. Szene "aus"</field>
                        <next>
                          <block type="variables_set" id="?hkjQ),jsEn.X!lMxKX6">
                            <field name="VAR" id="!]2uNISp)(2z[:rRlh[K">Klicks</field>
                            <value name="VALUE">
                              <block type="math_number" id="h!c7MtE0GCQ6qW#}?,hM">
                                <field name="NUM">0</field>
                              </block>
                            </value>
                            <next>
                              <block type="on_ext" id="%z~o_GT_v*/QON4]}DyG">
                                <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                <field name="CONDITION">gt</field>
                                <field name="ACK_CONDITION"></field>
                                <value name="OID0">
                                  <shadow type="field_oid" id="cJyG]hyC?jpbXC{2w-H7">
                                    <field name="oid">zigbee2mqtt.0.0x001788010b036de3.left_press</field>
                                  </shadow>
                                </value>
                                <statement name="STATEMENT">
                                  <block type="math_change" id="Wk7j3Uy))Ts*J~0j9o}J">
                                    <field name="VAR" id="!]2uNISp)(2z[:rRlh[K">Klicks</field>
                                    <value name="DELTA">
                                      <shadow type="math_number" id="pH{ZQBPxF$Ymr]`|~%#k">
                                        <field name="NUM">1</field>
                                      </shadow>
                                    </value>
                                    <next>
                                      <block type="logic_switch_case" id="*Yw0V551#@)!/#kwuj~r">
                                        <mutation xmlns="http://www.w3.org/1999/xhtml" case="2"></mutation>
                                        <value name="CONDITION">
                                          <block type="variables_get" id="^t*u(J5u5zkP*fN+{?L^">
                                            <field name="VAR" id="!]2uNISp)(2z[:rRlh[K">Klicks</field>
                                          </block>
                                        </value>
                                        <value name="CASECONDITION0">
                                          <block type="math_number" id="tt-6$J5_,nG~C3Jj{|P0">
                                            <field name="NUM">1</field>
                                          </block>
                                        </value>
                                        <statement name="CASE0">
                                          <block type="control" id="k$wBV%n@$xJVf.Tk!C2.">
                                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                            <field name="OID">zigbee2mqtt.0.group_1.scene_3</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="+ds26DyFaBid},v;0$Q+">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="timeouts_cleartimeout" id="*~%aP=m0mIIZ6G*C(3@O">
                                                <field name="NAME">timeout</field>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                        <value name="CASECONDITION1">
                                          <block type="math_number" id="gq)W,Y%FV3*c9D#qJI!b">
                                            <field name="NUM">2</field>
                                          </block>
                                        </value>
                                        <statement name="CASE1">
                                          <block type="control" id="?/PIK82pBr#B?=-5RZK:">
                                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                            <field name="OID">zigbee2mqtt.0.group_1.scene_0</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="3iz}eYh1qmWna-+F+gVu">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="timeouts_cleartimeout" id="uBqz1adGFjrEPJVN#Zru">
                                                <field name="NAME">timeout</field>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                        <value name="CASECONDITION2">
                                          <block type="math_number" id="dO`jPL$5/r#4DB.$!7,I">
                                            <field name="NUM">3</field>
                                          </block>
                                        </value>
                                        <statement name="CASE2">
                                          <block type="control" id="n8brd[emU1kh$`-e_vy,">
                                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                            <field name="OID">zigbee2mqtt.0.group_1.scene_2</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE">
                                              <block type="logic_boolean" id="SdHJ8-Yz7Q[0`}6#~8hF">
                                                <field name="BOOL">TRUE</field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="timeouts_cleartimeout" id="~z_Bx1J:!9rm!HX9xlDn">
                                                <field name="NAME">timeout</field>
                                                <next>
                                                  <block type="variables_set" id="JmNN.UbH8ldpJSUzeocn">
                                                    <field name="VAR" id="!]2uNISp)(2z[:rRlh[K">Klicks</field>
                                                    <value name="VALUE">
                                                      <block type="math_number" id="6fM}cu|D;$mUnja,5Fr?">
                                                        <field name="NUM">0</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </next>
                                              </block>
                                            </next>
                                          </block>
                                        </statement>
                                        <next>
                                          <block type="comment" id="pymP8RHtohz./*K5Vr5M">
                                            <field name="COMMENT">Ausschalten überspringen wenn schon aus</field>
                                            <next>
                                              <block type="timeouts_settimeout" id="FBl.gAm45o-wu}Ub^W^r">
                                                <field name="NAME">timeout</field>
                                                <field name="DELAY">4</field>
                                                <field name="UNIT">sec</field>
                                                <statement name="STATEMENT">
                                                  <block type="controls_if" id="}4/I$_H]fTOR/FmF]Cx)">
                                                    <mutation else="1"></mutation>
                                                    <value name="IF0">
                                                      <block type="logic_compare" id="6K`%bre.I)Jc#@]=V=)V">
                                                        <field name="OP">EQ</field>
                                                        <value name="A">
                                                          <block type="get_value" id="EnB`x5NI_i?1-e_;=dP/">
                                                            <field name="ATTR">val</field>
                                                            <field name="OID">zigbee2mqtt.0.group_1.state</field>
                                                          </block>
                                                        </value>
                                                        <value name="B">
                                                          <block type="logic_boolean" id="U4r!=;1Dub:b=2S41$S!">
                                                            <field name="BOOL">TRUE</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </value>
                                                    <statement name="DO0">
                                                      <block type="variables_set" id="d]4B~qF#*K+]?$Wo@G52">
                                                        <field name="VAR" id="!]2uNISp)(2z[:rRlh[K">Klicks</field>
                                                        <value name="VALUE">
                                                          <block type="math_number" id="@1gR=FgW}`y]p|/`@?cQ">
                                                            <field name="NUM">0</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </statement>
                                                    <statement name="ELSE">
                                                      <block type="variables_set" id="]$dzxZ/Yl9G:TZT*!:uD">
                                                        <field name="VAR" id="!]2uNISp)(2z[:rRlh[K">Klicks</field>
                                                        <value name="VALUE">
                                                          <block type="math_number" id="1%W/vH`kWcoMO}ho8$bB">
                                                            <field name="NUM">1</field>
                                                          </block>
                                                        </value>
                                                      </block>
                                                    </statement>
                                                  </block>
                                                </statement>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </xml>
                
                1 Reply Last reply Reply Quote 1
                • First post
                  Last post

                Support us

                ioBroker
                Community Adapters
                Donate

                946
                Online

                31.9k
                Users

                80.1k
                Topics

                1.3m
                Posts

                2
                6
                454
                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