Automating Home Assistant (2024)

Once your devicesA device is a model representing a physical or logical unit that contains entities. are set up, it’s time to put the cherry on the pie: automationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home.
[Learn more]
. We’re going to create a simple automation to turn on the lights when the sun sets. Of course, this assumes that you have set up an integration that provides a light at this point.

Automatically turn on the lights before sunset

  1. Go to Settings > Automations & scenes and in the lower right corner, select the Create Automation button.

    Automating Home Assistant (1)

  2. The first step is defining what should triggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run.
    [Learn more]
    the automation to run.

    • In this case, we want to use the event of the sun setting to trigger our automation.
    • Select Add trigger, type Sun and select it.Automating Home Assistant (3)
  3. Select Sunset.

    • We want the automation to be triggered a little before that, so let’s add -00:30 as the offset. This indicates that the automation will be triggered 30 minutes before sunset. Neat!

    Automating Home Assistant (4)

  4. Once we have defined our trigger, we need to define what should happen.

    • Select Add action.
    • Type Ser and select Call service
  5. Select Light > Turn on or directly enter light.turn_on.

    • For this automation, we’re going to turn on all lights in the living room, so let’s select the Area.
    • This only works if your lights are assigned to an areaAn area in Home Assistant is a logical grouping of devices and entities that are meant to match areas (or rooms) in the physical world: your home. For example, the living room area groups devices and entities in your living room..

    Automating Home Assistant (5)

  6. To save the automation, select Save, give the automation a name and Save again.

    • Now wait till it’s 30 minutes until the sun sets and see your automation magic!

Presence detection

If after completing this getting started you are interested in reading moreabout automations, we recommend the following pages:

Please note, these pages may require a bit more experience with Home Assistantthan you probably have at this point of this tutorial.

Help us to improve our documentation

Suggest an edit to this page, or provide/view feedback for this page.

Automating Home Assistant (2024)
Top Articles
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 5983

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.