Erroneous day set definition dayset-school

Hi.
I noticed these lines in my openhab.log:

2024-12-14 09:01:43.063 [WARN ] [emeris.internal.EphemerisManagerImpl] - Erroneous day set definition dayset-school: No enum constant java.time.DayOfWeek.
2024-12-14 09:01:43.067 [WARN ] [emeris.internal.EphemerisManagerImpl] - Erroneous day set definition dayset-weekend: No enum constant java.time.DayOfWeek.

After some searching I suspect that the error lies in my ephemeris.config (which I have never touched, it’s just been there since pre OH 2.0). Can anyone tell me what is the correct format of dayset-school and dayset-weekend? Pasting my full ephemeris.config below:

:org.apache.felix.configadmin.revision:=L"142"
country=“"se"”
dayset-school=“"(\ "MONDAY",\ "TUESDAY",\ "WEDNESDAY",\ "THURSDAY",\ "FRIDAY",\ )"”
dayset-weekend=“(\ "(\ "SATURDAY",\ "SUNDAY",\ )",\ )”
felix.fileinstall.filename=“file:/var/lib/openhab/etc/org.openhab.ephemeris.cfg”
service.bundleLocation=“?”
service.pid=“org.openhab.ephemeris”

I don’t remember Ephemeris’ config looking quite like that. I only define weekend through the UI so I don’t have an example handy.

The example in the docs is

dayset-workday=[MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY]

No escaped double quotes or weird parens and such.

More details at https://www.openhab.org/docs/configuration/actions.html#configuration

1 Like

You are looking at the ephemeris.config, which gets populated through the UI or the content of the configuration file ephemeris.cfg file and usually has “weird” characters in there. You should never edit .config files manually!

If you need custom daysets, you have to configure everything through the ephemeris.cfg file.

Location of that file see link from Rich.

1 Like

Thank you both! In the file /var/lib/openhab/org.openhab.ephemeris.cfg I had the exact same definition of dayset-weekend and dayset-school, I guess that’s the source then? And I guess it’s remnants of some old OH version. I’ll correct the syntax there according to the linked docs and hope the error goes away til the next time I restart OH :slight_smile:

Probably.
Don’t forget to take a look at the Ephemeris binding, which makes setting up rules much easier.

Hmm, didn’t really work out as planned. I’ll go through my steps, suspecting I’m in the wrong location here… What I did now was editing /var/lib/openhab/etc/org.openhab.ephemeris.cfg to the correct syntax, ie:

dayset-weekend=[SATURDAY,SUNDAY]

After the next reboot of OH, the configuration has reset itself to the weird syntax, ie:

dayset-weekend = (
“SATURDAY”,
“SUNDAY”,
)

…and also the exact thing in /var/lib/openhab/config/org/openhab/ephemeris.config. And so I got the errors in the log, complaining about erroneous day set definition.

Could it be that those definitions shouldn’t be there at all? If I understand the documentation correctly the dayset definitions should be in /etc/openhab/services/ephemeris.cfg, is it the case that they should ONLY exist there?

Yes.

cfg in /services, config in /etc/…

Settings are done either in MainUI or in ephemeris.cfg.
ephemeris.config gets populated automatically, don’t edit manually.

I didn’t. The file I edited was /var/lib/openhab/etc/org.openhab.ephemeris.cfg, I’m trying to establish what that file is supposed to contain, if the daysets should be there at all or if those rows are just remnants of some old OH version…

There should not be an ephemeris file at all. Delete it (make a backup before deleting)
Delete also your ephemeris.config file in /etc/…

Make sure you did not configure anything through the UI (Settings … Ephemeris) if you want to use the text config file ephemeris.cfg.

Configure the ephemeris.cfg file in /services according to the docs and your needs.
Restart openHAB.

Everything should work now. If you want to make sure, take a look (don’t edit) at your ephemeris.config file in /etc/…

Well, no actually, I’d rather configure everything through UI, that’s what I’m doing with everything else :joy:

Starting to think the best option is to just delete all those lines altogether, the only thing I really want is to get my log file free from error messages…

Now I am confused.
Why are you dealing with the config files then at all?
Delete all config and cfg files and configure through the UI.
After you hit “save” a new ephemeris.config file will be created automatically, but that is just for info, don’t touch it :grinning:

