Lights off for Earth Hour

Earth Hour tomorrow evening encourages us to give an hour for Earth and switch off non-essential electric lights, for one hour from 8:30 to 9:30 PM.

Sounds like a perfect opportunity to automate this :slight_smile:

As a precondition, you have to add date and time sensors: Time & Date - Home Assistant

  • Trigger: time sensor
  • Condition: date sensor matches tomorrow’s date
  • Actions:
    1. Disable my automation that switches the lights on when I come home after sunset
    2. Turn on the “lights off” scene
    3. Wait one hour
    4. Enable the “welcome light” automation again
    5. If I’m home, then turn on the “evening lights” scene
alias: Lights off for Earth Hour
description: ""
triggers:
  - trigger: time
    at: "20:30:00"
conditions:
  - condition: state
    entity_id: sensor.date
    state: "2025-03-22"
actions:
  - action: automation.turn_off
    metadata: {}
    data:
      stop_actions: true
    target:
      entity_id:
        - automation.welcome_light
  - action: scene.turn_on
    metadata: {}
    data:
      transition: 10
    target:
      entity_id: scene.lights_off
  - delay:
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
  - action: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.welcome_light
  - if:
      - condition: state
        entity_id: person.flo
        state: home
    then:
      - action: scene.turn_on
        metadata: {}
        data:
          transition: 10
        target:
          entity_id: scene.evening_lights
mode: single

See also this blog post about an earlier attempt: https://bensmann.no/earth-hour-automating-lights-in-our-smart-home/

3 Likes

Delaying in an automation for an hour is not a good idea. There is a not insignificant chance that it could be interrupted. Better to trigger it at the times required, e.g.

alias: Lights off for Earth Hour
description: ""
triggers:
  - trigger: time
    at: "20:30:00"
    id: "off"
  - trigger: time
    at: "21:30:00"
    id: "on"
conditions:
  - condition: state
    entity_id: sensor.date
    state: "2025-03-22"
actions:
  - action: "light.turn{{ trigger_id }}"
    target:
      entity_id: light.all_lights
mode: single

You don’t have to use a template, you can use a choose action instead.

alias: Lights off for Earth Hour
description: ""
triggers:
  - trigger: time
    at: "20:25:00"
    id: "warning"
  - trigger: time
    at: "20:30:00"
    id: "off"
  - trigger: time
    at: "21:30:00"
    id: "on"
actions:
  - action: choose
      - conditions:
          - condition: trigger
            id: "warning"
        sequence:
          - action: notify.telegram_general
            data:
              title: '⚠️ <b>Earth Hour Soon</b>'
              message: "Reminder in 5 minutes all the lights will turn off for Earth Hour."
      - conditions:
          - condition: trigger
            id: "off"
        sequence:
          - action: # off actions here
      - conditions:
          - condition: trigger
            id: "on"
        sequence:
          - action: # on actions here
mode: single
5 Likes