-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support variables in offset before/after sun times #6
base: master
Are you sure you want to change the base?
Conversation
This would be extremely useful. Why is this pull request still pending? |
I don't know... Maybe no one is reviewing PRs on this repo... |
@sweetpi Could you tell us the status of this repo? |
Sorry guys, I have missed this one. I'll take care of this soon. EDIT: I have just quickly reviewed the code. It will take some time for me to review and cleanup the contributed code as more than necessary changes have been done. EDIT2: I'll also need to do some tweak to ensure backwards compatibility. Thus we need to keep "its" with a number which is ugly, but I don't think it possible to fully resolve the conflict with pimatic-cron at this point. |
Thanks mwittig for taking a look at this PR. Is there anything I could do to help speed up the process? |
See my "edit" comments included in my previous post. This needs further thought. One way of solving the ambiguity is to limit variable support to using the "at" keyword. |
Is there any progress on this topic? |
No, there has not been progress so far. Having the revisited the matter I think the best approach is to implement a new predicate provider for "time is" which then can coexist with legacy predicate provider. |
As mentioned in pimatic/pimatic#901, this PR makes pimatic-sunrise support variables in the before/after rules.
Examples:
when
$early-on minutes before sunset
thenturn living-light on
when
time is $delay minutes after sunrise
thenturn bedroom-light off
I use this to have lights turn on before sunset, depending on the cloudiness.
Using pimatic-openweather to get the cloudiness. The percentage of clouds is used to set
$early-on
to that percentage of 60 minutes.50% clouds => 30 minutes
75% clouds => 45 minutes
Variables
$max-early-on
= 60
(unit: minutes)$early-on
= round($weather-home.clouds * $max-early-on / 100)
(unit: minutes)Rules
when
$early-on minutes before sunset
thenturn living-light on