Sunrise and Sunset may run twice

I have HA with appdaemon everything on last versions (stable).

I use an automation to activate a listen_state (movement sensor) at sunset and remove it at sunrise.

For few days I had been searching why some morning, the movement sensor was still listened, whereas in the logs, it was clearly printed as " deactivated " by my custom logs.

This morning, I have seen in my logs something very strange:

2021-06-01 05:51:15.019427 INFO couloir_night: Deactivating listening on binary_sensor.presence_9 for fbbabe74df9e428b9e2741c6e3836b6b
2021-06-01 05:51:15.022240 INFO couloir_night: Deactivating.
2021-06-01 05:51:15.025255 DEBUG couloir_night: Canceling listen_state for couloir_night
2021-06-01 05:51:15.146007 INFO couloir_night: Deactivating listening on binary_sensor.presence_9 for None
2021-06-01 05:51:15.148977 INFO couloir_night: Nothing to deactivate.

It seems that for no reason the deactivation at sunrise has been called two times.

My initialize is:

    def initialize(self):
        """Launch the routine at each appdaemon start."""

        self.log(
            f"Starting our timer move scene intelligence for {self.args['scene_on']} "
            f"based on movements for {self.args['presence_sensor']}. Only at night ? "
            f"{self.args['only_night']}"
        )

        if self.args["only_night"]:
            self.log("Activation will occure at sunset and deactivation at sunrise")
            self.run_at_sunset(self.register_listen_state)
            self.run_at_sunrise(self.deregister_listen_state)
        else:
            self.register_listen_state()

and the deregister_listen_state callback is:

    def deregister_listen_state(self, _kwargs=None):
        """Will deregister the listen_state."""
        self.log(
            f"Deactivating listening on {self.args['presence_sensor']} for {self.state_listened}"
        )
        if self.state_listened:
            self.log("Deactivating.")
            self.cancel_listen_state(self.state_listened)
            self.state_listened = None
        else:
            self.log("Nothing to deactivate.")

The fact that the activation of listen_state would have been called the other days two times would clearly explain why the deactivation was not working : I was then only deactivating once the listen_state.

I have put a control to only activate if it is not already activated, as a workaround:

    def register_listen_state(self, _kwargs=None):
        """Will register the listen_state."""
        self.log(
            f"Activating listening on {self.args['presence_sensor']}, "
            f"the scene used will be {self.args['scene_on']}"
        )
        if not self.state_listened:
            self.state_listened = self.listen_state(
                self.launch_scene_and_schedule_stop, self.args["presence_sensor"]
            )
            self.log("Activation complete")
        else:
            self.log("Nothing to do, already activated.")

It is not a big problem since I found a workaround, however, this behavior is strange to me.
Have you ever encountered this issue?

I confirm the bug. Last night, the on sunset tried to activate twice:

2021-06-01 21:25:50.033536 INFO couloir_night: Activating listening on binary_sensor.presence_9, the scene used will be scene.couloir_nuit_on
2021-06-01 21:25:50.039359 INFO couloir_night: Activation complete
2021-06-01 21:25:50.471276 INFO couloir_night: Activating listening on binary_sensor.presence_9, the scene used will be scene.couloir_nuit_on
2021-06-01 21:25:50.473589 INFO couloir_night: Nothing to do, already activated.