Automation to turn lights on 10 minutes before sunset not working

Hi. I have set a seemingly simple automation to turn the lights on 10 minutes before sunset. Using the trigger “Sunset” and I set the offset to “-00:10:00”. However, it does not work. Can anyone tell me what I am doing wrong? Thank you!

Not without seeing your (correctly formatted for the forum) automation config.

Also check your system location, height, time and time zone are correct. And the time zone on your host machine.

Does it trigger at all? Can you provide a trace of the execution of the automation?

Hi @tom_l . I am moderately computer literate but I am very new to HA and so far have only used the friendly interface. I have not ever used the YAML but I just figured out how to see that. It is attached. Is this what you were asking for and is it helpful? Thank you.

Yes and no. In future please do not post pictures of text. Paste the text and format it correctly as per the link above.

The automation looks of so you need to check the other things:

Hi @lordwizzard . I am new so unsure how to see that. It does run if I take out the “-00:10:00” offset. Meaning if I leave it just to run at sundown then it works. However I can not get it to run 10 Minutes before sundown. Thanks!

Ah!

Ok, try: “-0:10:00” as the offset.

EDIT: nope that’s not it. The instructions say “hh:mm:ss”.

Good idea! I can’t believe I did not think of that! Ok, I just updated it. Will see if it triggers tonight and report back. Thanks so much for the idea!

I just edited my post. That’s not the issue.

Your automation looks correct. The trigger you used is almost identical to the one shown in the example here: Automation Trigger - Home Assistant

Next thing is to check the trace….

Trouble is if it does not trigger with an offset defined there will be no trace.

You are correct. I do not see a trace for any day that I have the offset defined. There is only one for days where I had deleted the offset :frowning:

Ok this is strange. I did not want to wait to test it so I set it to -18:11:00 offset (how long till sunset is where I am at) and it triggered perfectly. I just updated HA so maybe that fixed it? I will test it again tonight and report back. Thank you!

If you still can’t get it to work:

2 Likes