Need Script to Add Variable State of a Schedule?

Posted on
Wed Jan 11, 2017 2:12 am
thomasw offline
Posts: 135
Joined: Feb 13, 2011

Need Script to Add Variable State of a Schedule?

Hi All,
I need a simple script to check whether a specific Schedule is enabled or disabled in Indigo, and then put that in a variable as On or Off or True or False.
I created the Schedule named "Test", and when it is enabled, it turns an ApplianceLinc on every hour for 10 min, then it auto shuts it off. Works good.
I need to see in the Variable list whether or not this "Test" Schedule is enabled or not when I am using Indigo Touch on the iphone remotely.
(I can see if the actual ApplianceLinc is on or off in Device State, but that's not what I need to check. I need to see if the actual Schedule is enabled or disabled in the Variable List.
How do I write a simple script that just checks the "Test" Schedule in Indigo, and puts ON if it is enabled, and OFF if it is disabled, in the Variable List?
I couldn't find anyone else that was checking a Schedule's state of enabled or disabled, and reporting it in the Variable List?
-Thanks

Posted on
Wed Jan 11, 2017 6:57 am
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Need Script to Add Variable State of a Schedule?

thomasw wrote:
Hi All,
I need a simple script to check whether a specific Schedule is enabled or disabled in Indigo, and then put that in a variable as On or Off or True or False.

I think this will do what you want:

Code: Select all
schedule = indigo.schedules[1839643083]

if schedule.enabled:
    indigo.variable.updateValue(1961258112, 'On')
else:
    indigo.variable.updateValue(1961258112, 'Off')

You'll need to replace the schedule ID and variable ID for your setup.

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Wed Jan 11, 2017 11:20 am
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Need Script to Add Variable State of a Schedule?

Another approach would be to use a 10 minute timer device to turn off the coffee maker rather than an auto-off - then you can just inspect the states of the timer. No scripting required.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Jan 11, 2017 3:04 pm
thomasw offline
Posts: 135
Joined: Feb 13, 2011

Re: Need Script to Add Variable State of a Schedule?-SOLVED

Hi Dave & Jay,

Thank you for the script Dave, it works great! This does exactly what I need.

Jay, I never knew about the "timers" in Indigo. That will be something I can use for another project in the future.
For this situation, I have to go with Dave's Script. The details are too much to go into here.

Thanks again,
-Tom

Posted on
Wed Jan 11, 2017 4:39 pm
DaveL17 offline
User avatar
Posts: 6751
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Need Script to Add Variable State of a Schedule?-SOLVED

thomasw wrote:
Hi Dave & Jay,

Thank you for the script Dave, it works great! This does exactly what I need.

Jay, I never knew about the "timers" in Indigo. That will be something I can use for another project in the future.
For this situation, I have to go with Dave's Script. The details are too much to go into here.

Thanks again,
-Tom

Glad that it worked for you.

Cheers!
Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron