Hello all! Time to show off a small project I’ve been working on.
I’ve been using a Philips wake up light and love it, really helps me get up in the morning and feel less tired during the day. The Philips wake up light is essentially a big light bulb that slowly fades from red to orange to yellow to white over a timespan of 30 minutes at a set alarm time.
Unfortunately the button interface of the wake up light is rather clumsy and the lack of integrations options made me look for an alternative.
I switched out the wake up light for a standard Philips HUE white + color bulb which I simply put in the regular bedroom lights.
In Home Automation I setup the HUE bridge and made sure the light worked, then added this script:
sunrise:
sequence:
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_1
xy_color: [0.67,0.39]
brightness: 1
- delay:
seconds: 1
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_1
xy_color: [0.65,0.41]
brightness: 85
transition: 600
- delay:
seconds: 600
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_1
xy_color: [0.60,0.40]
brightness: 170
transition: 600
- delay:
seconds: 600
- service: light.turn_on
data:
entity_id: light.hue_color_lamp_1
xy_color: [0.48,0.40]
brightness: 255
transition: 600
This script has 4 color states it fades between, currently it takes 600 seconds per state to do a full transition. Be careful with testing, you will have to wait 30 minutes to complete the full script! The colors are defined with the XY color gamut from Philips: https://developers.meethue.com/wp-content/uploads/2018/02/color.png. I tried to reproduce the colors as close as the original wake up light.
Swap out the “light.hue_color_lamp_1” with a HUE group or the bulb you want to use. In testing I found that 1 bulb is plentiful in brightness for the early mornings. If you use multiple bulbs I suggest only starting the 2nd bulb after 15 minutes.
Here’s a 1 min clip of the 30 minute transition, sped up 32 times.
My primary goal was to integrate the script with the popular Sleep as Android app. This app has native HUE support but the colors weren’t quite to my liking. Any app that supports intents with Tasker can achieve the same functionality.
Now make sure that the Rest API is enabled in your configuration.yaml file:
http:
api_password: yourAPIpassword
Task will be used to communicate with your HA server.
Now we setup a new alarm in Sleep as Android:
- Open the Sleep as Android and go to settings → integrations → services and enable “Tasker”
- Create a new alarm, but set the alarm time 24 minutes before you want your chose ringtone to start playing. For example you want to wake up 6:00am, set the alarm for 5:36am.
- In the alarm settings open the “Gentle volume increase” setting and set it to 24 minutes.
- Tweak the alarm to your liking and save
The Sleep as Android has pretty poor integration configuration features so we have to use the “Gentle volume increase” as a work around. When the alarm starts it will send an intent to tasker.
Now for tasker:
- Open tasker and create a new Task called “Sunrise”
- Add a task of type Net → HTTP Post
- For Server:Port set it to the IP address of your HA installation including http and the port. For example: http://192.168.1.10:8123
- For Path set it to: /api/services/script/sunrise?api_password=yourAPIpassword
- Replace “yourAPIpassword” with the password set in your configuration file and “sunrise” if you named the script differently
- Save the task
- Go to Profiles and add a new Event
- Select the “Intent Received” event
- Set the action to: com.urbandroid.sleep.alarmclock.ALARM_ALERT_START
- Set the task to execute to the “Sunrise” task
- Save and apply
That it! The alarm will trigger at 5:36am, send a POST request to your HA server, which will run the Sunrise script and start up the HUE bulbs transition script. 24 minutes later at 6:00am your set ringtone will sound and you’ll wake up a happy camper!
The HA part is not very complicated but wanted to keep this as a starting point for whoever wants to tinker around with it!