Sun is descending
The Sun is descending condition passes while the sun is sinking. This happens during the half of the day between solar noon and solar midnight when the sun’s elevation is decreasing. Home Assistant works this out from your home location.
Use it to tell afternoon and evening apart from the morning without picking a clock time. For example, run a routine only while the sun is on its way down, regardless of the season.
Using this condition from the user interface
If you prefer building automations visually, Home Assistant walks you through this condition step by step. You pick what to check, tweak a few options, and save. No YAML knowledge required.
To use this condition in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the And if section, select Add condition.
- From the search box, search for and select Sun: Sun is descending.
- Select Save.
Using this condition in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this condition as sun.is_descending. It has no options:
condition: sun.is_descending
This passes while the sun is sinking toward solar midnight.
Good to know
- This condition does not use a target. It checks the sun at your configured home location.
- Descending covers the whole sinking half of the day, from solar noon down to solar midnight, including the hours after sunset. It is not limited to daylight. Combine it with Sun is up if you only want the descending daytime hours.
- For the opposite half of the day, use Sun is ascending.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, open an automation, and add this condition. Trigger the automation with and without the condition met, and watch whether it continues or stops.
More examples
Real scenarios where this condition gates an automation. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: lower the awning only in the afternoon
When the patio gets hot, lower the awning, but only while the sun is descending, so it reacts to the afternoon sun rather than a warm morning.
- Trigger: Patio temperature rises above a threshold
- Condition: Sun: Sun is descending
-
Action: Close cover
- Target: Patio awning
YAML example for afternoon-only awning
alias: "Lower awning on a hot afternoon"
triggers:
- trigger: numeric_state
entity_id: sensor.patio_temperature
above: 28
conditions:
- condition: sun.is_descending
actions:
- action: cover.close_cover
target:
entity_id: cover.patio_awning
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the condition you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain conditions or suggest the right one when you describe what you want in plain language.
Related conditions
These conditions work well alongside this one:
-
Sun is ascending: Tests if the sun is ascending.
-
Sun is set: Tests if the sun is set.
-
It is evening twilight: Tests if it is evening twilight, optionally of a specific type.