Moon phase changed

The Moon phase changed trigger fires when the moon moves into a new phase, such as from waxing gibbous to full moon. Home Assistant works the phase out from the date, so the trigger needs no account, no internet connection, and no location.

Use it to follow the rhythm of the lunar month in your home, for example to send a notification on the night of a full moon, play a scene at every new moon, or start a garden routine when the moon reaches its first quarter.

Using this trigger from the user interface

If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.

To use this trigger in an automation:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the When section, select Add trigger.
  4. From the search box, search for and select Moon phase changed.
  5. Under Phase, keep Any to trigger on every phase change, or select a single phase to trigger only when the moon enters that phase.
  6. Select Save.

Options in the UI

Phase

Which phase change fires the trigger:

  • Any: every time the moon enters a new phase. This is the default.
  • A specific phase, such as Full moon or New moon: only when the moon enters that phase.

Using this trigger 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 trigger as moon.phase_changed. A basic example looks like this:

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
trigger: moon.phase_changed

This fires whenever the phase changes. To trigger on a single phase, add the phase option:

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
trigger: moon.phase_changed
options:
  phase: full_moon

Options in YAML

phase string

Limits the trigger to a single moon phase. Accepts any (every phase change) or one of new_moon, waxing_crescent, first_quarter, waxing_gibbous, full_moon, waning_gibbous, last_quarter, or waning_crescent.

Good to know

  • This trigger does not use a target. It follows the moon phase, which is the same everywhere on Earth, so it does not depend on your home location.
  • The phase is based on the date, so the trigger fires at most once a day, when the phase changes.
  • With a specific phase selected, the trigger fires the moment the moon enters that phase, not for the whole time the moon stays in it. To check whether the moon is currently in a phase, use a state condition for sensor.moon instead.

Try it yourself

Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, then change the state of the targeted entity to watch the trigger fire on your actual entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more].

For this trigger, there is no target entity to change. To test it, wait for the next phase change, or temporarily switch to a trigger you can control while you build the rest of the automation.

More examples

Real scenarios where this trigger fires in automations and scripts. Copy any example and adapt it to your setup.

Tip

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: run a scene on the full moon

When the moon turns full, activate a moonlit scene in the living room.

  • Trigger: Moon phase changed
    • Phase: Full moon
  • Action: Activate scene
    • Target: Full moon scene
YAML example for a full moon scene
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Full moon scene"
triggers:
  - trigger: moon.phase_changed
    options:
      phase: full_moon
actions:
  - action: scene.turn_on
    target:
      entity_id: scene.full_moon

Still stuck?

The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the trigger you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.

Tip

AI assistants like ChatGPT or Claude can also explain triggers or suggest the right one when you describe what you want in plain language.