Hi, I want to start a function with an offset after the sunrise and sunset. But I have the problem, I don’t know how to use the run_at_sunrise, run_at_sunset or the run_daily function properly.
Therefore, I made app to test these functions.
import appdaemon.plugins.hass.hassapi as hass
import datetime
class test_class(hass.Hass):
def initialize(self):
self.log("Test initialized at {}".format(self.time()))
self.run_daily(self.log_sunrise_sunset, "19:40:00")
self.run_daily(self.log_daily, self.sunrise(today=True) + datetime.timedelta(minutes = 30))
self.run_daily(self.log_daily, self.sunrise())
self.run_daily(self.log_daily, "sunrise + 02:00:00")
self.run_daily(self.log_daily, "sunrise")
self.run_at_sunrise(self.log_runat)
self.run_at_sunrise(self.log_runat, offset = 8460)
self.run_at_sunrise(self.log_runat, offset = datetime.timedelta(minutes = -45).total_seconds())
def log_sunrise_sunset (self, kwargs):
self.log("sunrise at {}, sunset at {}".format(self.sunrise(), self.sunset()))
def log_daily (self, kwargs):
self.log("daily")
def log_runat (self, kwargs):
self.log("run at")
The system initializes without an error and starts the log_sunrise_sunset function correctly at 19:40:00.
But no function with run_daily or run_at_sunrise is working.
I hope I made a stupid mistake you can tell me