Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ephemeris.WeekdayCondition off by a number of hours #2132

Closed
DanielMalmgren opened this issue Jan 18, 2021 · 12 comments
Closed

ephemeris.WeekdayCondition off by a number of hours #2132

DanielMalmgren opened this issue Jan 18, 2021 · 12 comments
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@DanielMalmgren
Copy link

DanielMalmgren commented Jan 18, 2021

I've noticed strange behaviour for rules set up to execute only on weekdays, they also get executed on saturday mornings. So I did a test rule doing the following:

triggers:

  • id: "1"
    configuration:
    cronExpression: 0 0 * * * ? *
    type: timer.GenericCronTrigger
    conditions:
  • inputs: {}
    id: "2"
    configuration: {}
    type: ephemeris.WeekdayCondition
    actions:
  • inputs: {}
    id: "3"
    configuration:
    type: application/vnd.openhab.dsl.rule
    script: |
    logInfo("weekday", "Today it's a week day!")
    type: script.ScriptAction

...which should write a log row every hour on week days. I haven't yet let it run a full week (I started it this sunday and now it is monday evening) but it seems the WeekdayCondition is off in some way, because it started writing log posts from 16:00 and forward. So from somewhere after saturday morning (my guess would be 16:00) to 16:00 on a monday it seems like it thinks it's weekend. Like the weekend calculation is off by 16 hours. Seems like it would be time zone related in some way? I'm in Sweden, ie +1.

Regional settings:
Country/Region: Sverige (Sweden)
Time Zone: (GMT + 1:00) Europe/Stockholm

Ephemeris settings:
Weekend days: lördag, söndag (ie saturday, sunday)
Country: Sweden

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/rule-example-engine-heater-based-on-temperature/23658/65

@DanielMalmgren
Copy link
Author

This is just getting weirder... I made two rules, one only running on weekend days, writing out "Today it's a weekend day!" to my log and one running on week days, writing out "Today it's a week day!". And then I set up both rules to run at "0 0,5,55 * * * ? *", ie every whole hour and five minutes before and after. And then I let them run.

I struggle to find any logic in my findings. It seems it turned from being a week day to being a week end at midnight between saturday and sunday, so exactly 24 hours too late. Yesterday it was monday and most of the day it claimed it to be a weekend. Some time between 18:05 and 18:55 it changed into being a week day. So somewhere around 18.5 hours too late.

It might be worth noticing that my OH server (for other reasons) was restarted somewhere around 18:30. Could it be affecting things?

@MikeJMajor
Copy link
Contributor

Have you tried disabling and then enabling your rules after OH has started?

I'm seeing an issue that after an OH restarts my rule with a weekday and time condition does not work. The rule doesn't show any error at startup or when it's supposed to run. Disabling/enabling the rule gets it working again.

@DanielMalmgren
Copy link
Author

Tried that now, it makes no difference. Today it's saturday and ephemeris.WeekendCondition still returns false and ephemeris.WeekdayCondition returns true.

Judging by the response on this issue I suspect that either I'm the only one with this problem (which makes me wonder what's special with my system) or simply nobody else is using these conditions...

@Barthoxx
Copy link

Barthoxx commented Feb 22, 2021

I actually just created an account to say I got the same problem. I have two rules, one that's set to fire on weekdays at 7am and one that's set to fire on weekends at 8am. I couldn't figure out any kind of logic behind the wrong behavior. Two weeks ago I investigated, double checked and saved the rules again. From that day on, both rules fired every day. Two days ago after reading the suggestion to disable/enable the rules, I did that. Now the weekday rule is fireing every day, the weekend rule not at all.
What I found weird from the beginning: in the schedule both rules appear for every day.

Maybe the error is related to specific ephemeris locations/timezones? I am in Germany

@DanielMalmgren
Copy link
Author

Either that, or it has something with first day of week to do. Since it says weekend is sunday and monday for me, ie the first an last day of the week. If my week should start on mondays (like in USA) it would be correct. Does that make sense?

@dae3
Copy link

dae3 commented Mar 6, 2021

@DanielMalmgren I think I'm experiencing this too. This morning (Saturday) a rule scheduled for weekdays at 6:55 AM was triggered. My location and timezone are Australia, GMT+11.

I'll setup some more logging and report the results

@dae3
Copy link

dae3 commented Mar 8, 2021

OK I'm seeing something different, apparently configuration related:

userdata/logs/openhab.log:2021-03-07 00:01:00.579 [WARN ] [emeris.internal.EphemerisManagerImpl] - This dayset is not configured : weekend

every time the rule runs, although it is configured in Settings > Ephemeris AND I can't reproduce it on a clean setup.

@Barthoxx
Copy link

Barthoxx commented Mar 8, 2021

I can't see any warnings in my logs at all and nothing related to Ephemeris. Since my last restart of openhab the weekend rule was never triggered, but the weekday rule got triggered every day, even on weekends. I did now disable/enable only the weekend rule and will observe this further.

@dae3
Copy link

dae3 commented Jul 14, 2021

After upgrading to from 3.1.0.M3 to 3.1.0 last night, my weekday-condition rules worked perfectly today. #2398 looks like it might be the solution.

@DanielMalmgren
Copy link
Author

Hmmm, I thought I'd try it out now (on 3.1.0), but now it doesn't execute those rules at all, I just get "Missing handler 'ephemeris.WeekendCondition' for module '2'". Kinda like it's even more broken now for me... Anyone knows what's happening?

@J-N-K
Copy link
Member

J-N-K commented May 14, 2022

Since the original issue seems to be solved with #2398 and Missing handler ... seems to be an configuration issue (I suggest checking if the daysets can be read properly, this should be improved with #2949), I'm closing here. Please open a new issue if the original problem occurs again.

@J-N-K J-N-K closed this as completed May 14, 2022
@J-N-K J-N-K added the bug An unexpected problem or unintended behavior of the Core label May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

No branches or pull requests

6 participants