HowTo implement "Special Day" treatment in a binding?

In the binding I’m working on, I have the need of a function that checks wether a day is the member of a list of days (a Holiday in my case). This list is user/Location/… dependent.
To have that code in the binding was voted against by the mods.

Which way to go now?

Version A
Use a calender-file (iCal format), which is read from the binding directly.
Format is fixed for iCal, user has to select the file (with PaperUI [possible? already] or .cfg-file)

Pro:
only one extra file needed, treatment done in binding itself.

Con:
File has to be created by “Hand”(text-editor), or is there an acceptable tool?

Version B:
Using calDAV Binding in order to Switch a “Proxy”-Item which is set by the calDAV and which is read by m binding.

Pro
Calender can be created with different calenders

Con
Proxy Item needed

Other suggestions??

1 Like

Why not go for version A, but ditch the iCal-File and use a simple, text based mybinding.cfg file where you could note:
day1=DDMMYYYY
day2=DDMMYYYY
.
dayn=DDMMYYYY

I tend to alway go for “keep it simple, keep it sweet” :slight_smile:

Also known as the KISS rule (excuse me for saying “stupid” :wink:)

I would use ICal because there are tools out that can write such a file for you, for example the holidays in country XY. I do forsee users asking for that.

2 Likes

Also, there are downloadable iCal files for holidays in country XY… Ask Google for them :smile:

1 Like

I am not sure if this has even anything to do with YOUR binding.

I think it should be a separate solution.
Like the CalDAV-binding.
I your smart home (regardless wich binding) needs to know if today is a holiday, the smart home should take care of it in general.

My proposal:
Recommend a best practice for your users.
Like:

configure a switch item with the name ‘holiday’.
control the holiday item with the caldav binding an get your localized file from XY.com

Does your binding really need the holiday information?
My hue binding does not need to know if I am at home.
openHAB does need to know if I am home and switches my lights accordingly.

Thanks for the answers!
@christoph_wempe
My binding reacts on published opening times. Since they are published like “Mo-Fr”, “Sa” or “Su and Holidays”, so it the binding does need the information.
Does the information need to be held/calculated etc. by the binding, NO! That is is the reason for asking!

My question was excatly pointing at: Is a dedicated (extra) item to hold this information the suggested way to go?

I’ll leave this one open for some more opinions, but I tend to go for the Item.