This post may contain affiliate links. Please see our disclaimer for more info.
Today we’ll dive into a relatively easy project (and inexpensive) that has added a ton of value to my home automation system. Let’s start with the problem this project addresses:
I generally dislike getting up in the morning. I’m an evening person and the mornings are a challenge for me. Unfortunately being a parent (and having to work and all that other adult fun stuff), I need to be up. One thing I’ve read is having the Sun’s rays cast down you will tell your body it’s time to get up making the AM process easier. Another challenge here is that I live in the northern US where it’s dark a majority of the day during winter months. I’ve found these sunrise alarm clocks (I have no experience w/ these), however I couldn’t justify paying that much for an alarm clock.
With all that… Let’s automate!! I was pretty surprised how easy this was to implement and mad at myself for not doing it sooner.
Ingredients:
- Sengled Smart LED bulb
- Socket & cord
- HA Components: input_datetime, time_date, binary_sensor
Equipment
I’m using a Sengled bulb for this project – I’ve used these bulbs for a variety of things and have been very pleased with their value for price – see my blog post on them here. For less than $10, it’s hard to beat. The socket & cord is just a random brand I’ve found on Amazon that was cheap and did the job. Depending on where you want your pseudo sun to be, you may wish to buy a lamp or shade of sorts. In my situation, I just placed the bulb behind the TV mounted on the wall – it does a nice job illuminating the ceiling without causing AM blindness from brightness. Plug the bulb in, pair it with HA (you’ll need a zigbee adapter for this bulb – see here for a post I did on them), and you’re ready to automate.
HA Config
For this setup to work, we’ll need to implement a few parts in our configuration.yaml:
-
- Input Datetime – provides an interface to set the alarm time within the UI
input_datetime:
wake_time_weekday:
name: 'Weekday Wake up Time'
has_time: true
- Input Datetime – provides an interface to set the alarm time within the UI
-
- Time & Date – provides sensor of what the current time/date is
sensor:
- platform: time_date
display_options:
- 'time'
- Time & Date – provides sensor of what the current time/date is
-
- Binary sensor – triggers when the alarm matches the current time (to then fire other automation)
binary_sensor:
- platform: template
sensors:
wakeup_alarm_weekday_triggered:
value_template: >-
{{ states('sensor.time') == (state_attr('input_datetime.wake_time_weekday','timestamp')) | int | timestamp_custom("%H:%M", False)}}
- Binary sensor – triggers when the alarm matches the current time (to then fire other automation)
With the above and some additional updates to your grouping, you’ll have a UI that looks similar to this:
Automation
I’m using Node Red for all my automations in HA now. However this isn’t a requirement. Overall the automations are pretty simple – I’ll outline it in pseudo code, and you can implement as you wish.
In summary, the binary sensor will change states from off to on when the current time matches the alarm time. This is our trigger. From there, it’s just a simple turn on a light with a 10 minute transition period. Then turning off automatically at a later point (like after I leave the house) – feel free to set it as you wish.
PSUEDO CODE! When weekday alarm turns on: Light.turn_on light.bedroom_sun Brightness_pct: 0 # this helps ensure the bulb starts at 0% brightness Light.turn_on light.bedroom_sun Brightness_pct: 100 Transition: 600 # 10 minutes - set to whatever you'd like When sunrise occurs: Light.turn_off light.bedroom_sun
That’s all there is to it! Pretty simple. I also added the light turning on at low brightness in the evening – it’s a low ambient light that’s helpful when we’re getting ready for bed. Hope you enjoyed the post.
Leave a Reply