Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Bank Holiday Calc Scene


DonQuichopp

Question

Bank Holiday Calc Scene (V 1.2.3a)

 

I started creating a scene where the bank Holidays can be calculated, at the moment Switzerland (alle Kantone), Germany (alle Bundesländer), Austria (alle Bundesländer), United Kingdome (all Countries), France (some Départements), Sweden (whole Country), Ireland (whole Country), Iceland (whole Country), Poland (whole Country), Italy (whole Country), Norway (whole Country), Croatia (whole Country), Netherlands (whole Country), Czech Republic (whole Country, thanks @petr23) are covered. Work in progress for more Countries to come.

 

With this scene you can calculate all the Bank Holidays of the current year.
There are some preset Countries with already defined Holidays, some also have Provinces as there may be different holidays in parts of the country.

The yearly bank Holidays will be stored in the global Variable "BankHol_ThisYear" (in System Seconds). You can either use this list as you wish or implement it into Sankotronic's Main Scene for Time Based Events Control (setup described below).

 

The Names/Titles of the Bank Holidays are provided in multiple Languages and it is set up that more language or your own language can be supported.

 

Setup

You need to create a global variable with the Name "BankHol_ThisYear" in the upper part of the variable Panel.

 

If you wish to check constantly if today or tomorrow is a Bank Holiday, then you need to implement a function in @Sankotronic's Main Scene for Time Based Events Control.

 

Please login or register to see this code.

 

User Variables

Country

choose your country by changing the Code between the brackets (capital Letters)

Please login or register to see this code.

Available Countries:
  CH = Switzerland
  DE = Germany

  AT = Austria

  GB = United Kingdom

  FR = France

  SE = Sweden

  IE = Ireland

  IS = Iceland

  PL = Poland

  IT = Italy

  NO = Norway

  HR = Croatia

  CZ = Czech Republic

  NL = Netherlands

 

Province

choose your province by changing the Code between the brackets (small Letters).

If you do not wish to use a province you can keep the quotes empty "". 

Please login or register to see this code.

Available Provinces
Switzerland: ag = Argau, ar = Appenzell Ausserrhoden, ai = Appenzell Innerrhoden, bl = Basel-Landschaft, bs = Basel-Stadt, be = Bern, fr = Freiburg, ge = Genf, gl = Glarus, gr = Graubünden, ju = Jura, lu = Luzern, ne = Neuenburg, nw = Nidwalden, ow = Obwalden, sh = Schaffhausen, sz = Schwyz, so = Solothurn, sg = St. Gallen, ti = Tessin, tg = Thurgau, ur = Uri, vd = Waadt, vs = Wallis, zg = Zug, zh = Zürich

Germany: bw = Baden-Württemberg, by = Bayern, be = Berlin, bb = Brandenburg, hb = Bremen, hh = Hamburg, he = Hessen, mv = Mecklenburg-Vorpommern, ni = Niedersachsen, nw = Nordrhein-Westfalen, rp = Rheinland-Pfalz, sl = Saarland, sn = Sachsen, st = Sachsen-Anhalt, sh = Schleswig-Holstein, th = Thüringen

Austria: b = Burgenland, k = Kärnten, n = Niederösterreich, o = Oberösterreich, s = Salzburg, st = Steiermark, t = Tirol, v = Vorarlberg, w = Wien

United Kingdom: eng = England, sct = Scotland, wls = Wales, nir = Nord Ireland

France: moselle = Moselle, basrhin = Bas-Rhin, hautrhin = Haut-Rhin

Sweden: No Provinces (all public holidays apply for whole Country)

Ireland: No Provinces (all public holidays apply for whole Country)

Iceland: No Provinces (all public holidays apply for whole Country)

Poland: No Provinces (all public holidays apply for whole Country)

Italy: No Provinces (all public holidays apply for whole Country)

Norway: No Provinces (all public holidays apply for whole Country)

Croatia: No Provinces (all public holidays apply for whole Country)

Czech Republic: No Provinces (all public holidays apply for whole Country)

Netherlands: No Provinces (all public holidays apply for whole Country)

 

Language

choose your language by changing the Code between the brackets (small Letters)

Please login or register to see this code.

en = English
de = German

fr = French

sv = Swedish

ga = Gaelic / Irish

is = Islandic

pl = Polish

no = Norwegian

it = Italian

hr = Croatian

cz = Czech

nl = Dutch
ol = own language

 

The Texts are always given in the available languages.
If there is no Title for your chosen language, default language English will be taken.


There is also a key for your Own Language (ol)

Add the text in your language in the lines with the ["ol"] keys, just change the whole text in "OL xxx" after the equal-sign.

 

If you want to change the Title in an existing language for example German "de", then change it at the specific line where the key ["de"] is set.
Example: in xmasDayTitle you want to rename the German translation then change the Text in the line xmasDayTitle["de"] = change it from "Weihnachten" to "1. Weihnachtsfeiertag"

 

In this section I also tried to explain the Holiday as good as possible. This might need some improvement in future Versions.

 

Please login or register to see this code.

Show Sundays

There are some holidays that always fall on a Sunday (like Easter Sunday or Pentecost) these are not shown by default. If you want to add them, then you will have to set the variable "addSundays" to true. If set to false, these days are not shown/detected.

This setting does not exclude a holiday if it is a fixed day and hits a Sunday (like Swiss National day at 1. August), these days will always show.

 

Please login or register to see this code.

 

Debuggig

There are some switches to enable Debugging:

Please login or register to see this code.

If debug is set to true, then it will print the Results in an ordered List (Name = Date) in the Scene.

If you wish to check for a specific year to see if the calculations are correct, then set debugSpecificYear to true and choose the year in debugYear. Above it would check for the holidays in 2015 if debugSpecificYear were set to true.

 

Result

A JSON in the below format will be stored in the global Variable BankHol_ThisYear:

Please login or register to see this code.

 

Corrections

Even though I have tested the dates thoroughly there might be mistakes in the calculations. Before using the Scene in a vital Environment (Alarms, etc.) please check the list first in Debug Mode.

Please also let me know if I made a mistake, then I can correct it for future users.

 

Improvements

I will be adding more countries over the time. For certain Countries I am sure I'd need help from locals as these days are sometimes not easy to define.

 

Version History

1.2.3a     Fixed some Netherlands Holiday Names

1.2.3       Added Czech Republic, Netherlands

1.2.2       Added Norway, Italy, Croatia

1.2.1       Added Iceland, Poland

1.2.0       Introduced new Variable to add Sundays to the days too.
               Updated the countries and corrected a mistake in Sweden.
               Added Ireland and Irish/Gaelic language

1.1.0       Changed the Language Selection (see details above), added Sweden

1.0.2       Added France and Départements and French Language/Titles

1.0.1       Added Austria and its Bundesländer,
               Added United Kingdom (England, Northern Ireland, Wales and Scotland)

1.0.0       Initial Version for Switzerland & Germany
               With all Provinces (Kantone / Bundesländer)

 

Hope you enjoy the scene and some of you can use it :)

 

Here is the complete .lua file: 

Please login or register to see this attachment.

 

Cheers

Don

 

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Please login or register to see this attachment.

Edited by DonQuichopp
new Version
Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • Version 1.0.1 Includes Austria and its Bundesländer and United Kingdom (England, Northern Ireland, Wales, Scotland). With Scotland I am not sure if all dates are correct, maybe there is a forum member that knows better than me :)

     

    Find the Version 1.0.1 File in the top post.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Version 1.0.2 includes France and Départements (Moselle, Bas- & Haut-Rhin).

     

    Anybody interested for a different country? :-)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • UK is already in ;-) Version 1.0.1 (Austria as well)

    France in 1.0.2

    Sweden will come in 1.1.0 together with improved Language handling.

    Edited by DonQuichopp
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @jompa68 and all :)

     

    New Version 1.1.0 has been uploaded, it now includes an improved language handling. It will always check for the Holiday title in the selected language. If not available it will default to English.

     

    I have added Sweden if you could check if the dates are correct @jompa68 I would appreciate it. (remember to keep the province empty "" as the days seem to be valid for the whole country.

    Link to comment
    Share on other sites

    • 0

    Looks that some days are missing for SE. Look here: 

    Please login or register to see this link.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I forgot the Easter Monday, the fix sundays i didn't add on purpose, as these are workfree in Switzerland Anyways. Like Easter Sunday or Pentecost (påskdagen).

     

    shall i add them too? Maybe with a switch to toggle on/off Sundays 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • New Version 1.2.0 added with the possibility to show/detect fix Sunday-Holidays (like Easter Sunday). Also added Ireland and the language Gaelic.

     

    Maybe somebody from Irleand can help me on a question I have. If the public holiday (like St. Patrick's Day or New Year) falls on Saturday or Sunday, is Monday a day off for everybody? or does this depend on the company the person is working for?


    Thanks and cheers

    Don

    Edited by DonQuichopp
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • sure, will look into Norway and Italy in the next version, if it is not too complex i'll can do it tonight :)

    Maybe i need some help in checking the dates and the translations.

    Link to comment
    Share on other sites

    • 0

    Thanks! (Just need some rainy wx for the weekend so I get time to play with my HC2 to check it out)

    Link to comment
    Share on other sites

    • 0

    We got it today. Great for skiing, not so great for the air traffic...

     

    BTW 1st May is presumably our first Bank holiday, so I´m hoping for the weekend.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • okay, looking forward to your feedback :)

    @1152: Are you working in aviation?

     

    If any other countries are required, please let me know :) 

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...