Why is there no sunrise/sunset event?


(Timothy O Connor) #1

I’m looking at the Sunrise/Sunset smartapp, and it’s really annoying how so much of the event generation logic has been offloaded into the smartapp itself. Why can’t I just attach an event handler for sunset or runrise event using a typical subscribe()?

We should have this capability for a number of time/astronomical features, such as day of week, season, etc.


(Florian Z) #2

I totally agree, but ultimately what you would want is this: http://build.smartthings.com/forums/topic/smartlibrary-shared-library-code/
That way, SmartThings (or someone else) could provide a library which encapsulates these frequently used patterns to promote code sharing and keep SmartApps as succinct as possible.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #3

Great idea, and, yes, this now has been added to the Platform:

http://docs.smartthings.com/en/latest/smartapp-developers-guide/sunset-and-sunrise.html

… CP / Terry.