Holiday and Vacation Schedules

Holiday and Vacation schedules would be extremely useful. I know there a a few holiday apps, but they don’t cover every country. Also some people do have to work on some holidays. Building and advanced flow for this is doable, but cumbersome.

I think the best solution would be for Athom to update the built in alarm app with the ability to create your own holiday schedules. Each alarm you set could be associated with a holiday schedule.

Then flows based on the kids wake up alarm would be altered or skipped on school holidays. My wake up alarm could have different holidays and wife too.

I am also for pre-built national holiday schedules too, but still need the option to create your own.

I don’t want to discuss your idea and suggestion, I just want to inform about another very flexible and versatile alternative option: IcalCalendar

Indeed iCalCalendar is a good solution, though for completion I’m using this homeyscript
I wanted an easy way to check if it was a “studiedag” today, i put this in a homeyscript and call this from a flow, naming-wise it’s “studiedag-today” the script returns a true or false i can use in the rest of the flows

//Studiedagen in ouderkalender schooljaar 2023/24
var sdag = [];
//Add the days here in the same format
sdag[0] = "29-09"; // 1
sdag[1] = "08-11"; // 2
sdag[2] = "06-12"; // 3
sdag[3] = "16-02"; // 4
sdag[4] = "02-04"; // 5
sdag[5] = "28-06"; // 6
//-- don't change anything below here 
const today = new Date()
// to return the date number(1-31) for the specified date
let vandaag = formatDate(today) ; 
//vandaag = "29-09" //alleen voor testen
console.log(vandaag)
var vrijedag = 0 

for(var i=0;i<sdag.length;i++){
var vrij = sdag[i] ; 
  if(vrij==vandaag){
    console.log("vandaag vrij")
    vrijedag = 1
  }


}

if(vrijedag==1){
  return true; 
  }
else{
  return false;
}

function formatDate(input) {
    var d = new Date(input),
        month = '' + (d.getMonth() + 1),
        day = '' + d.getDate(),
        year = d.getFullYear();

    if (month.length < 2) 
        month = '0' + month;
    if (day.length < 2) 
        day = '0' + day;

    return [day, month].join('-');
}

it’s just school vacations. and we are lucky that they are in the same weeks every year. otherwise adjust 1 time a year. maybe too simply

You can easily subscribe various calendars (e.g. here) such as school vacations, public holidays, garbage collection, etc. to your smartphone calendar. When you then synchronize this smartphone calendar with the IcalCalender app and create suitable flows, then you don’t have to make any changes at all.
In addition, you can easily add other appointments or events, such as home office, “sick at home”, birthday, to your calendar without having to open the WebApp on the computer to adjust flows or appointments. For example, if you are sick (which I don’t wish for you!) the blinds will be opened later. Or for birthdays a song is played automatically and the lamps flash colorfully.
IcalCalender is maybe not that easy to handle but it’s the most underrated tool app in my opinion.
Thank you @runely for this powerful app!

1 Like

For those in the US that want to use the homeyscript version here is the conversion. It can be used in combination with the Day is Between flow card to filter out the weekends.

//========================================================================
// Using the Array below add all of the dates that are non-working days
//  - No Leading Zeros!!
//  - Month/day
var daysOff = [];
daysOff.push("1/1");    // New Years Day
daysOff.push("5/27");   // Memorial Day 2024
daysOff.push("7/4");    // Independence Day 
daysOff.push("9/2");    // Labor Day 2024
daysOff.push("11/28");  // Thanksgiving 2024
daysOff.push("11/29");  // Black Friday 2024
daysOff.push("12/24");  // Christmas Eve
daysOff.push("12/25");  // Christmas Eve
//daysOff.push("0/0");
//daysOff.push("0/0");

// Not sure why the date function does not localize correctly on Homey
//  - Un-comment the line for your time zone
const today = new Date().toLocaleString('en-US', { timeZone: 'America/New_York' });
//const today = new Date().toLocaleString('en-US', { timeZone: 'America/Chicago' });
//const today = new Date().toLocaleString('en-US', { timeZone: 'America/Denver' });
//const today = new Date().toLocaleString('en-US', { timeZone: 'America/Phoenix' });
//const today = new Date().toLocaleString('en-US', { timeZone: 'America/Los_Angeles' });

// No changes below
//========================================================================

let todayDateCode = (new Date(today).getMonth() + 1).toString() + "/" + new Date(today).getDate().toString(); 

for(i in daysOff)
{
  var checkDay = daysOff[i]; 
  if(checkDay == todayDateCode)
  {
    return true
  }
}

return false;

Argh, ugly js code…
Don’t use ““for and if”” but array.includes(value) for check if a value is in array

Buddy, I don’t care if it looks nice…

If you think its “ugly” you write a nice looking script and add to the conversation

var vrijedag = 0 

for(var i=0;i<sdag.length;i++){
var vrij = sdag[i] ; 
  if(vrij==vandaag){
    console.log("vandaag vrij")
    vrijedag = 1
  }


}

if(vrijedag==1){
  return true; 
  }
else{
  return false;
}

this code can be replace with:

if (sdag.includes(vandaag)) return true;
else return false;

Ps: Use push for adding values into array if includes don’t work!
I didn’t mean to offend

I’m not offended, but its easy to complain but much better to be constructive

thanks for the code addition

1 Like

The ugly is looping array even if the value was found, includes is more concise and nice :grin: