Hi all,
I was wondering if anyone had any ideas on how to make this better. Basically, it uses the alarm time set on a specific alexa device as a trigger to make a light slowly brighten in the 5 minutes before it goes off. The goal is to just set the alarm on the alexa device and have home assistant figure out the rest. Any ideas on how to more efficiently trigger the time?
I did do this by using the TTS and media player capabilities of Alexa.
Essentially, I would set a date/time input in HA, and then it would trigger a script of things. One was to brighten lights slowly, then at a certain time play bird sounds from Spotify into Alexa as a media player.
The next step was to actually take input from a voice command to set the time, but I ended up being limited by Alexa’s inability to share data to HA and vice versa. My workaround here was to use the Alexa integration with Nodered to take a voice command to set the time. The limitation there is that you can only give a percentage amount… So I’ll likely set it up so that the voice command assumes 7:%% AM where %% is the given voice percentage. Any alarms set outside of 7-8AM will need to be overridden on the UI.
I do hope that we can get a good voice assistant device with a proper integration at some point. Until then, keep your duct tape out.
I’ve since updated this and it works very well. I’m using the alexa custom component which provides the current alarm time that’s set. Then I trigger a python script which starts slowly making the lights brighter 15 minutes before the alarm goes off. Trigger below:
The real trick is being able to stop it before the alarm starts. The python script takes an input boolean (“cancel switch”) that stops the script.
I then have another automation that turns on that “cancel switch” (and off 1 minute later) if the alarm time becomes “unavailable”. The result is that I can just tell Alexa to cancel the alarm at any point in the cycle and it stops.
In the end, this works without any interaction except for setting my alexa alarm.