Page 1 of 1

Regular schedule vs holiday schedule

PostPosted: Tue Oct 01, 2019 7:53 pm
by rgspb
I'm not real sure if i'm posting this in the correct forum but we'll see. I have a set of outside lights that come on at "Evening" 100%. At "Bedtime" they dim to 30% and then turn off completely later in the morning. For Halloween I'm putting some flicker flame LEDs in these fixtures. Since these bulbs aren't dimmable I want to skip the dimming at "Bedtime" and just turn them off completely. I'm just not sure what is the best way to set up a temporary schedule for these lights without completely changing my "Evening" and "Bedtime" action groups.

Re: Regular schedule vs holiday schedule

PostPosted: Wed Oct 02, 2019 9:01 am
by Dual
I think you can disable your normal
Schedule on the 31st and enable it on the 1st. There should be a checkbox IIRC.


Sent from my iPhone using Tapatalk

Re: Regular schedule vs holiday schedule

PostPosted: Fri Oct 04, 2019 9:59 am
by rgspb
I think really what I'm looking to do is have a Condition attached to an item in an action group:

Turn light off if variable = Holiday
Brighten light to 30% if variable = Not Holiday

For now I'm just going to change that item in the list back and forth manually

Re: Regular schedule vs holiday schedule

PostPosted: Fri Oct 04, 2019 10:09 am
by FlyingDiver
Have this script running every night at 12:01am:

Code: Select all
# indigo.variables[1980497029] # "isHoliday"
# indigo.variables[1479852422] # "whatHoliday"

from datetime import date
import holidays

indigo.variable.updateValue(1980497029, value="False")
indigo.variable.updateValue(1479852422, value="None")

us_holidays = holidays.UnitedStates()  # or holidays.US()

if date.today() in us_holidays:
   indigo.variable.updateValue(1980497029, value="True")
   indigo.variable.updateValue(1479852422, us_holidays.get(date.today()))


That updates two Indigo variables - isHoliday (boolean) and whatHoliday (string).

Very useful.

I'm not sure if the holidays library is installed by default. You might need to use pip to install it.

Re: Regular schedule vs holiday schedule

PostPosted: Fri Nov 25, 2022 10:58 am
by whmoorejr
I'm trolling the forum today looking for a better answer.... but this is how I'm doing it....
I have 6 nightly schedules.
(Reset the variables)
11:58 PM - set "SchoolDayToday" to true
11:58 PM - set "SchoolDayTomorrow" to true

(Set the variables)
12:01 S-----S: set "SchoolDayToday" to false
12:01 -----FS: set "SchoolDayTomorrow" to false

(Set the holidays from school calendar)
12:04 PM - if any "conditions list" : set "SchoolDayToday" to false
12:05 PM - if any "conditions list" : set "SchoolDayTomorrow" to false

From this point, any trigger that I want to operate differently on a school day versus a non-school day can use the above variable "SchoolDayToday" or "SchoolDayTomorrow" as a variable. This works well for morning alarm routines and stuff that monitor screen time usage, etc.

Another option for your case is to have a virtual button "Halloween Flicker Bypass Button" that bypasses your 30% dim trigger.
Add the condition to your bedtime trigger -> Bedtime: if Halloween Flicker Bypass Button" is off, then dim light to 30%
Create new trigger -> Bedtime: if Halloween Flicker Bypass Button" is on, then turn off light.

This is what my school calendar "conditions" look like, which I need to update every summer when the new schedule comes out.

Re: Regular schedule vs holiday schedule

PostPosted: Mon Nov 28, 2022 5:55 pm
by ryanbuckner
I do something similar to what Bill and @FlyingDiver do.

Variable 1939762834 contains a comma separated list of all the school holidays (days that school is closed in my County). A schedule runs at 12:01AM to run the following. Then I use the isSchoolClosed condition everywhere needed. For example, I don't need to turn off the lights and appliances in my kids' rooms at 10AM when school is closed, because they are probably using them (or still sleeping).

Code: Select all
from datetime import date

# contains a list of all the school holidays
holiday_list = indigo.variables[1939762834].value

today = date.today().strftime('%Y-%m-%d')
a = today in holiday_list

indigo.variable.updateValue(27794980, value=str(a)) # "isSchoolClosed"

Re: Regular schedule vs holiday schedule

PostPosted: Mon Nov 28, 2022 8:23 pm
by GlennNZ
Along similar lines, there is a very simple python library holidays.

https://github.com/dr-prodigy/python-holidays

If you pip3 install, then can run scripts checking whether currently a public holiday in your location.

import holidays
us_holidays = holidays.US()
date(2014, 1, 1) in us_holidays
True

I use this to NOT turn on alarms in this case.

Worked flawlessly! (until python3 change, fixed by re-pip installing!)

Glenn


Sent from my iPad using Tapatalk

Re: Regular schedule vs holiday schedule

PostPosted: Tue Nov 29, 2022 8:35 am
by jalves
So, running that script at 12:01, would you then set a variable to true if it's a holiday? And then use that variable when performing actions, or not performing actions, based on the state of the variable?

Re: Regular schedule vs holiday schedule

PostPosted: Tue Nov 29, 2022 10:25 am
by FlyingDiver
jalves wrote:
So, running that script at 12:01, would you then set a variable to true if it's a holiday? And then use that variable when performing actions, or not performing actions, based on the state of the variable?
Post #4 has my complete script for setting the variable.


Sent from my iPhone using Tapatalk