Ankündigung

Einklappen
Keine Ankündigung bisher.

Working with timers?

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Working with timers?

    Hello peoples...
    I'm a bit confused about how to Work with timers in SH.py.

    eg if i want a Motion detector to turn on a light for 5 min and reset every time the detector input goes high - and if no activity within 5 minutes - turn the light off...

    Could i use the timer function, and do something like:

    IF Motion1 == True:
    Light1 = 100%
    Timer(5m,0%)

    So when the Motion becomes true, set light to 100% and set a timer to set it to 0%?

    Could some one please give a short code sample of how to do that? I'm planning to create different timers in the same logic file

    Thanks

    #2
    Hi,

    go to the documentation and look for autotimer.

    so long

    Marcus

    Kommentar


      #3
      Hi.

      Yes i've already did that...
      "
      autotimer(time, value)

      Set a timer to run at every item change. Specify the time (in seconds), or use m to specify minutes. e.g. autotimer(‘10m’, 42) to set the item after 10 minutes to 42. If you call autotimer() without a timer or value, the functionality will be disabled.
      timer(time, value)

      Same as autotimer, excepts it runs only once."

      But the autotimer runs on every change, what if i only want the action to be executed every time the item goes == 1

      Wouldn't then be the normal timer to use, and just create a logic saying when item ==1 starts the timer? and set the logic to monitor that input?

      Kommentar


        #4
        Hi,

        yes you could do that.

        so long

        Marcus

        Kommentar


          #5
          Nice....

          What if i then want the timer to be resat every time the input goes high? So it's kind of a timeout when no activity through a Motion sensor is active?

          Greetings

          Kommentar

          Lädt...
          X