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

Hi @DonQuichopp,

 

Nice work! And what about Croatia? I have this link that can maybe help you:

 

Please login or register to see this link.

 

Link to comment
Share on other sites

  • 0
7 minutes ago, DonQuichopp said:

Already added in 1.2.2 @Sankotronic ;-)

 

WOW! You are great! Time for me to install it then! 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Let me know if there is any mistake in there :) There are so many different interpretations of the public holidays, it ain't easy :) 

    Link to comment
    Share on other sites

    • 0

    I have added Czech - including new version (I hope with your code logic) :)

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    I dare not to ask, but any chance to get bankholidays for the Netherlands?

     

    Thanks Jim

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @petr23 thank you very much for Czech Republic! Much appreciated and added in Version 1.2.3

     

    @jimicr Netherlands also added in 1.2.3 happy Koningsdag tomorrow ;-) 

    Link to comment
    Share on other sites

    • 0
    Just now, DonQuichopp said:

    @petr23 thank you very much for Czech Republic! Much appreciated and added in Version 1.2.3

     

    @jimicr Netherlands also added in 1.2.3 happy Koningsdag tomorrow ;-) 

    @DonQuichopp Thanks very much!!! I've started allready ;)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I had to upload the version 3 times as I found two errors ;-) the version now should be working fine. Hope the dates are correct.

     

    I didn't find a translation for Easter Monday and Whit Monday. I just named them Pasen (maandag) and Pinksteren (maandag), maybe @jimicr you can let me know if there is a correct name for them? Then I'll make a corrected Version 1.2.3a :) 

    Link to comment
    Share on other sites

    • 0
    33 minutes ago, DonQuichopp said:

    I had to upload the version 3 times as I found two errors ;-) the version now should be working fine. Hope the dates are correct.

     

    I didn't find a translation for Easter Monday and Whit Monday. I just named them Pasen (maandag) and Pinksteren (maandag), maybe @jimicr you can let me know if there is a correct name for them? Then I'll make a corrected Version 1.2.3a :) 

    No problem, its 2e paasdag (Tweede Paasdag (second day of Easter)), 2e Pinksterdag (Tweede Pinksterdag ( Second day of ???))

    Same goes for my birthday december 26th, 2e Kerstdag (Tweede Kerstdag (Boxing Day)).

    2e and Tweede is the same like 2nd and second.

    Use what fitst best ;)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks @jimicr, i fixed it and updated it in the initial post :)

     

    Pinksteren is Pentecost in English ;-)

     

    So as I don't have a public holiday tomorrow in Switzerland, I need to sleep :D

     

    Cheers

    Don

    Link to comment
    Share on other sites

    • 0
    31 minutes ago, DonQuichopp said:

    Thanks @jimicr, i fixed it and updated it in the initial post :)

     

    Pinksteren is Pentecost in English ;-)

     

    So as I don't have a public holiday tomorrow in Switzerland, I need to sleep :D

     

    Cheers

    Don

    Thanks, will update tomorrow on my Bank holiday ;) 

    Link to comment
    Share on other sites

    • 0

    Hi @DonQuichopp

     

    I am trying to create the variable that you instruct.  Problem is that in the case of BankHolidayTomorrow, I cannot get the last "w" into the field.  We seem to have hit a max here.  This is in the top half of the var panel.  I am on version 4.132

     

    Help will be appreciated

     

    Thanks

    lp

    Link to comment
    Share on other sites

    • 0
    1 hour ago, lennypenny said:

    Hi @DonQuichopp

     

    I am trying to create the variable that you instruct.  Problem is that in the case of BankHolidayTomorrow, I cannot get the last "w" into the field.  We seem to have hit a max here.  This is in the top half of the var panel.  I am on version 4.132

     

    Help will be appreciated

     

    Thanks

    lp

     

    Hi @lennypenny,

     

    I can see that in code there is global variable "BankHolidayTomorro" so you should be OK. Check line bellow that is from code:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 hour ago, Sankotronic said:

     

    Hi @lennypenny,

     

    I can see that in code there is global variable "BankHolidayTomorro" so you should be OK. Check line bellow that is from code:

    Please login or register to see this code.

     

     

    Hi all

     

    @Sankotronic is right, it should read BankHolidayTomorro as there is not enough space for the whole name.

    will need to change it in the original post, but am not able to do it in the iPhone.

     

    Cheers Don

    Link to comment
    Share on other sites

    • 0
    1 hour ago, Sankotronic said:

    I can see that in code there is global variable "BankHolidayTomorro" so you should be OK. Check line bellow that is from code:

     

    Hi @Sankotronic,

     

    Thank for your input............  I guess I should have checked but then I am not the brightest of programmers <grin>

     

    Best regards

    lp

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 45 minutes ago, lennypenny said:

     

    Hi @Sankotronic,

     

    Thank for your input............  I guess I should have checked but then I am not the brightest of programmers <grin>

     

    Best regards

    lp

     

    Nope, I should have written it correctly in the explanation ;-)

     

    my bad

    Link to comment
    Share on other sites

    • 0

    Hi @DonQuichopp,

     

    woul'd you mind to add Slovakia as well?

     

    Please login or register to see this link.

     

    It's quite simmilar with Czech bank holidays.

     

    Many thanks in advance.

     

    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...