You may remember my Tiki Room Drummer project I posted about last year which is inspired by Disney’s Enchanted Tiki Room. Since then I have added lights, music, and a talking parrot to my home tiki room. Furthermore I have choreographed all of them together using a variety of IoT (internet of things).
This sequence has been trial and error that I have built upon over the past year. It started simply with having the tiki drummers on an hourly timer. Soon after I added coordinating music using a Mac Automator Calendar event to open and stream an audio file from iTunes to an AirPort Express. Then I found wifi enabled puck lights which I could set to a timer as well that added another level to the experience. This setup worked well for a few months. But with my latest addition, a talking animatronic parrot, the sequence required more than just a timer and calendar event.
Tiki Drummers
The tiki drummers are DC battery powered for which I needed to find a wifi enabled control switch that would work with DC power. After some research and suggestions from others I settled on a Belkin Wemo Maker (now discontinued). The Wemo Maker was made for exactly this type of thing, it allowed me to set times that the tiki drummers turn on as well as control them from my phone.
Talking Parrot
The talking parrot is a Hasbro Squawkers McCaw which was a kids toy in the early 2000s that many have since hacked to have their own controllable animatronic bird. I purchased a control board to be able to animate the bird with any line audio source. Which I set up with audio routed from an old AppleTV I was no longer using.
IoT Components Used
- MacBook Pro – Runs Automator
- Belkin Wemo Mini Smart Plug – Switch for parrot control board
- Belkin Wemo Maker (now discontinued) – Switch for tiki drummers
- AirPort Express – Streams audio for room
- AppleTV – Streams audio for parrot
- Magic Home Enabled LED Lights
My Process
My experiments in orchestrating all of these devices together took me down a few paths.
Initially, I tried to keep the lights and tiki drummers set on timers. While the audio continued to be handled by using an Automator Calendar event. Unfortunately, the timing on this just wouldn’t work. The lights would turn on too early, the tiki drummers would run too long, and the music was never coordinated. To get everything timed correctly it needed to all be on the same system.
So next, I tried using IFTTT to setup an applet to handle this automation. IFTTT is an web-based service that uses “if this, then that” scenarios to automate workflows of wifi enabled apps and devices. With IFTTT’s extensive library of services I able to find almost everything I needed. But the most disappointing about the IFTTT solution was that there was no way to trigger music to play on a device. And again with this solution the timing was off due to the back and forth communication over the internet between the devices and services.
Another route that I briefly looked into was an Arduino or Raspberry Pi solution. Which would use a show control software called xLights to control the devices and the music. But this option provided to be a little more daunting of a project to take on at the moment. However, I think this method would ultimately be the best solution and I may still try this in the future.
After these failed attempts I decided that the solution needed to be something that I was comfortable working with. Since I was the most familiar with Automator and was already using AirPlay devices it was the clear that Automator would be the best choice. Automator has a library of actions for controlling software and executing scripts on a Mac. I knew that Automator could control the audio and timing easily. Now I just needed a way to turn on and off the switches and lights.
I came across the app WSwitch which allow you to setup keyboard shortcuts to turn on and off Wemo products. Having Automator run AppleScript to key the shortcuts would trigger the devices on and off. This worked great until my screensaver kicked in. Any keystrokes were ignored when the screensaver or lock screen were active. To solve this I needed to do more research to find a workaround.
My research lead me to Node.js and NPM. Node.js is an open-source and cross-platform JavaScript. And NPM is a JavaScript package manager for developers. With these new resources I was able to find code for not only the Wemo products but also for the Magic Home enabled lights control with even more options than I would have ever expected.
Yet there was still a learning curve for me. With little JavaScript experience and with minimal documentation for such specific applications it was up to me to figure out much of the code. Any of poorly written code would kickback errors and cause Automator to stop the workflow. Once I got all the errors in my code sorted out the rest of the workflow came together easily.
Finished Workflow
- Turn Wemo Switch on (Parrot control board)
- Turn Magic Home lights on with slow seven color crossfade mode
- Launch iTunes
- Connect iTunes to AirPort Express (audio for room)
- Get specified iTunes item (Gong audio file)
- Start iTunes playing
- Launch QuickTime Player
- Launch AirFoil
- Set AirFoil source to QuickTime Player and connect AirFoil to AppleTV (audio for Parrot)
- Open and play specified item in QuickTime Player (Parrot intro audio file)
- Pause Automator
- Get specified iTunes item (Tiki Drummer chant audio file)
- Start iTunes playing
- Turn Wemo Maker on (Tiki Drummers)
- Change Magic Home lights to fast seven color crossfade mode
- Pause Automator
- Change Magic Home lights to seven color jump mode
- Pause Automator
- Change Magic Home lights to seven color strobe mode
- Pause Automator
- Turn Wemo Maker off (Tiki Drummers)
- Change Magic Home lights to slow seven color crossfade mode
- Open and play specified item in QuickTime Player (Parrot end audio file)
- Pause Automator
- Quit applications iTunes, AirFoil and QuickTime Player
The workflow is then exported as a Calendar event and set it to go off on the hour at 7pm, 8pm, and 9pm every night.
There are still a few kinks to work out and my computer still needs to be running to run the Automator workflow. But this choreographed show really brings the tiki room to life. Now all I need are flowers that croon and it will be just like Disney’s Enchanted Tiki Room!