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
Question
DonQuichopp 4
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 DonQuichoppnew Version
Link to comment
Share on other sites
Top Posters For This Question
20
4
4
3
Popular Days
Apr 25
8
Apr 24
7
Jun 28
6
Aug 27
6
Top Posters For This Question
DonQuichopp 20 posts
darren-mc 4 posts
jimicr 4 posts
AutoFrank 3 posts
Popular Days
Apr 25 2017
8 posts
Apr 24 2017
7 posts
Jun 28 2017
6 posts
Aug 27 2017
6 posts
Popular Posts
DonQuichopp
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 (all
DonQuichopp
Already added in 1.2.2 @Sankotronic
Posted Images
49 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.