Call every 5 minutes, multiples 5

Hi.
I have the following app which writes a message every 5 minutes:

import appdaemon.plugins.hass.hassapi as hass 
import datetime

class write_record(hass.Hass):

  def initialize(self):
     self.run_every(self.run_every_c, datetime.datetime.now(), 5 * 60)

  def run_every_c(self, kwargs):
     self.log("record inserted")

It works, but I would like the message to be written when the minutes are multiples of 5. For example, if the app runs at 09:43, I would like the first message to be written at 09:45, the second at 09:50 , the third at 09:55 …
Probably you need to initialize the date correctly, in “def initialize (self) -> datetime.datetime.now ()”, but I don’t know how. Can anyone help me?

1 Like