smarthome
smarthome copied to clipboard
Extend crontab value to eval expression?
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?
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
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!
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).