Waking up with "the Sun" using Home Assistant

published Jan 25, 2023

Waking up with a sunrise, even if artificial, is a far less jolting experience than an alarm. Extra helpful in winter too!

Waking up with "the Sun" using Home Assistant

What you'll need: a bedroom light with tunable white color (2000-6500K), fairly bright, married to Home Assistant.

Create an automation whose sequence of actions goes like this:

  1. Call service to turn lightbulb on with Kelvin temperature 2000 and brightness 1 (not 1% brightness percentage — 1 brightness).
  2. Wait five seconds.
  3. Turn lightbulb on again, this time with brightness 255 and Kelvin temperature 5800, but now add a transition time of 555 (seconds, aka 5 minutes minus 5 seconds).  Choose whatever temperature you want, though — I'm only using 5800 because that's the Sun's temperature.

For the triggers you'll want to set the automation off ten minutes before a set time.  You have options here:

  • You can marry such an automation to a Home Assistant schedule that you create yourself and set up to taste.
  • You can also use  your Android phone's next alarm sensor (fed to Home Assistant by the companion app — enable the sensor in the Companion settings).  This is what I did, using a template trigger to compute time remaining between now and the alarm.  That way all I have to do is set my alarm properly the nighs before.

As for conditions:

  • In practice, I also disable step 1 of the automation if the bulb is already on for whatever reason (probably already awake and out of bed, so don't bother).
  • The automation also won't run here at home if I am not home / on vacation / dozing off on the living room couch.
  • If you have a mattress pressure sensor or smart bed, you can skip the automation if you're not in bed.

Trust me — it's wayyyy less of a jolt to wake up like this!