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 native support for Sunrise/Sunset #93

Closed
spacemanspiff2007 opened this issue Nov 30, 2019 · 10 comments
Closed

Add native support for Sunrise/Sunset #93

spacemanspiff2007 opened this issue Nov 30, 2019 · 10 comments

Comments

@spacemanspiff2007
Copy link
Owner

spacemanspiff2007 commented Nov 30, 2019

Calculation can be done through the Astral package

@spacemanspiff2007
Copy link
Owner Author

@NickWaterton I've done some refactoring of the scheduler. Would you be willing to test the current dev branch? There is a new function to run on sunrise, sunset, etc.

@NickWaterton
Copy link

Ok, i just pulled the dev branch, it says it's V0.10.1 which what I already have (but I'm on the dev branch now).

Everything started up OK. No errors.

What would you like me to test?

@spacemanspiff2007
Copy link
Owner Author

I forgot to update the version number on the dev branch - sorry.
Could you take a look at the scheduler, if the triggers get executed as expected.
Also you can play around with the sun scheduler.
The scheduled objects now have a "earliest", "latest", "offset" and "jitter" method which will modify the next call time the next scheduled call or after the "update_run_time" method.

@NickWaterton
Copy link

NickWaterton commented Dec 11, 2019

OK, everything is working right now.
I've added a sunset and sunrise event, I'll see what happens. I was using the astro binding for this, but this would be easier.

Just FYI, I have just completed conversion of 370 OH rules to HABApp! Only a few left (difficult ones though).

@spacemanspiff2007
Copy link
Owner Author

Just FYI, I have just completed conversion of 370 OH rules to HABApp! Only a few left (difficult ones though).

Oh wow - you sure have lots of them!

@NickWaterton
Copy link

Most of them are one-liners, as OH forces you to have a rule for everything...

So I have been testing sunrise and sunset events. No Sunset event yet (even at sunset), but I did get a sunrise event:

HABApprules.log.1:2019-12-12 00:49:44,008[           MyRule.TestRule] INFO|        sunrise_func: SUNRISE EVENT!

Notice it's logged at 00:49:44 ie 10 to 1 in the morning. looks like a TimeZone issue (I'm in Eastern).
This is probably why I haven't had a sunset event yet, I expect it'll show up at noon ish.

@spacemanspiff2007
Copy link
Owner Author

Have you set the correct location in the habapp.yml?
I forgot to tell you about it 😕

@NickWaterton
Copy link

NickWaterton commented Dec 12, 2019

Probably not, I was thinking it would use the environment variables. I'll go check it now.

Ok where is habapp.yml? I don't see it anywhere. i have config.yml is this a different file?

OK, ignore me, I assume it's lat/lon in config.yml right?
All set to 0.0, so I'll update...

@NickWaterton
Copy link

Sunset event just occurred right on schedule...

@spacemanspiff2007
Copy link
Owner Author

Sorry, sometimes I don't remember the right filenames 😦
Perfect - noticed any other inconsistencies with the scheduler?

spacemanspiff2007 added a commit that referenced this issue Dec 19, 2019
- Added _last_change and _last_update to item and created property which returns timezone naive obj
- Item value get properly set if they return a unit
- Added support for ThingStatus events
- Added fixes and tests for QuantityType
- Added mapping of QuantityType (fixes #94)
- Scheduler fixes
- Added scheduler for Sunrise/Sunset/etc (closes #93)
- Internal Timestamps are all utc now
- Added location config
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

No branches or pull requests

2 participants