Ephemeris Binding [4.0.0.0;5.0.0.0)

image

The Ephemeris Binding makes the bridge with Ephemeris core actions, providing access via Items to Ephemeris data without using scripting language.

Things gives you direct access to:

  • default holiday data (thing holiday)
  • personal holidata data file (thing file)
  • daysets (thing dayset)
  • weekend (thing weekend)

The binding will auto create a folder in openhab configuration folder where it expects to find your Jollyday event definition files. Eg. for a linux system : /etc/openhab/misc/ephemeris/

Autodiscovery of Weekend and Holiday is active.

image

Ressources
Jar file

Source and documentation

Depending upon the traction felt on this binding, I’ll figure to push it in openhab-addons.

5 Likes

Oddly when I try to install this through the add-on store it fails without an error in the logs. I think the problem is the link to the file on Google Drive doesn’t return the actual jar file. When I use wget with the URL provided I get a web page instead of the jar.

<!DOCTYPE html><html><head><meta name="google" content="notranslate"><meta http-equiv="X-UA-Compatible" content="IE=edge;"><style nonce="JNgyFIkMlqyw27EXM_9RVg">@font-face{font-family:'Roboto';font-style:italic;font-weight:400;src:url(//fonts.gstatic.com/s/roboto/v18/KFOkCnqEu92Fr1Mu51xIIzc.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:normal;font-weight:300;src:url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fBBc9.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:normal;font-weight:400;src:url(//fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxP.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:normal;font-weight:500;src:url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmEU9fBBc9.ttf)format('truetype');}@font-face{font-family:'Roboto';font-style:normal;font-weight:700;src:url(//fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBBc9.ttf)format('truetype');}</style><meta name="referrer" content="origin"><title>org.openhab.binding.ephemeris-4.2.0-SNAPSHOT.jar - Google Drive</title><script nonce="gwfBeUeHwBHxQJPYprd_cA">
          window['_DRIVE_VIEWER_IVIS'] = document.visibilityState;
        </script><meta property="og:title" content="org.openhab.binding.ephemeris-4.2.0-SNAPSHOT.jar"><meta property="og:type" content="article"><meta property="og:site_name" content="Google Docs"><meta property="og:url" content="https://drive.google.com/file/d/1Eq7o8lOXM3-mM6UieiPU1jY5yJHASrRL/view?usp=drive_link&amp;usp=embed_facebook"><link rel="shortcut icon" href="https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Google+Sans:300,400,500,700" nonce="JNgyFIkMlqyw27EXM_9RVg"><link rel="stylesheet" href="https://www.gstatic.com/_/apps-fileview/
...

Installation through MainUI won’t work unless the URL is directly to the jar file. I don’t know how/whether that’s possible with a file shared through Google Drive.

The link is now corrected. You should be ready to go.

1 Like

Thanks! It works now.

Great addition, saves a lot of rules code.

My findings on a manual installation of openHAB 4.1.1 on Debian Bookworm:

-folder ephemeris correctly was created in /opt/openhab/conf/misc/

  • Maybe it is wise to change the recommended folder for creating custom bank holidays and language files in the Ephemeris docs from /services to /misc/ephemeris to not have inconsistent entries:
    (1), (2)

What am I missing are:

  • translations don’t seem to work. The raw String is presented. I have my holiday_descriptions_de.properties and also country_descriptions_de.properties in the same /misc/ephemeris folder, also the Regional settings both from openHAB and the Ephemeris are set to German, but the outcome is:

  • it would be nice to have a switch not only for weekends and workdays, but also for the holidays: isBankHoliday and isBankHoliday(<offset>) (at least for isBankHoliday(1), as this is often used for garbage calenders).

Nice work, thx a lot!

For the core part, it is only a recommendation.
If this pinding happens to finish in official repo, unifying these will be better, you’re correct.

You’re correct, I did nothing as of today on this side. I plan to add a channel description providing translated strings for raw strings.

Good idea the switch for holidays.
I also planned to include a configurable channel, allowing the usage of the offset.
I also thought of a basic discovery service that could automatically generate weekend and holiday things.

1 Like

I updated the binding in the link above.

  • Added Autodiscovery of Holiday and Weekend
  • Added Description provider for Holiday title channels
  • Added Switches for holiday-today and holiday-tomorrow

Channel names have changed for better readability. Also default thing became holiday thing.

1 Like

Meanwhile I upgraded to openHAB 4.2.0.M2.

The version from the marketplace does not work, the version from the github link works fine.

Check, works.
The “old” channels for adding those manually need to be deleted:

ephe_del

I will tell you my findings in 23 days when we have Labour Day :grinning:

The version from the marketplace is the one provided by the link above. It may be a cache issue.

1 Like

You were right.
I deleted the jar in the addons folder, cleaned cache and tmp, installed the version from the marketplace and everything went good :+1:

When I added the binding from the marketplace today, I got the following errors;

openhab.log

[ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while calling thing handler factory 'org.openhab.binding.ephemeris.internal.EphemerisHandlerFactory@554f5d73': Can't find bundle for base name descriptions.holiday_descriptions, locale en_CA
java.util.MissingResourceException: Can't find bundle for base name descriptions.holiday_descriptions, locale en_CA
	at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2045) ~[?:?]
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1683) ~[?:?]
	at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1586) ~[?:?]
	at java.util.ResourceBundle.getBundle(ResourceBundle.java:1280) ~[?:?]
	at de.jollyday.util.ResourceUtil.getResourceBundle(ResourceUtil.java:174) ~[?:?]
	at de.jollyday.util.ResourceUtil.getHolidayDescriptions(ResourceUtil.java:152) ~[?:?]
	at de.jollyday.util.ResourceUtil.getHolidayDescription(ResourceUtil.java:83) ~[?:?]
	at org.openhab.core.ephemeris.internal.EphemerisManagerImpl.getHolidayDescription(EphemerisManagerImpl.java:435) ~[?:?]
	at org.openhab.binding.ephemeris.internal.handler.HolidayHandler.<init>(HolidayHandler.java:52) ~[?:?]
	at org.openhab.binding.ephemeris.internal.EphemerisHandlerFactory.createHandler(EphemerisHandlerFactory.java:80) ~[?:?]
	at org.openhab.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:129) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.doRegisterHandler(ThingManagerImpl.java:531) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.registerHandler(ThingManagerImpl.java:512) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.registerAndInitializeHandler(ThingManagerImpl.java:927) ~[?:?]
	at org.openhab.core.thing.internal.ThingManagerImpl.setEnabled(ThingManagerImpl.java:1009) ~[?:?]
	at org.openhab.core.io.rest.core.internal.thing.ThingResource.setEnabled(ThingResource.java:609) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) ~[bundleFile:3.6.2]
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[bundleFile:3.6.2]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:201) ~[bundleFile:3.6.2]
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:104) ~[bundleFile:3.6.2]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) ~[bundleFile:3.6.2]
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) ~[bundleFile:3.6.2]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:304) ~[bundleFile:3.6.2]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:234) ~[bundleFile:3.6.2]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:520) ~[bundleFile:4.0.4]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279) ~[bundleFile:3.6.2]
	at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:102) ~[bundleFile:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656) ~[bundleFile:9.4.52.v20230823]
	at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:100) ~[bundleFile:?]
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:320) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[bundleFile:9.4.52.v20230823]
	at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:722) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.52.v20230823]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.52.v20230823]
	at java.lang.Thread.run(Thread.java:840) [?:?]

