Moon phase

The Moon phase condition passes when the moon is currently in the phase you choose, such as full moon or new moon. Home Assistant works the phase out from the date, so it needs no account, no internet connection, and no location.

Use it to gate an automation on the lunar month, for example to only run a scene on the night of a full moon, or to skip a routine unless it is a new moon.

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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the And if section, select Add condition.
  4. From the search box, search for and select Moon phase.
  5. Under Phase, select the phase to test for.
  6. Select Save.

Options in the UI

Phase

The moon phase the condition tests for. Select one of the eight phases, from New moon through Full moon to Waning crescent.

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 moon.is_phase. Set the phase to test for with the phase option:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
condition: moon.is_phase
options:
  phase: full_moon

This passes while the moon is a full moon.

Options in YAML

phase string Required

The moon phase to test for. Accepts one of new_moon, waxing_crescent, first_quarter, waxing_gibbous, full_moon, waning_gibbous, last_quarter, or waning_crescent.

Good to know

  • This condition does not use a target. It checks the moon phase, which is the same everywhere on Earth, so it does not depend on your home location.
  • This is a point-in-time check. It reflects the phase at the moment the automation runs.
  • The phase is based on the date, so it changes at most once a day.
  • To test the direction the moon is heading rather than a single phase, use Moon is waxing or Moon is waning.

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.

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: full moon garden lights

When motion is detected in the garden after dark, turn on the garden lights, but only on the night of a full moon.

  • Trigger: State
    • Entity: Garden motion binary sensor
    • To: On
  • Condition: Moon phase
    • Phase: Full moon
  • Action: Turn on light
    • Target: Garden lights
YAML example for full moon garden lights
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Full moon garden lights"
triggers:
  - trigger: state
    entity_id: binary_sensor.garden_motion
    to: "on"
conditions:
  - condition: moon.is_phase
    options:
      phase: full_moon
actions:
  - action: light.turn_on
    target:
      entity_id: light.garden

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.

Tip

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: