Earth Hour: Automating Lights in Our Smart Home

As the world is gradually becoming more conscious of the environment, Earth Hour has gained popularity. Held annually on the last Saturday of March, Earth Hour encourages individuals, communities, and businesses to turn off non-essential lights for one hour. This year, I decided to automate the lights in our smart home for Earth Hour, ensuring that we don’t accidentally forget. In this blog post, I will share how I created an automation for Earth Hour that not only turned off our lights but also disabled motion based lighting automations – even the ones that I have still have running directly in Philips Hue.

Using the Home Assistant platform, I created an automation called “Earth Hour” to manage our lights during the event. This automation was triggered by a template trigger set for Earth Hour, ensuring that it would only activate at the correct time and date – and so we won’t forget it years to come.

  - platform: template
    value_template: >-
        now().strftime('%H:%M') == '20:30' and
        now().strftime('%A') == 'Saturday' and
        now().strftime('%m') == '03' and
        (now() + timedelta(weeks=1)).strftime('%m') != '03'

This value template checks that it’s currently 20:30, the current day is a Saturday, and the current month is March. It also checks that the next Saturday is not in March, which ensures that the automation only triggers on the last Saturday of the month.

Don’t do this

Turns out, it is only “usually” on the last Saturday. Well, not in 2024, and not in 2025. Oh well. May as well plot in the dates manually at that point.

Back to the automation

Once triggered, the automation performed the following tasks:

  1. Turn off select automations: The first action was to turn off certain automations that control lights in various rooms. This step prevented the lights from turning on automatically when motion was detected during Earth Hour.
  2. Disable motion sensors: Since some of our light automations were still handled by Philips Hue, I disabled the motion sensors to prevent them from activating the lights during Earth Hour.
  3. Turn off lights: The automation then turned off all lights in the house, using a smooth transition.
  4. Delay: After turning off the lights and disabling motion sensors, I added a one-hour delay to ensure that Earth Hour was observed for the full duration.
  5. Re-enable automations and motion sensors: Once the hour was over, the automation turned on the previously disabled automations and motion sensors, returning the lighting system to its normal state.

By automating our lights for Earth Hour, we were able to take part in the event without messing too much with our setup. This automation not only provided a seamless way to participate in Earth Hour but also showcased the power and flexibility of smart home technology – which should always augment how we live.

I'm a webdeveloper based in Oslo, Norway. I currently work with web development at Nettmaker.

I would like to change the world, but they won't give me the source…

0 0 votes
Article Rating
Notify of

Most Voted
Newest Oldest
Inline Feedbacks
View all comments