We (my wife and I) have been using LIFX lights in our bedroom to simulate a sunrise. They come on at sunrise, and slowly increase brightness for 30 minutes, allowing us to get used to the light, and wake up pretty gently, as opposed to being jarred out of a deep sleep by a more traditional alarm clock.
My wife asked if there was any way we could do the same with Sonos. Specifically, she wants to pick a Sirius XM channel like "15 - The Pulse" to wake up to. Have the volume start at 0, and over the same 30 minute period as the lights, ramp the volume up slowly until it's a reasonable level coinciding with the maximum brightness of our lights.
Her ideal solution would have the following features:
- Pick any Sirius, Pandora, or Calm Radio station that Sonos can regularly access.
- Choose a maximum volume for the alarm
- Choose a length of time over which to go from 0 to Max volume
- Orchestrate the details via an iOS app on iPhone or iPad.
For Extra Credit:
- Do the same thing in reverse, allowing from from X - 0 over time, like a slow ramp down sleep timer.
We first tried the Alarms available in the Sonos App. These are time and content alarms, meaning I can set it to play a Sirius XM channel, at a specific time, at a specific volume. There is a fade-in, but it's only 15 seconds long. Not exactly what we're looking for. We want something more along the lines of a 30 minute fade in.
Google seems to indicate that this is a common request from Sonos users:
- https://en.community.sonos.com/wireless-speakers-228992/wake-up-alarm-for-sonos-system-5706759 (in the last comment, which has languished unanswered for 2 years)
- https://en.community.sonos.com/controllers-software-228995/please-add-an-option-to-adjust-the-fade-in-and-fade-out-time-for-alarms-and-sleep-4441758 (discussion ongoing and unsolved for 4 years)
- and others
I did end up finding https://github.com/SoCo/SoCo, a Python library for interacting and controlling Sonos speakers.
This library would allow me to hit about 2.5 of the ideal features, and possibly the extra credit as well, if I wrote a little program to run from cron on a Linux server.
Easy to do in cron:
- Run a program at a specific time
Can do with SoCo:
- Set volume of a Sonos speaker, or a group of speakers
- Pick a channel to play
Can't easily do with Soco/Cron/Linux:
- Control via an iOS app on iPhone/iPad.
- Supports a file in the same directory called 'holidays.txt', where I can put dates in the format YYYY-MM-DD (one per line), to not run the alarm. (like Work holidays)
- I can also log in to the server and `touch /tmp/holiday` if I want the alarm to not go off tomorrow. (example: sick day, or unplanned day off)