Skip to content
  • 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
Logo
  1. ioBroker Community Home
  2. English
  3. Scripting / Logic
  4. Blockly
  5. Turn on switch at certain time when other switch turned on

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.1k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.8k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.1k

Turn on switch at certain time when other switch turned on

Scheduled Pinned Locked Moved Blockly
9 Posts 3 Posters 1.7k Views 2 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.
  • S Offline
    S Offline
    sekino
    wrote on last edited by sekino
    #1

    Hi, I want to make script that will turn on SWITCH2 when SWITCH1 is already turned on and is between SUNSET or DUSK and 23:59 or until SUNRISE next day.
    Then turn off SWITCH2 5 minutes later after SWITCH1 is turned off.
    I created this but it's not working:
    switch.png

    AsgothianA 2 Replies Last reply
    0
    • S sekino

      Hi, I want to make script that will turn on SWITCH2 when SWITCH1 is already turned on and is between SUNSET or DUSK and 23:59 or until SUNRISE next day.
      Then turn off SWITCH2 5 minutes later after SWITCH1 is turned off.
      I created this but it's not working:
      switch.png

      AsgothianA Offline
      AsgothianA Offline
      Asgothian
      Developer
      wrote on last edited by Asgothian
      #2

      @sekino
      You need to swap the Trigger / if/else logic

      Build it like this:

      Trigger on switch, has been changed
      Inside the trigger the Block If time is in range use the "write" block to set the state, and add a "timeout 5 minutes - disable switch 2" block.

      If you take a close look at the Blockly system section where the triggers are located, you will find a block which just shows "object id". You can grab that one and use inside the "write" block, since you can change it to "state value", which is the value of the state which fired the trigger.

      I can build a sample blockly when i get home later.
      A.

      ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
      "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

      1 Reply Last reply
      0
      • S sekino

        Hi, I want to make script that will turn on SWITCH2 when SWITCH1 is already turned on and is between SUNSET or DUSK and 23:59 or until SUNRISE next day.
        Then turn off SWITCH2 5 minutes later after SWITCH1 is turned off.
        I created this but it's not working:
        switch.png

        AsgothianA Offline
        AsgothianA Offline
        Asgothian
        Developer
        wrote on last edited by
        #3

        @sekino
        OK.. seems i didn't read all you wanted to do correctly earlier. When trying to build the blockly, i ran into an issue which is unclear in your description:

        What i read from above:

        • If sunset comes AND switch 1 is already on, you want switch 2 to be turned on, and turned off after 5 minutes.
        • If switch 1 is turned on during night time, you want the same to happen ?

        Here is a blockly set which does that:
        Screen Shot 2020-09-03 at 21.39.55 .png

        Code to import behind the spoiler

        <xml xmlns="https://developers.google.com/blockly/xml">
          <variables>
            <variable id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</variable>
            <variable id="gu+_Mq3HBCLql`T,T2FP">Sw2IsOnAtNight</variable>
          </variables>
          <block type="comment" id="`ubXK{/}C4yhsr$oP@6#" x="-612" y="238">
            <field name="COMMENT">Trigger on switch 1</field>
            <next>
              <block type="on" id="~yGu`~m4T4iavoP1^s-G">
                <field name="OID">Object ID</field>
                <field name="CONDITION">gt</field>
                <field name="ACK_CONDITION"></field>
                <statement name="STATEMENT">
                  <block type="controls_if" id="`pWfTrW=#x96R#_?`ux8">
                    <mutation else="1"></mutation>
                    <value name="IF0">
                      <block type="logic_operation" id="BcA;[3StEi.:gIP)k]-c">
                        <field name="OP">OR</field>
                        <value name="A">
                          <block type="time_compare_ex" id="Mhhd5aw_tuKtfXt;!TWi">
                            <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation>
                            <field name="USE_ACTUAL_TIME">TRUE</field>
                            <field name="OPTION">&lt;</field>
                            <value name="START_TIME">
                              <shadow type="text" id="dvCCEVGKGuusC}gtM$R3">
                                <field name="TEXT">12:00</field>
                              </shadow>
                              <block type="time_astro" id=";oy#)ZgB8zl6y^XyNGPU">
                                <field name="TYPE">sunrise</field>
                                <field name="OFFSET">0</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <value name="B">
                          <block type="time_compare_ex" id="XoKL5|C4)W}HrFU/^~`1">
                            <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true" actual_time="true"></mutation>
                            <field name="USE_ACTUAL_TIME">TRUE</field>
                            <field name="OPTION">between</field>
                            <value name="START_TIME">
                              <shadow type="text" id="jk:D]lfai@_ZTxK}|%h8">
                                <field name="TEXT">12:00</field>
                              </shadow>
                              <block type="time_astro" id="vA+{~GPbciV7|/zAiFc^">
                                <field name="TYPE">dusk</field>
                                <field name="OFFSET">0</field>
                              </block>
                            </value>
                            <value name="END_TIME">
                              <shadow type="text" id="8HvVQ?7qV#5YqNOtI2u0">
                                <field name="TEXT">23:59</field>
                              </shadow>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="comment" id="w%H7/XN9s0(,(LFOv|{a">
                        <field name="COMMENT">turn switch 2 on</field>
                        <next>
                          <block type="control" id="6D:j{dSGp`K;rXuf.qoq">
                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                            <field name="OID">Object ID</field>
                            <field name="WITH_DELAY">FALSE</field>
                            <value name="VALUE">
                              <block type="logic_boolean" id="m2t5//Kz~O$^/JBIca3`">
                                <field name="BOOL">TRUE</field>
                              </block>
                            </value>
                          </block>
                        </next>
                      </block>
                    </statement>
                    <statement name="ELSE">
                      <block type="variables_set" id="vS.c4vA*|A*-FMGR:5|E">
                        <field name="VAR" id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</field>
                        <value name="VALUE">
                          <block type="on_source" id="FHghmyvbZfa6vWz/2e*$">
                            <field name="ATTR">state.val</field>
                          </block>
                        </value>
                      </block>
                    </statement>
                  </block>
                </statement>
                <next>
                  <block type="comment" id="yK!gJZa`Y1{mXjdB!~Vz">
                    <field name="COMMENT">Trigger on switch 1</field>
                    <next>
                      <block type="on" id="u96s3Fjhu-mS:PnZY@_:">
                        <field name="OID">Object ID</field>
                        <field name="CONDITION">lt</field>
                        <field name="ACK_CONDITION"></field>
                        <statement name="STATEMENT">
                          <block type="variables_set" id="[dt5Ei;cd+[OOeV]ot66">
                            <field name="VAR" id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</field>
                            <value name="VALUE">
                              <block type="on_source" id="ph|PJ9[f9*t0_f|!7/s7">
                                <field name="ATTR">state.val</field>
                              </block>
                            </value>
                            <next>
                              <block type="controls_if" id="S`sR]mZ.x}n{,6n/hcE6">
                                <value name="IF0">
                                  <block type="variables_get" id="Dst}xp`EVVA(`:(%#g96">
                                    <field name="VAR" id="gu+_Mq3HBCLql`T,T2FP">Sw2IsOnAtNight</field>
                                  </block>
                                </value>
                                <statement name="DO0">
                                  <block type="comment" id="U@RC-lS-[Z:!dx_{J](Z">
                                    <field name="COMMENT">turn switch 2 off</field>
                                    <next>
                                      <block type="control" id="WD~POu@?;-h=taTZu8rj">
                                        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                        <field name="OID">Object ID</field>
                                        <field name="WITH_DELAY">TRUE</field>
                                        <field name="DELAY_MS">5</field>
                                        <field name="UNIT">min</field>
                                        <field name="CLEAR_RUNNING">TRUE</field>
                                        <value name="VALUE">
                                          <block type="logic_boolean" id="U$X6cTnb6IOc@#@[F6sq">
                                            <field name="BOOL">FALSE</field>
                                          </block>
                                        </value>
                                      </block>
                                    </next>
                                  </block>
                                </statement>
                              </block>
                            </next>
                          </block>
                        </statement>
                        <next>
                          <block type="comment" id="pUv[FY5CZRZskW((/_{S">
                            <field name="COMMENT">Trigger on switch 1</field>
                            <next>
                              <block type="on" id="5Fc[9hiWqSVUiO{Ujx0$">
                                <field name="OID">Object ID</field>
                                <field name="CONDITION">ne</field>
                                <field name="ACK_CONDITION"></field>
                                <statement name="STATEMENT">
                                  <block type="variables_set" id="y^u:v,09bwMC;B5j3_Y#">
                                    <field name="VAR" id="gu+_Mq3HBCLql`T,T2FP">Sw2IsOnAtNight</field>
                                    <value name="VALUE">
                                      <block type="on_source" id="49{yMXapE}A)^dVBX.gR">
                                        <field name="ATTR">state.val</field>
                                      </block>
                                    </value>
                                  </block>
                                </statement>
                                <next>
                                  <block type="comment" id="J(^TL]9aCFhx^K2@dCQ[">
                                    <field name="COMMENT">Fix switch 2 at sunset</field>
                                    <next>
                                      <block type="astro" id="l}tX?IzdXYN~a(JW}%.e">
                                        <field name="TYPE">sunset</field>
                                        <field name="OFFSET">0</field>
                                        <statement name="STATEMENT">
                                          <block type="controls_if" id="Hn:ug~:o$xcB4.:`Ewb]">
                                            <value name="IF0">
                                              <block type="variables_get" id="/5}J.tDB0~AeD^Z8-pDt">
                                                <field name="VAR" id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</field>
                                              </block>
                                            </value>
                                            <statement name="DO0">
                                              <block type="comment" id="k%iPli4lT?zAO~K2.n15">
                                                <field name="COMMENT">turn switch 2 on</field>
                                                <next>
                                                  <block type="control" id=":%4U`;(=^;#(A#}q]7Nd">
                                                    <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                    <field name="OID">Object ID</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                    <value name="VALUE">
                                                      <block type="logic_boolean" id="M]j4Z[mHt_dk}Or2RSE`">
                                                        <field name="BOOL">TRUE</field>
                                                      </block>
                                                    </value>
                                                  </block>
                                                </next>
                                              </block>
                                            </statement>
                                          </block>
                                        </statement>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </xml>
        

        ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
        "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

        S 1 Reply Last reply
        0
        • AsgothianA Asgothian

          @sekino
          OK.. seems i didn't read all you wanted to do correctly earlier. When trying to build the blockly, i ran into an issue which is unclear in your description:

          What i read from above:

          • If sunset comes AND switch 1 is already on, you want switch 2 to be turned on, and turned off after 5 minutes.
          • If switch 1 is turned on during night time, you want the same to happen ?

          Here is a blockly set which does that:
          Screen Shot 2020-09-03 at 21.39.55 .png

          Code to import behind the spoiler

          <xml xmlns="https://developers.google.com/blockly/xml">
            <variables>
              <variable id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</variable>
              <variable id="gu+_Mq3HBCLql`T,T2FP">Sw2IsOnAtNight</variable>
            </variables>
            <block type="comment" id="`ubXK{/}C4yhsr$oP@6#" x="-612" y="238">
              <field name="COMMENT">Trigger on switch 1</field>
              <next>
                <block type="on" id="~yGu`~m4T4iavoP1^s-G">
                  <field name="OID">Object ID</field>
                  <field name="CONDITION">gt</field>
                  <field name="ACK_CONDITION"></field>
                  <statement name="STATEMENT">
                    <block type="controls_if" id="`pWfTrW=#x96R#_?`ux8">
                      <mutation else="1"></mutation>
                      <value name="IF0">
                        <block type="logic_operation" id="BcA;[3StEi.:gIP)k]-c">
                          <field name="OP">OR</field>
                          <value name="A">
                            <block type="time_compare_ex" id="Mhhd5aw_tuKtfXt;!TWi">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation>
                              <field name="USE_ACTUAL_TIME">TRUE</field>
                              <field name="OPTION">&lt;</field>
                              <value name="START_TIME">
                                <shadow type="text" id="dvCCEVGKGuusC}gtM$R3">
                                  <field name="TEXT">12:00</field>
                                </shadow>
                                <block type="time_astro" id=";oy#)ZgB8zl6y^XyNGPU">
                                  <field name="TYPE">sunrise</field>
                                  <field name="OFFSET">0</field>
                                </block>
                              </value>
                            </block>
                          </value>
                          <value name="B">
                            <block type="time_compare_ex" id="XoKL5|C4)W}HrFU/^~`1">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true" actual_time="true"></mutation>
                              <field name="USE_ACTUAL_TIME">TRUE</field>
                              <field name="OPTION">between</field>
                              <value name="START_TIME">
                                <shadow type="text" id="jk:D]lfai@_ZTxK}|%h8">
                                  <field name="TEXT">12:00</field>
                                </shadow>
                                <block type="time_astro" id="vA+{~GPbciV7|/zAiFc^">
                                  <field name="TYPE">dusk</field>
                                  <field name="OFFSET">0</field>
                                </block>
                              </value>
                              <value name="END_TIME">
                                <shadow type="text" id="8HvVQ?7qV#5YqNOtI2u0">
                                  <field name="TEXT">23:59</field>
                                </shadow>
                              </value>
                            </block>
                          </value>
                        </block>
                      </value>
                      <statement name="DO0">
                        <block type="comment" id="w%H7/XN9s0(,(LFOv|{a">
                          <field name="COMMENT">turn switch 2 on</field>
                          <next>
                            <block type="control" id="6D:j{dSGp`K;rXuf.qoq">
                              <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                              <field name="OID">Object ID</field>
                              <field name="WITH_DELAY">FALSE</field>
                              <value name="VALUE">
                                <block type="logic_boolean" id="m2t5//Kz~O$^/JBIca3`">
                                  <field name="BOOL">TRUE</field>
                                </block>
                              </value>
                            </block>
                          </next>
                        </block>
                      </statement>
                      <statement name="ELSE">
                        <block type="variables_set" id="vS.c4vA*|A*-FMGR:5|E">
                          <field name="VAR" id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</field>
                          <value name="VALUE">
                            <block type="on_source" id="FHghmyvbZfa6vWz/2e*$">
                              <field name="ATTR">state.val</field>
                            </block>
                          </value>
                        </block>
                      </statement>
                    </block>
                  </statement>
                  <next>
                    <block type="comment" id="yK!gJZa`Y1{mXjdB!~Vz">
                      <field name="COMMENT">Trigger on switch 1</field>
                      <next>
                        <block type="on" id="u96s3Fjhu-mS:PnZY@_:">
                          <field name="OID">Object ID</field>
                          <field name="CONDITION">lt</field>
                          <field name="ACK_CONDITION"></field>
                          <statement name="STATEMENT">
                            <block type="variables_set" id="[dt5Ei;cd+[OOeV]ot66">
                              <field name="VAR" id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</field>
                              <value name="VALUE">
                                <block type="on_source" id="ph|PJ9[f9*t0_f|!7/s7">
                                  <field name="ATTR">state.val</field>
                                </block>
                              </value>
                              <next>
                                <block type="controls_if" id="S`sR]mZ.x}n{,6n/hcE6">
                                  <value name="IF0">
                                    <block type="variables_get" id="Dst}xp`EVVA(`:(%#g96">
                                      <field name="VAR" id="gu+_Mq3HBCLql`T,T2FP">Sw2IsOnAtNight</field>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="comment" id="U@RC-lS-[Z:!dx_{J](Z">
                                      <field name="COMMENT">turn switch 2 off</field>
                                      <next>
                                        <block type="control" id="WD~POu@?;-h=taTZu8rj">
                                          <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                                          <field name="OID">Object ID</field>
                                          <field name="WITH_DELAY">TRUE</field>
                                          <field name="DELAY_MS">5</field>
                                          <field name="UNIT">min</field>
                                          <field name="CLEAR_RUNNING">TRUE</field>
                                          <value name="VALUE">
                                            <block type="logic_boolean" id="U$X6cTnb6IOc@#@[F6sq">
                                              <field name="BOOL">FALSE</field>
                                            </block>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </statement>
                          <next>
                            <block type="comment" id="pUv[FY5CZRZskW((/_{S">
                              <field name="COMMENT">Trigger on switch 1</field>
                              <next>
                                <block type="on" id="5Fc[9hiWqSVUiO{Ujx0$">
                                  <field name="OID">Object ID</field>
                                  <field name="CONDITION">ne</field>
                                  <field name="ACK_CONDITION"></field>
                                  <statement name="STATEMENT">
                                    <block type="variables_set" id="y^u:v,09bwMC;B5j3_Y#">
                                      <field name="VAR" id="gu+_Mq3HBCLql`T,T2FP">Sw2IsOnAtNight</field>
                                      <value name="VALUE">
                                        <block type="on_source" id="49{yMXapE}A)^dVBX.gR">
                                          <field name="ATTR">state.val</field>
                                        </block>
                                      </value>
                                    </block>
                                  </statement>
                                  <next>
                                    <block type="comment" id="J(^TL]9aCFhx^K2@dCQ[">
                                      <field name="COMMENT">Fix switch 2 at sunset</field>
                                      <next>
                                        <block type="astro" id="l}tX?IzdXYN~a(JW}%.e">
                                          <field name="TYPE">sunset</field>
                                          <field name="OFFSET">0</field>
                                          <statement name="STATEMENT">
                                            <block type="controls_if" id="Hn:ug~:o$xcB4.:`Ewb]">
                                              <value name="IF0">
                                                <block type="variables_get" id="/5}J.tDB0~AeD^Z8-pDt">
                                                  <field name="VAR" id="e.dW%KumhN7|TQ#:?l@l">Sw1IsOn</field>
                                                </block>
                                              </value>
                                              <statement name="DO0">
                                                <block type="comment" id="k%iPli4lT?zAO~K2.n15">
                                                  <field name="COMMENT">turn switch 2 on</field>
                                                  <next>
                                                    <block type="control" id=":%4U`;(=^;#(A#}q]7Nd">
                                                      <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                      <field name="OID">Object ID</field>
                                                      <field name="WITH_DELAY">FALSE</field>
                                                      <value name="VALUE">
                                                        <block type="logic_boolean" id="M]j4Z[mHt_dk}Or2RSE`">
                                                          <field name="BOOL">TRUE</field>
                                                        </block>
                                                      </value>
                                                    </block>
                                                  </next>
                                                </block>
                                              </statement>
                                            </block>
                                          </statement>
                                        </block>
                                      </next>
                                    </block>
                                  </next>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </next>
                    </block>
                  </next>
                </block>
              </next>
            </block>
          </xml>
          

          S Offline
          S Offline
          sekino
          wrote on last edited by
          #4

          @Asgothian I will make it in points:

          • If sunset comes AND switch 1 is already on, I want switch 2 to be turned on
          • If switch 1 is turned on during night time, I want the same to happen (immediatelly)
          • turn off SWITCH2 > 5 minutes later after SWITCH1 is turned off.
          AsgothianA 1 Reply Last reply
          0
          • S sekino

            @Asgothian I will make it in points:

            • If sunset comes AND switch 1 is already on, I want switch 2 to be turned on
            • If switch 1 is turned on during night time, I want the same to happen (immediatelly)
            • turn off SWITCH2 > 5 minutes later after SWITCH1 is turned off.
            AsgothianA Offline
            AsgothianA Offline
            Asgothian
            Developer
            wrote on last edited by
            #5

            @sekino The script is already in the post above. It should do just that.

            A.

            ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
            "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

            S 1 Reply Last reply
            0
            • AsgothianA Asgothian

              @sekino The script is already in the post above. It should do just that.

              A.

              S Offline
              S Offline
              sekino
              wrote on last edited by
              #6

              @Asgothian I will try and let you know if works, for now I would like to ask what logic is behind : ObjectID is greater/less than last ... if values are true or false ???

              should I keep variables Sw1IsOn and Sw1IsOnAtNight ? Or should I changed them for states of my Sw1?

              HomoranH AsgothianA 2 Replies Last reply
              0
              • S sekino

                @Asgothian I will try and let you know if works, for now I would like to ask what logic is behind : ObjectID is greater/less than last ... if values are true or false ???

                should I keep variables Sw1IsOn and Sw1IsOnAtNight ? Or should I changed them for states of my Sw1?

                HomoranH Do not disturb
                HomoranH Do not disturb
                Homoran
                Global Moderator Administrators
                wrote on last edited by
                #7

                @sekino sagte in Turn on switch at certain time when other switch turned on:

                Or should I changed them for states of my Sw1?

                no, You should online exchange objectID with your states

                kein Support per PN! - Fragen im Forum stellen - es gibt fast nichts, was nicht auch für andere interessant ist.

                Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.

                der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

                1 Reply Last reply
                0
                • S sekino

                  @Asgothian I will try and let you know if works, for now I would like to ask what logic is behind : ObjectID is greater/less than last ... if values are true or false ???

                  should I keep variables Sw1IsOn and Sw1IsOnAtNight ? Or should I changed them for states of my Sw1?

                  AsgothianA Offline
                  AsgothianA Offline
                  Asgothian
                  Developer
                  wrote on last edited by
                  #8

                  @sekino sagte in Turn on switch at certain time when other switch turned on:

                  @Asgothian I will try and let you know if works, for now I would like to ask what logic is behind : ObjectID is greater/less than last ... if values are true or false ???

                  should I keep variables Sw1IsOn and Sw1IsOnAtNight ? Or should I changed them for states of my Sw1?

                  as @Homoran said - only replace the object id's.

                  Triggering for greater than and lesser than enables you to not have to check true or false value later.

                  In JS, true > false, so a trigger on "greater than before" will only activate when the object value changes from false to true.

                  A.

                  ioBroker auf RPi4 - Hardware soweit wie möglich via Zigbee.
                  "Shit don't work" ist keine Fehlermeldung, sondern ein Fluch.

                  S 1 Reply Last reply
                  0
                  • AsgothianA Asgothian

                    @sekino sagte in Turn on switch at certain time when other switch turned on:

                    @Asgothian I will try and let you know if works, for now I would like to ask what logic is behind : ObjectID is greater/less than last ... if values are true or false ???

                    should I keep variables Sw1IsOn and Sw1IsOnAtNight ? Or should I changed them for states of my Sw1?

                    as @Homoran said - only replace the object id's.

                    Triggering for greater than and lesser than enables you to not have to check true or false value later.

                    In JS, true > false, so a trigger on "greater than before" will only activate when the object value changes from false to true.

                    A.

                    S Offline
                    S Offline
                    sekino
                    wrote on last edited by
                    #9

                    @Asgothian @Homoran Thank you all! Working great!

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


                    Support us

                    ioBroker
                    Community Adapters
                    Donate

                    770

                    Online

                    32.4k

                    Users

                    81.4k

                    Topics

                    1.3m

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

                    • Don't have an account? Register

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