Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Blockly unnötige Steuerung wie lösen?

    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

    Blockly unnötige Steuerung wie lösen?

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

      In meinem Blockly steuere ich mit 3 BWM mein Kellerlicht.
      Das Blockly funktioniert soweit , nur wird bei jedem mal wahr
      der Block "steuere Brightness mit 100" immer wieder ausgeführt obwohl eh schon auf 100.
      Wie kann man das schön lösen und Steuer Befehle einsparen?

      Danke LG Thomas
      blokly.png

      <xml xmlns="https://developers.google.com/blockly/xml">
        <variables>
          <variable type="timeout" id="timeout2">timeout2</variable>
          <variable type="timeout" id="timeout3">timeout3</variable>
        </variables>
        <block type="comment" id="a;4E{*dk:]raf}1GK:oC" x="38" y="-562">
          <field name="COMMENT">BWM 1 und 2 und 3 am Kellerabgang schaltet Gruppe in Zigbee2mqtttt</field>
          <next>
            <block type="on_ext" id="6NTf}*4Hs@H?k/54~dHi">
              <mutation xmlns="http://www.w3.org/1999/xhtml" items="3"></mutation>
              <field name="CONDITION">ne</field>
              <field name="ACK_CONDITION"></field>
              <value name="OID0">
                <shadow type="field_oid" id="eIwD5nRX(N$RuC,J1uKe">
                  <field name="oid">zigbee2mqtt.0.0x00158d0008f11336.occupancy</field>
                </shadow>
              </value>
              <value name="OID1">
                <shadow type="field_oid" id=".,b50y=^Z^X,#iPP9XI1">
                  <field name="oid">zigbee2mqtt.0.0x00158d0008d9195e.occupancy</field>
                </shadow>
              </value>
              <value name="OID2">
                <shadow type="field_oid" id="RvLxvwPtZFz~hQ[$wUgM">
                  <field name="oid">zigbee2mqtt.0.0xa4c1382e5d2ff601.occupancy</field>
                </shadow>
              </value>
              <statement name="STATEMENT">
                <block type="controls_if" id="i6lv|%TLZaltMR@P/Q!Z">
                  <mutation elseif="1"></mutation>
                  <value name="IF0">
                    <block type="logic_operation" id="M:xQdbhe*,yzGM,Gm,z." inline="false">
                      <field name="OP">OR</field>
                      <value name="A">
                        <block type="logic_compare" id="U[*%P+/)BvVg.{-cRyGH">
                          <field name="OP">EQ</field>
                          <value name="A">
                            <block type="get_value" id="BJ(j7?;/kA~6rEy=|dkJ">
                              <field name="ATTR">val</field>
                              <field name="OID">zigbee2mqtt.0.0x00158d0008f11336.occupancy</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_boolean" id="9%geI{n+~Xd7T6%HAW[L">
                              <field name="BOOL">TRUE</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <value name="B">
                        <block type="logic_operation" id="UAhbdHGUCbKKn?G=I0ab" inline="false">
                          <field name="OP">OR</field>
                          <value name="A">
                            <block type="logic_compare" id="}mo^tTy+|@Tl%T5-1;d5">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="=o[6`YJt2VX``#mw(~VB">
                                  <field name="ATTR">val</field>
                                  <field name="OID">zigbee2mqtt.0.0x00158d0008d9195e.occupancy</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="mDe~ellX*:$%Q^NBF)bN">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_compare" id="~h$}jSLIP6}.NFPm_d`,">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="_Y%Q0o*SCHOr4Z9__a_R">
                                  <field name="ATTR">val</field>
                                  <field name="OID">zigbee2mqtt.0.0xa4c1382e5d2ff601.occupancy</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="sSym*aP338bTY/#@[jyn">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </value>
                  <statement name="DO0">
                    <block type="timeouts_cleartimeout" id="4rKh8(mY;Q_88{m_F(qP">
                      <field name="NAME">timeout2</field>
                      <next>
                        <block type="timeouts_cleartimeout" id="2^|Pgwbdl1)GVYu%TGDX">
                          <field name="NAME">timeout3</field>
                          <next>
                            <block type="control" id="v%$[jBEi/`P(;I~rsc^)">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">zigbee2mqtt.0.group_2.brightness</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="math_number" id="V|E,e~rCGj2E0)f8UZM1">
                                  <field name="NUM">100</field>
                                </block>
                              </value>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </statement>
                  <value name="IF1">
                    <block type="logic_operation" id="{Ev6=boS]pkCMNh2Eo*r" inline="false">
                      <field name="OP">AND</field>
                      <value name="A">
                        <block type="logic_compare" id="-:71$@UQ!R!G$R)7+u4,">
                          <field name="OP">EQ</field>
                          <value name="A">
                            <block type="get_value" id="W}gB;F`sQD|pbZR;=c/g">
                              <field name="ATTR">val</field>
                              <field name="OID">zigbee2mqtt.0.0x00158d0008f11336.occupancy</field>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_boolean" id="RR-tvQ|18yCnOa6px]n{">
                              <field name="BOOL">FALSE</field>
                            </block>
                          </value>
                        </block>
                      </value>
                      <value name="B">
                        <block type="logic_operation" id="gI6(6CqwKBw46y7f9:M(" inline="false">
                          <field name="OP">AND</field>
                          <value name="A">
                            <block type="logic_compare" id="!%QFhWOT0,ezYAlm?W5Y">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="v8UPSTq2iX1m7lJuVq=4">
                                  <field name="ATTR">val</field>
                                  <field name="OID">zigbee2mqtt.0.0x00158d0008d9195e.occupancy</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="?baQ6C2+i`gG:L}}p{px">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="logic_compare" id="VoT)O#[2|8E6B;ivqW:D">
                              <field name="OP">EQ</field>
                              <value name="A">
                                <block type="get_value" id="3}_#K*vf:oM@+16_L@Yh">
                                  <field name="ATTR">val</field>
                                  <field name="OID">zigbee2mqtt.0.0xa4c1382e5d2ff601.occupancy</field>
                                </block>
                              </value>
                              <value name="B">
                                <block type="logic_boolean" id="+C{#hnP3T/B}6`;Pkiu(">
                                  <field name="BOOL">FALSE</field>
                                </block>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                    </block>
                  </value>
                  <statement name="DO1">
                    <block type="timeouts_cleartimeout" id="z0j0JlAZ`MO*8H;qm8CL">
                      <field name="NAME">timeout2</field>
                      <next>
                        <block type="timeouts_cleartimeout" id="|eqm6V;gq0/h7-M^=q/v">
                          <field name="NAME">timeout3</field>
                          <next>
                            <block type="comment" id="dB)lP2oEri|Qrf/O4jiG">
                              <field name="COMMENT">Nach 20 Sekunden 50% Brightness</field>
                              <next>
                                <block type="timeouts_settimeout" id="^rA;}G.RQGj$wah~6t$F">
                                  <field name="NAME">timeout2</field>
                                  <field name="DELAY">20</field>
                                  <field name="UNIT">sec</field>
                                  <statement name="STATEMENT">
                                    <block type="control" id="YE1m(S6HS%tUdRp|P3jc">
                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                      <field name="OID">zigbee2mqtt.0.group_2.brightness</field>
                                      <field name="WITH_DELAY">FALSE</field>
                                      <value name="VALUE">
                                        <block type="math_number" id="NLaBY|LX*s{_]X2*)F1W">
                                          <field name="NUM">25</field>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="comment" id="TyGElbkcOe?92|/!gkDA">
                                          <field name="COMMENT">Nach 50 Sekunden 0% Brightness sprich Licht aus</field>
                                          <next>
                                            <block type="timeouts_settimeout" id="0}(3}t4y=BB1U,Em;Bh)">
                                              <field name="NAME">timeout3</field>
                                              <field name="DELAY">20</field>
                                              <field name="UNIT">sec</field>
                                              <statement name="STATEMENT">
                                                <block type="control" id="{3/Nni!,/xR.L6_??ig[">
                                                  <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                  <field name="OID">zigbee2mqtt.0.group_2.brightness</field>
                                                  <field name="WITH_DELAY">FALSE</field>
                                                  <value name="VALUE">
                                                    <block type="math_number" id="so:A@$lw2FwU}b)B!/#]">
                                                      <field name="NUM">0</field>
                                                    </block>
                                                  </value>
                                                </block>
                                              </statement>
                                            </block>
                                          </next>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </statement>
                </block>
              </statement>
            </block>
          </next>
        </block>
      </xml>
      
      DJMarc75 paul53 Zamecnik Jindrich 3 Replies Last reply Reply Quote 0
      • DJMarc75
        DJMarc75 @mrfloppy last edited by

        @mrfloppy bitte einen Screenshot vom Blockly zusätzlich zeigen

        1 Reply Last reply Reply Quote 0
        • paul53
          paul53 @mrfloppy last edited by

          @mrfloppy sagte: "steuere Brightness mit 100" immer wieder ausgeführt obwohl eh schon auf 100.

          Blockly_temp.JPG

          Dr. Bakterius 1 Reply Last reply Reply Quote 0
          • Zamecnik Jindrich
            Zamecnik Jindrich @mrfloppy last edited by

            @mrfloppy Here are some ways to avoid unnecessary repeated brightness controls in Blockly when controlling a light:

            1. Use a variable to store the current brightness value. Check if the requested value differs from the variable before setting brightness. For example:
            if (brightness != requestedValue) {
              set brightness to requestedValue
              set brightnessVariable to requestedValue
            }
            
            1. Use events/callbacks so brightness is only set when an explicit change is made rather than constantly checking. For example, have a "when brightness clicked" event trigger the set brightness block.

            2. Use a timer to limit how often the brightness check runs to avoid spamming updates.

            3. Only update brightness when other state changes occur - for example when a light is turned on/off, reset the brightness afterwards.

            4. Create a brightnessChange() custom function that gets called instead of directly setting brightness. Have this function implement the checking logic to prevent unnecessary duplicates.

            The key ideas are using variables, events, or cooldowns to determine if brightness needs changing rather than directly setting it continuously. This will help optimize unnecessary commands.

            1 Reply Last reply Reply Quote 0
            • Dr. Bakterius
              Dr. Bakterius Most Active @paul53 last edited by

              @paul53 Da reicht doch auch einmal auf Wert prüfen. Der wird immer wahr egal welcher Trigger ausgelöst hat. Oder übersehe ich da etwas?

              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @Dr. Bakterius last edited by paul53

                @dr-bakterius sagte: Da reicht doch auch einmal auf Wert prüfen.

                Nein, man benötigt eine Oder-Verknüpfung der Werte. Sonst kann es passieren, dass zwei BWM auf false gehen und dadurch mehrere Timer laufen, die sich nicht mehr stoppen lassen.
                Außerdem ist immer noch Bewegung, wenn erst zwei BWM Bewegung melden und dann nur noch ein BWM.

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

                Support us

                ioBroker
                Community Adapters
                Donate

                970
                Online

                31.7k
                Users

                79.9k
                Topics

                1.3m
                Posts

                5
                6
                325
                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