Getting Enable/Disable State of a Schedule

Posted on
Sat Nov 09, 2013 1:48 pm
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Getting Enable/Disable State of a Schedule

My end goal is that I want to get the Enable/Disable state of a given schedule, and then in a control page, present a different icon for each state.

I could not see a way to do it natively with built in logic, and so I looked into using variables, but I can not see a way to obtain the Enable/Disable state of a schedule and pass it to the variable.

Is there a way to get this info and have it display the state or change graphics on a control page?

Thanks,

Chris

Posted on
Mon Nov 11, 2013 5:21 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Getting Enable/Disable State of a Schedule

Here's a Python script suggestion:

Code: Select all
scheduleState = indigo.schedules[scheduleID or "scheduleName"].enabled
then set the variable by:
Code: Select all
indigo.variable.updateValue(indigo.variables.getId("variable_name"), str(scheduleState))
or
Code: Select all
indigo.variable.updateValue(indigo.variables.[variableId], str(scheduleState))


The variable will then be set to True or False depending whether the schedule is enabled or not :)

Posted on
Mon Nov 11, 2013 10:45 am
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Getting Enable/Disable State of a Schedule

autolog wrote:
Here's a Python script suggestion:

Code: Select all
scheduleState = indigo.schedules[scheduleID or "scheduleName"].enabled
then set the variable by:
Code: Select all
indigo.variable.updateValue(indigo.variables.getId("variable_name"), str(scheduleState))
or
Code: Select all
indigo.variable.updateValue(indigo.variables.[variableId], str(scheduleState))


The variable will then be set to True or False depending whether the schedule is enabled or not :)


I appreciate the help with the Python script.

So using your code I have made another schedule that runs the following every 30 seconds, which seems to retrieve and properly update the variable:

Code: Select all
scheduleState = indigo.schedules[917345397].enabled
indigo.variable.updateValue(indigo.variables.getId("garageRollupMonitorIsActive"), str(scheduleState))


On a control page, I figured out how to display the value of a variable in the form of text, so it shows either True or False, but it is text only.

I need a little more help as to how to display 2 different graphics on a control page based on a variable value (like green dot for true, red dot for false). Is this possible? I don't see an obvious way to do this using the Indigo Control Page editor.

Thanks,

Chris

Posted on
Mon Nov 11, 2013 11:00 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Getting Enable/Disable State of a Schedule

sumocomputers wrote:
[... I need a little more help as to how to display 2 different graphics on a control page based on a variable value (like green dot for true, red dot for false). Is this possible? I don't see an obvious way to do this using the Indigo Control Page editor. ...

I haven't tried this myself yet but I think you need to look at the Custom Images on Control Pages wiki article. I think this will enable you to do what you want :)

Posted on
Mon Nov 11, 2013 11:03 am
sumocomputers offline
Posts: 267
Joined: Jun 23, 2008

Re: Getting Enable/Disable State of a Schedule

autolog wrote:
sumocomputers wrote:
[... I need a little more help as to how to display 2 different graphics on a control page based on a variable value (like green dot for true, red dot for false). Is this possible? I don't see an obvious way to do this using the Indigo Control Page editor. ...

I haven't tried this myself yet but I think you need to look at the Custom Images on Control Pages wiki article. I think this will enable you to do what you want :)


Alright, thanks for the article, I will give it a go!

Posted on
Tue Apr 15, 2014 8:57 am
SgtBilko offline
Posts: 45
Joined: Dec 02, 2013

Re: Getting Enable/Disable State of a Schedule

Can a schedule be enabled / disabled from a Python script ? I can't find a way of doing this via introspection.

Thank you

Posted on
Tue Apr 15, 2014 9:53 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Getting Enable/Disable State of a Schedule

SgtBilko wrote:
Can a schedule be enabled / disabled from a Python script ? I can't find a way of doing this via introspection.

Not documented AFAIK but the following seems to work :)

To enable:
Code: Select all
indigo.schedule.enable(deviceId,value=True)

To disable:
Code: Select all
indigo.schedule.enable(deviceId,value=False)

Posted on
Tue Apr 15, 2014 9:55 am
SgtBilko offline
Posts: 45
Joined: Dec 02, 2013

Re: Getting Enable/Disable State of a Schedule

I thought it might be someting like that

Thank you very much, I appreciate your help

Ian

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 9 guests