used to be in the older version, when you added a trigger for sunrise , sunset, you could include a +/- offset if you wish. I don’t see how to do that now.
You can do it in YAML using the exact code that has always worked. It got lost from the UI with this release but rumors are that was an oversight, and a replacement is in the works.
My suggestion is find somewhere that it used to work or currently works, and add it manually in YAML mode using that as your template. (Or wait until they put it back in in whatever form it arrives in…)
ahh, the AI answer that worked (gemini)
Ah, my apologies! Home Assistant shifted how the sun trigger is structured in a recent update. It now uses a modern trigger: sun format with an event key, rather than trigger: sun.sunset. Because you have trigger: sun.sunset, it isn’t recognizing the modern offset key correctly.
Change the text in your right-hand YAML code block to look exactly like this:
YAMLtrigger: sun event: sunset offset: "-00:30:00"
Why this happens
The older style (trigger: sun.sunset) treats “sun.sunset” as a shortcut that doesn’t accept extra modifiers like offset natively in the newer UI editor schema. Splitting it into trigger: sun and event: sunset will clear that malformed error right up!
Well, sort of.
sun.sunset is the modern trigger.
The offset works only with the old trigger, which is the trigger: sun format.
There is activity underway to add the offset functionality into the new triggers:
All I can do is paste you this and you extract the rest. I’m still adjusting it.
trigger: template
value_template: |
{% set elevation = state_attr(‘sun.sun’, ‘elevation’) | float(-90) %}
{% set rising = state_attr(‘sun.sun’, ‘rising’) | bool %}
{{ rising and elevation >= -4 }}
not sure what that would be, (my guess is you refer to the purpose specific triggers just out of the experimental phase
)
but according to the current documentation this is the sun trigger
automation:
triggers:
- trigger: sun
# Possible values: sunset, sunrise
event: sunset
# Optional time offset. This example will trigger 45 minutes before sunset.
offset: "-00:45:00"
unfortunately those purpose specific triggers are hard to find in the docs..
anyways the documented style is very much modern and supported/should work
edit
here is the list of all Triggers - Home Assistant as announced in the 2026.7 release notes
The one through the UI currently only provides what @mekaneck posted.
Yeah, I also listed those in my edit above.
Somehow when looking in the Automations link, there is no pointer to the newly added purpose specific triggers… not even when you click through. Which doesnt help spread the news.
But, reason I posted, was that the original trigger OP used should still be valid. If that doesnt trigger, something else must be off
maybe I misread myself, and OP only found that the offsets didnt yet work…
o well. they soon will in that case
This is a known issue, the old sun trigger isn’t available in the ui. Still works via yaml, as stated above,
If I understand the new triggers correctly, in order to trigger “after sunset” using elevation, I must specify that the sun crossed below the -2.2 threshold and is in the setting direction. Without the condition for direction, it would fire again near sunrise. My former “10 minutes after sunset” automation would end up like this with the new triggers (as generated in the UI):
triggers:
- trigger: sun.elevation_crossed_threshold
options:
for: "00:00:00"
threshold:
type: below
value:
active_choice: number
number: -2.2
conditions:
- condition: sun.is_descending
options: {}
actions:
- action: script.outdoor_lights_on
metadata: {}
data: {}
mode: restart
I don’t think the condition is necessary in that case, since the “below” type threshold is only crossed as the sun is descending. In the morning the threshold that gets crossed is the “above” type.
The condition is necessary if you use the other trigger, sun.elevation_changed with the “any” type.