If I create an Ephemeris Holidays thing, I also get this error in events.log:

Thing 'ephemeris:holiday:82367f647b' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_REGISTERING_ERROR): Can't find bundle for base name descriptions.holiday_descriptions, locale en_CA

In my /etc/openhab/misc/ephemeris folder, I have a copied the following files from the focus-shift/jollyday github;

  • Holidays_ca.xml
  • holiday_descriptions.properties
  • country_descriptions.properties

I’ve also tried appending ‘_en’ and ‘_en_CA’ to both *_descriptions.properties files (as in ‘holiday_descriptions_en.properties’ and ‘holiday_descriptions_en_CA.properties’), but the errors persist.

I suspect you already face the same error using ephemeris via script ?

Correct - I get a similar error when trying to use holiday descriptions in my rules with the core Ephemeris capabilities.

I had hoped that with the addition of the description provider you mentioned above, we’d also be able to specify the location of the holiday_descriptions.properties file (much like we can specify the Holidays.xml file).

There doesn’t appear to be any documentation on where the holiday_descriptions.properties file(s) should be located (or named) to satisfy the locale checks.

Unfortunately for you the binding gets its descriptions directly from the core, so if core fails you’re out. Take a look above @sihui seems also to use property files, maybe he can tell us if it works and where he puts them. If not, it may be worth opening an issue in the core .