Because that’s where the error message seems to come from. I never created any file related to ephemeris since I never used it, I guess those files must have been auto created from some earlier version of OH? Guess I’ll simply go over all those .cfg files and check which could be deleted and which don’t…

You don’t need any of them if using the UI.

1 Like

Let me summarize a bit.

  1. You should never edit anything in $OH_USERDATA/config. Those config files are managed by OH itself and should not be edited manually. On an apt install $OH_USERDATA is /var/lib/openhab.

  2. You should never see any .cfg files in $OH_USERDATA/config. These files will all have a .config extension.

  3. Unfortunately, you can only configure Weekend Days as a dayset through the UI. To define new daysets or to define custom holidays you must use a file based config.

    a. To configure a new dayset create/edit $OH_CONF/services/ephemeris.cfg. If you define a new dayset, you need to configure everything ephemeris related through the file. The contents of this file (or lack of contents) will override what’s done in the UI. The file should look something like:

country=de
region=nw
dayset-workday=[MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY]
dayset-weekend=[SATURDAY,SUNDAY]
dayset-trash=[MONDAY]
b. To create custom holidays you need to create a Jolly Day XML file also placed in `$OH_CONF/services`. The name of the file doesn't really matters so long as it has the `.xml` extension. It should look something like:
<?xml version="1.0" encoding="UTF-8"?>
<tns:Configuration hierarchy="us" description="United States"
    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="MARCH" day="20" descriptionPropertiesKey="Rich Birthday" />
        <tns:Fixed month="MARCH" day="27" descriptionPropertiesKey="Son's Birthday" />
        <tns:Fixed month="JUNE" day="12" descriptionPropertiesKey="Wife's Birthday" />
        <tns:Fixed month="DECEMBER" day="27" descriptionPropertiesKey="Anniversary" />
        <tns:FixedWeekday which="FIRST" weekday="TUESDAY" month="NOVEMBER" descriptionPropertiesKey="Election Day"/>
    </tns:Holidays>
</tns:Configuration>

dayset-school isn’t a standard dayset so this almost certainly is comming from $OH_CONF/services/ephemeris.cfg. So that’s the file you should edit. If you don’t care about this dayset, you can do the following:

  1. Stop OH
  2. Delete $OH_USERDATA/config/org/openhab/ephemeris.config and delete any other ephemeris file you may have added to this folder.
  3. Delete $OH_CONF/services/ephemeris.cfg
  4. Start OH
  5. Navigate to Settings → Ephemeris and reconfigure your region.

If you do care about the school dayset:

  1. Stop OH
  2. Edit $OH_CONF/services/ephemeris.cfg using the syntax shown above. Make sure to include all the regional propertles.
  3. Optionally delete $OH_USERDATA/config/org/openhab/ephemeris.config.
  4. Start OH
  5. Verify there is no more error in the logs and that your regional settings are reflected in Settings → Ephemeris.

Thanks for the detailed explanation! It’s quite clear to me that my installation has accumulated quite some trash during the years, seems there is a little cleanup needed…

Just to be clear, are the files in $OH_USERDATA/config based on a combination of .cfg files (from both $OH_USERDATA/config and /etc/openhab/services?) and settings made in GUI?

Yes with the caution that it’s either or, not both (for each individual file).

If you put a .cfg file in $OH_CONF/services, that file will override anything you do in the UI. Any changes you make in the UI where there isn’t a cfg file overriding it, will get saved to the config file in $OH_USERSDATA.

In both cases, it’s OH that populates the config files in $OH_USERDATA, not us humans.

1 Like

Ok! And if I find things in /etc/openhab/services which don’t seem to have any corresponding settings in GUI (like pushover.cfg) then those settings belong to bindings (obviously Pushove binding in this case) which isn’t possible to configure in GUI?

Also still not sure where .cfg files in /var/lib/openhab/etc fits in all this, they seem to be files that comes with the distro? Many of them seems to be untouched since many years here though, could that be configurations that are no longer relevant?

All bindings that are a part of OH proper are configurable through the UI. For Pushover you’d create a Thing and that’s where you’d config the account info and such. That .cfg is probably old and, at least according to the docs, no longer used. Since it’s not being used it’s not causing any harm, but it’s also not doing anything.

Ephemeris I think is the very last thing that requires configuration from files, not counting some odd bindings on the marketplace perhaps. Bindings are all configured through Things.