Hi y’all,
I have tried both run_every
and run_hourly
but they never trigger the callback.
I know, there are several threads about it, but it doesn’t help me at all. I can’t understand why my code would not work.
I can call my class from HA and it runs all fine, so the rest of the class is properly working.
This is my latest init code:
class UpdateDisplay(Hass):
def initialize(self):
self.listen_event(self.generate_chart, CHART_EVENT)
# round to the next full hour
t = datetime.now()
t -= timedelta(minutes = t.minute, seconds = t.second, microseconds = t.microsecond)
t += timedelta(hours = 1)
self.log(f'Starting hourly from {t}')
self.run_every(self.generate_chart, t, 60*60)
def generate_chart(self, event, data, kwargs):
# Do stuff
The timestamp looks proper in the logs, no complaints about the run_every
being faulty. But still no hourly runs.
It would be nice to get the scheduling completely encapsulated in the class instead of relying on HA to do that.
Help, pretty please