I used to have properties files in $OH_CONF/misc/ephemeris, but when tinkering with this binding I realized those are not needed at all, at least not for the core functions:

I have a custom xml file in $OH_CONF/misc/ephemeris which get picked up nicely with the core function and also with this binding.
Localization works with the core functions, even I don’t have any language properties files in the $OH_CONF/misc/ephemeris folder anymore. Example:

val String nextHoliday = Ephemeris.getHolidayDescription(Ephemeris.getNextBankHoliday())
        val long daysuntilnextHoliday = Ephemeris.getDaysUntil(Ephemeris.getNextBankHoliday())
        if (daysuntilnextHoliday < 1) {
            logInfo("Test_ephemeris","Heutiges Event: " + nextHoliday)
        }
        else {
            logInfo("Test_ephemeris","Heute liegt nichts an. NĂ€chster wichtiger Tag: " + nextHoliday + ", noch " + daysuntilnextHoliday + " Tage")

There is no Holidays_xx.xml or language properties file needed if you configure this in the MainUI settings for your country. This was surprising for me, too :grinning:

Yes, normally Jolliday (basis of the core implementation of Ephemeris in OH) comes with localized versions of all holidays so maybe apart of weird country/language combinations, you should have everything embedded.

Hi, I stored a birthday.xml in /etc/openhab/misc/ephemeris with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="de" description="Germany"
    xmlns:tns="https://www.example.org/Holiday" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://www.example.org/Holiday /Holiday.xsd">
    <tns:Holidays>
        <tns:Fixed month="JANUARY" day="3" descriptionPropertiesKey="Geburtstag xy" validFrom="19xx" />
		<tns:Fixed month="MARCH" day="19" descriptionPropertiesKey="Geburtstag x" validFrom="19xx" />
        <tns:Fixed month="MARCH" day="1" descriptionPropertiesKey="Geburtstag y" validFrom="19xx" />
        <tns:Fixed month="MARCH" day="1" descriptionPropertiesKey="Geburtstag z" validFrom="19xx" />
        <tns:Fixed month="JULY" day="3" descriptionPropertiesKey="Geburtstag a" validFrom="20xx" />
		<tns:Fixed month="AUGUST" day="18" descriptionPropertiesKey="Geburtstag b" validFrom="19xx" />
		<tns:Fixed month="OCTOBER" day="12" descriptionPropertiesKey="Tag x" validFrom="20xx" />
		<tns:Fixed month="MAY" day="17" descriptionPropertiesKey="Tag y" validFrom="19xx" />
    </tns:Holidays>
</tns:Configuration>

I have defined a thing for this xml. The thing is online, but I’m not getting any data in the channels. What could be wrong?

A thing for weekends and weekdays doesn’t work either. The channel values remain permanently OFF. When starting, there is a warning that daysets are not defined. But they are in the empemeris.config.

:org.apache.felix.configadmin.revision:=L"2"
country="de"
region="th"
service.pid="org.openhab.ephemeris"
dayset-weekend=( \
  "SATURDAY", \
  "SUNDAY", \
)
dayset-workday=( \
  "MONDAY", \
  "TUESDAY", \
  "WEDNESDAY", \
  "THURSDAY", \
  "FRIDAY", \
)

Thanks Heiko

Use the UI to add the weekends.

If you do not define it in the UI you can place you custom day definitions in /etc/openhab/services/ephemeris.cfg, like this one:

dayset-weekend=[SATURDAY,SUNDAY]
dayset-ecole=[MONDAY,TUESDAY,THURSDAY,FRIDAY]
dayset-work=[MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY]
country=fr

Regarding your XML definition file, it worked when I removed the validFrom mentions:
image

Hello, the holidays, weekend and weekday daysets are now working. But the birthday.xml doesn’t work even if I remove the validFrom mentions. Strange. Any more ideas?
OH4.1.2 stable on openHABian.