Home AMX User Forum AMX Technical Discussion

Sleep Timer

Has anyone ever added a sleep timer function to an netlinx file?


How is this done?

Any examples would be appreciated as well!

Comments

  • BinuBinu Posts: 49
    sleep timer

    use time lines
  • Reese JacobsReese Jacobs Posts: 347
    Sleep Timer

    Hi Burkie,

    Can you elaborate on what you mean by a sleep timer? Are you trying to implement an inactivity timeout (sleep) for a device or do you have something else in mind. Provide some details on exactly what you want to accomplish and what you mean by a sleep timer (how you want to use it) and I am sure you will get some posts with ideas/hints.

    Reese
  • DHawthorneDHawthorne Posts: 4,584
    I had a customer who wanted her bedroom TV to shut off after a certain amount of time if she happened to fall asleep if it was on (which entirely baffled me, since the TV was a Runco projector over the bed with a motorized screen - I have no idea how the screen retracting doesn't wake her up).

    I implemented it by using a one minute interval repeating timeline. When she presses her "sleep" button, the timeline is created, and a variable is set to an amount representing an hour. The timeline event decrements this timeout variable each minute until it reaches zero, then shuts down the system and kills the timeline. If the button is pressed at any time while the timeline is still running, it increments the running time to the closest 15 minute interval (if there are 10 minutes left, it jumps to 15; if there is an hour, it jumps to 1 hour, 15 min.), so she can keep it on longer than the default hour if she likes. If she holds the button for 10 seconds, the whole thing is canceled. I used a variable text field on the button itself that is updated when the timeout variable is to show how much longer the timer will run.

    You could just as easily make this a one-time timeline and dyamically change the intervals as needed and reset the timeline to adjust the timeout. I liked my approach better because I could use my timeout variable not only to track the status of the timeout period, but to send my button feedback showing time left.
Sign In or Register to comment.