Skip to content

run_once with sunset times runs daily #2535

@Pythm

Description

@Pythm

What happened?

Using run_once with clock based times "00:00:00" runs only once as expected, but using solar based time "sunset + 01:00:00" it executes daily. The time is adjusted every day. Have not tested with sunrise.

Version

4.5.14

Installation type

Docker container

Relevant log output

2026-01-28 19:13:47.587704 DEBUG test_me: Registering run_at_sunset at 2026-01-28 19:20:12.319469+01:00 with (), {}
2026-01-28 19:13:47.589586 INFO test_me: run_once_test at sunset + 02:40:00
2026-01-28 19:20:12.324456 INFO test_me: run once executed
2026-01-29 19:22:50.555020 INFO test_me: run once executed
2026-01-30 19:25:29.416890 INFO test_me: run once executed

Relevant code in the app or config file that caused the issue

class Test(ad.ADBase):
    
    def initialize(self):
        self.checkTimesinAutomations('sunset + 02:40:00')

    def checkTimesinAutomations(self, time) -> None:

        self.ADapi.run_once(self.run_once_test, time)
        self.ADapi.log(f"run_once_test at {time}")

    def run_once_test(self, **kwargs) -> None:
        self.ADapi.log(f"run once executed")

Anything else?

Pasted a test code and the log output. Let me know if you need anything else

Metadata

Metadata

Assignees

No one assigned

    Labels

    issueSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions