Skip to content

Add sunset and sunrise variables...#1507

Merged
TD-er merged 2 commits intoletscontrolit:megafrom
stelas:mega
Jun 17, 2018
Merged

Add sunset and sunrise variables...#1507
TD-er merged 2 commits intoletscontrolit:megafrom
stelas:mega

Conversation

@stelas
Copy link
Copy Markdown
Contributor

@stelas stelas 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
Copy link
Copy Markdown
Member

TD-er 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
@TD-er
Copy link
Copy Markdown
Member

TD-er commented Jun 17, 2018

Also added some basic documentation to the wiki

@stelas
Copy link
Copy Markdown
Contributor Author

stelas 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants