Run_at_sunset is called multiple times

I am trying to implement a simple sunset/sunrise app that turns on or off lights.

Problem is, it runs several times when the sun sets, 5 or 6 times to be exact.

This is a scaled down version of my app:

def initialize(self):
    self.log("Initializing dusk/dawn module")
    self.run_at_sunrise(self.lights_off, offset = 60*60)
    self.run_at_sunset(self.lights_on, offset = -60*60)
    
def lights_off(self, entity):
    self.log("Sun is up!")
    self.turn_on('input_boolean.day')

def lights_on(self, entity):
    self.log("Sun is down!")
    self.turn_off('input_boolean.day')

Why is self.run_at_sunset(self.lights_on, offset = -60 * 60) being called more than once?
self.run_at_sunrise(self.lights_off, offset = 60 * 60) works as expected.

i cant imagine why.
i use it too, but no problems.

i think it would be helpfull to show your logs.

Should i run Appdaemon with any particular debug options?

The only thing thats really being printed in the logs is the one i put there myself, which logs when the sun goes up and down, the latter which appears several times

error log and appdaemon log.
its helpfull to see if there is no error and how long is between the triggers.

If i run appdaemon from the command line with this in my appdaemon.yaml

AppDaemon:
  logfile: STDOUT
  errorfile: STDERR

it would output both the log and error file to the command window right?

If so this is how it looks, no indication of any errors.

2017-07-22 05:11:12 INFO day: Sun is up!
2017-07-22 20:37:31 INFO day: Sun is down!
2017-07-22 20:45:30 INFO day: Sun is down!
2017-07-22 20:57:13 INFO day: Sun is down!
2017-07-22 21:08:56 INFO day: Sun is down!
2017-07-22 21:20:39 INFO day: Sun is down!
2017-07-22 21:32:21 INFO day: Sun is down!
2017-07-23 05:12:50 INFO day: Sun is up!
2017-07-23 20:35:27 INFO day: Sun is down!
2017-07-23 20:42:42 INFO day: Sun is down!
2017-07-23 20:54:10 INFO day: Sun is down!
2017-07-23 21:05:38 INFO day: Sun is down!
2017-07-23 21:17:06 INFO day: Sun is down!
2017-07-23 21:28:33 INFO day: Sun is down!
2017-07-24 05:14:58 INFO day: Sun is up!

I ran this using time travel to get a few samples

could be a time travel problem.

this is very strange behaviour, which i have no explanation for.
@aimc can you explain this?

What time travel arguments are you using?

been using -t 0 in these tests

This also happens when i run normally without timetravel