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

Extend crontab value to eval expression? #478

Open
bmxp opened this issue Feb 25, 2022 · 3 comments
Open

Extend crontab value to eval expression? #478

bmxp opened this issue Feb 25, 2022 · 3 comments

Comments

@bmxp
Copy link
Member

bmxp commented Feb 25, 2022

There is the wish to extend the existing crontab expression with an eval to react on a ubiquitous expression like eval.

syntax could be like

crontab:
    - sunset+20m = 1
    - 45 7 * * = False if shtime.is_holiday(shtime.now()) or shtime.is_weekend(shtime.now())) else None
    - 30 10 * * = True if (shtime.is_holiday(shtime.now()) or shtime.is_weekend(shtime.now())) else None

Any further ideas regarding this?

@onkelandy
Copy link
Member

Evals are always good ;)

Anyhow for the specific use case.. what about having a "7" for day in week to assign a "holiday"?
e.g. 30 10 * 5,6,7 = 0
-> weekend & holiday

@bmxp
Copy link
Member Author

bmxp commented Feb 26, 2022

The problem with extending with a day like 7 is that there is no mechanism to

  • exclude days
  • is hard to understand

Have a look at a situation where someone needs to open the blinds every morning, except for e.g. Easter Monday but also on Easter Sunday (has to work then :-)).
With an eval that could be solved. I don't see how we could introduce a 7 or 8 then...

Thanks for your thoughts!

@onkelandy
Copy link
Member

Sure, if you want to define that quite detailed you need an eval. Just thought a "7" might be quite intuitive for "all holidays in general" because that might also be a relevant use case and is easier then evals (just additionally).

@bmxp bmxp added this to the Version 1.10 milestone Apr 30, 2022
@Morg42 Morg42 modified the milestones: Version 1.10, Version 1.12 Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants