[Updated] 'Holiday Switch' Driver - Now an app too!

community_driver

#1

Background

I wanted to restrict some of my automations to not happen when it's a national holiday (We call them Bank Holidays in the UK) like that early morning weekday 'Wake up!' announcement

So, now all these types of automations are restricted by 'Holiday Switch'

How it works
Using a free API key from https://calendarific.com this switch turns on when there is a national holiday and off when there isn't!

Configuration & Use
To use this driver, sign up to get your free api key then just create a new virtual device and assign this driver to it then add your configuration before saving

You can configure it for most countries and the following holiday types:

  • National
  • Local
  • Religious

USA guys can also specify state in the country configuration for use with Local & National holidays
(e.g. US will return all US holidays, US-FL will return holidays in Florida, US-NY will return holidays in New York state)

The following Religious holiday types are configurable too:

  • Buddhism
  • Christian
  • Hinduism
  • Muslim
  • Hebrew

For religious holidays, you need to save the device after selecting 'Religious' from the drop down holiday type list, then save and open again to configure which religion you want to switch upon

If there is a religion I have missed (which calendarific provide) then I will happily add this

Future is here...
I'm releasing the parent/child app that gives you the ability to add your own holidays to the mix, switching on during your holiday, off when it finishes
Here:

Install the parent child code then create a new child app..

Select your 'Holiday' virtual switch device
image

Next bit is pretty obvious..

Then name the holiday and the child app (Holiday name will be shown when this holiday is active)
image

This now means that during this time the switch will be turned on.. irrespective on any national holidays

Driver
This driver is released as 'open source' (although the app isn't) and you can find it here:

Many thanks (as always) to @Royski for his patient beta testing

And yes. I'm off to watch the Hungarian Grand Pix in August :slight_smile:

Hope y'all find it useful!

Andy


Holiday Lights Script Modification Help
Can Hubitat read calendar events
Mode Manager - Disable Switch Mode Change For Certain Modes
Hubitat - Calendar
#2

Hi @Cobra
Just thought I'd let you know that my Holiday switch turned on today at midnight.
image
Thanks again for this.


#3

That’s brilliant!

Mine didn’t :slight_smile:
I am in Paris for the weekend so mine automatically turned on friday afternoon. Hopefully it will turn off on tuesday afternoon when I should be getting home :slight_smile:

I’m testing a new app that works for your configured holidays and will override bank holidays if they are in the middle of another holiday. (The switch will still be on though)

I’ll release it when I get home sometime this week probably.

Andy


#4

Happy to confirm the app worked as it should.
I’ll finish it off and release it soon :slight_smile:

Andy


#5

Ok..
so app is now released..
Check out the 1st post for details..

Andy


#6

I was going to explore this Holiday Switch driver but ran into the following error when trying to install the Parent Driver.

No signature of method: Script1.definition() is applicable for argument types: (java.util.LinkedHashMap) values: [[name:Holiday Switch, namespace:Cobra, author:Andrew Parker, ...]]

I am running Hubitat firmware 2.1.0.123

Any ideas on what might be wrong?

FYI, I also tried installing the child driver and got the same result. :expressionless:


#7

Doh! Never mind! Argghhhh!?!?!?!

I really confused the installation of the driver and app code. Bottom line, once I sorted out the driver code into the drivers section and the app code into the app section, everything installed successfully.

Sorry for the false alarm.


#8

We have all done it!


#9

@Cobra is this all i need to do for country? Then off it will go?


#10

I have GB in lower case and National selected as you have and it works OK for me.
Don't think its case sensitive though.


#11

The country code doesn’t seem to be case sensitive at all.

Andy


#12

Can this app work without the external web service?
Had a look at the calendarific site, but it didn't look particularly helpful for Australia (lots of non-holiday days, and no state based ones), so I didn't sign up.

I manually created a holiday for today (about a week ago), but the switch has not turned on.
Nothing in the logs other than a 12am message about being up to date. Scheduled job resetMsg says previous run was at 1am this morning.
Edit: actually there was a log under the child app, missed that:

2019-06-10 00:00:02.842 errorjava.lang.IllegalArgumentException: Command 'OverrideOn' is not supported by device. on line 170 (switchNow1)


#13

The app might work but was designed to work with the virtual switch driver which has the ‘overrideOn’ command built in.
The error msg looks like you are trying to use it with something else.

If you just want to turn on/off a switch without using the wbsite I would suggest my ‘Scheduled Switch’ app
This will do what you want for any switch.

Andy


#14

Right, ok, I misunderstood somewhere - I had it set to the HolidaySwitch device driver (from the top of this thread, listed under the heading Driver).

Sounds perfect, I'll check it out, thanks!


#15

That's the driver I meant..
Hmmm..
I'll have a look again at the error and the app

Andy


#16

I've just tested a couple of times and cannot reproduce the error at all


#17

I had a quick look and the line to define the OverrideOn command is commented out in the driver, could that be the issue? (it matches the github though)

I have setup Scheduled Switch instead anyway - I'll declare a new holiday later this week to test it :laughing:


#18

You are perfectly correct!

I had not updated the driver code from my version here.
Updated code now on github
Version 1.2.0 of the driver code.
This version also gives you the ability to reverse the switch.. so the switch if OFF during a holiday rather than ON

Sorry about that

Andy