Getting something to run for X seconds

Posted on
Thu May 19, 2016 4:22 pm
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Getting something to run for X seconds

I've had this ongoing problem that I'm trying to resolve where I put into a script to turn something on for X seconds and it will work when it's the only thing going but if there happens to be another Indigo command before or after it then it will only run for 1 second and quit.

For example:
Code: Select all
indigo.device.turnOn(controller, duration=10)


When run on it's own with nothing else happening it will run for the 10 seconds and work properly, but if I have another device follow it then it will be somewhat random between 1 and 5 seconds before it quits. The obvious answer is "make this run by itself" or "don't control other devices afterwards" but I have 2-3 of these devices that each need to run for a few seconds at the same time.

I have tried:

Code: Select all
time.sleep(10)


But that doesn't really seem to do anything.

Is there a proper way to insure that a device command gets it's full time span?

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Thu May 19, 2016 5:54 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Getting something to run for X seconds

Use a Timer to count off the delay, with a trigger for Timer Expired that turns off the device.

See http://wiki.indigodomo.com/doku.php?id= ... andpesters

You'll need to create the Timer device before the script runs. Or in it, I supposed.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests