Really like the built-in sun_down and sun_up functions. I often find myself wanting to add an offset though, any easy way to do that? Maybe this is a feature request?
sun_down and up are just times.
so you can easy calculate with that like:
self.sundown() - datetime.timedelta(minutes=30) or
self.sunrise() + datetime.timedelta(hours=1)
if you use the same offset over and over, you could create a general function:
self.mysunrise(self):
return self.sunrise() + datetime.timedelta(hours=1)
edit: or even with your own flexible offset:
self.mysunrise(self,offset):
return self.sunrise() + datetime.timedelta(seconds=offset)
1 Like
Thank you both! (Have I said it lately? I love AppDaemon!!! )
2 Likes
i didnt even think of that one.
guess thats because i mostly use time in my triggers and constraints.
2 Likes
I just use something like this
self.run_at_sunrise(self.sunrise_cb, offset=+300)
1 Like