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

Add sunset and sunrise variables... #1507

Merged
merged 2 commits into from Jun 17, 2018

Conversation

Projects
None yet
2 participants
@stelas
Copy link
Contributor

commented Jun 17, 2018

...for use in rule scripts as addition to time formulas. Calculation is based on geographic location which is configurable in advanced settings. Used algorithm is a tradeoff between computation time and accuracy. Both variables output a string value.

@TD-er

This comment has been minimized.

Copy link
Member

commented Jun 17, 2018

That's some well programmed PR :)
I will merge it. We have to add some rules way to add an offset (in minutes I guess) to allow rules also operate on sunrise/sunset with some offset.
For example here in the Netherlands we don't have to switch on lights until 30 minutes after sunset, while I've noticed in countries like Greece this twilight time period to be a lot shorter.

@TD-er TD-er merged commit c7c46d2 into letscontrolit:mega Jun 17, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@TD-er

This comment has been minimized.

Copy link
Member

commented Jun 17, 2018

Also added some basic documentation to the wiki

@stelas

This comment has been minimized.

Copy link
Contributor Author

commented Jun 22, 2018

Mhhh... another idea for a solution on the long run.

Currently variables are implemented either as strings or floats. So on actions e.g. "Clock#Time=All,%sunset%" is usable, but not a comparation like "%sunset%>18:00".

If all time variables are internally handled as timestamps and with some macros for string conversation, there would be no further distinction between both cases needed...

In this way, the suggested offset could be added or subtracted in the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.