How I “Hacked” a One Button Studio to Work on One Electrical Circuit
Back in 2016, our office decided to look into what it would take to build a One Button Studio. If you’re not familiar with the One Button Studio, here’s a quick introduction:
When it came time to construct it we were fortunate in that our building was in the process of being renovated, so we could provide input about the design of the room to the construction team. One of the critical parts of a One Button Studio is that it have two electrical circuits: one for the lights and the other for the camera and projector. In Penn State’s original design (which is what we used), the lights are controlled by INSTEON On/Off Modules, which communicate over a power line. Since then, newer modules that also communicate wirelessly have become available, but even if you use those, Penn State still recommends having the lights on their own circuit.
In 2017, the studio was completed and faculty began using it to record instructional videos. Life was good. Then in 2018, word came that our office was going to be moved to a different building. Just like our previous building, our next building was also going to be renovated and we could provide input about the design of the room just as we had before. The exact same information about the studio’s electrical requirements was provided to the construction team, but when it came time to move in I immediately noticed one glaring problem: there was only one electrical circuit in the room.
Setting aside the obvious shock, questioning, and investigating that arose from this discovery, the big question became ‘What do we do now?’. My thought was to put the studio together and see what happens. Who knows, maybe it’ll still work and this will be a non-issue. When putting the question to Twitter, no one seemed to have a concrete answer about what would happen anyway – not even Penn State.
So, I began reassembling the studio. My biggest concern was the studio’s ability to turn its lights on and off automatically whenever a flash drive was inserted or removed, but when I fired up the Indigo software on the Mac mini that controls the lights and ran the All Lights On and All Lights Off action groups, they turned on and off! Things were looking good – everything else was working properly, and it appeared the lack of a second circuit wasn’t going to be an issue. Finally, the studio was rebuilt, everything was ready for the first test, and I inserted a flash drive. The video popped up on the Mac mini screen, the software indicated it was ready to record, and the lights… stayed off. Restarting the Mac mini, resetting everything, and trying to record over and over again made no difference: the automated lights were not going to work.
So, what now? Call Facilities and have them start ripping out drywall so a second circuit could be added to the room? Maybe as a last resort, but since the Indigo software had the ability to turn the lights on and off, it seemed like a software-based solution might be possible. Time to put that Computer Science degree to use.
Issue #1: Is there a way to turn the lights on and off via a script?
Thanks to a scripting tutorial on Inidigo’s web site, I discovered that their software is highly scriptable, and there is a Python function that will execute an action group like the All Lights On and All Lights Off groups that had worked before during the studio’s reassembly process. That function is:
indigo.actionGroup.execute(12345678)
…where 12345678 is the Group ID number associated with All Lights On or All Lights Off in the Action Groups window. Run this command with the Group ID number for All Lights On, and the lights turn on. Run the same command with the Group ID number for All Lights Off, and the lights turn off.
Issue #2: Can this function be called via a macOS Terminal command?
After finding this post on Indigo’s Help forum, I discovered that it can be called through the IndigoPluginHost, which is located in the Application Support folder. The post provided the proper path for Indigo 7, but I found IndigoPluginHost was also located in the same place for our Indigo 6 installation. Our full Terminal command ended up being:
/Library/Application\\ Support/Perceptive\\ Automation/Indigo\\ 6/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -e 'indigo.actionGroup.execute(12345678)'
Issue #3: Can this command be called any time a flash drive is inserted or removed?
I already had a sense of how the One Button Studio software does this because I had noticed in the past that any time I mounted a remote drive to the Mac mini while the studio’s software was running, the lights would automatically come on. That combined with the fact that the studio’s software sometimes asks the user to select the /Volumes folder told me that it’s watching this folder for a reason, and the only time anything ever really happens to that folder is when a drive is mounted or unmounted.
My first clue on how to actually make this happen came from this blog post by Jeffrey B. Murphy, where he explained that AppleScripts can be attached to a Folder Action. In other words, they can be set to automatically run whenever particular things happen to a folder – in this case, whenever something is added to or removed from the /Volumes folder, which happens whenever a drive is mounted or unmounted. Once I knew this, it was just a matter of finding and using Apple’s Watching Folders documentation to help fill in the remaining gaps.
I ended up with two AppleScripts, one for whenever a drive was mounted (in this case, whenever a flash drive was inserted):
on adding folder items to this_folder after receiving these_items
repeat with current_item in these_items
try
do shell script "/Library/Application\\ Support/Perceptive\\ Automation/Indigo\\ 6/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -e 'indigo.actionGroup.execute(12345678)'"
end try
end repeat
end adding folder items to
And one for whenever a drive was unmounted (whenever a flash drive was removed):
on removing folder items from this_folder after losing these_items
repeat with current_item in these_items
try
do shell script "/Library/Application\\ Support/Perceptive\\ Automation/Indigo\\ 6/IndigoPluginHost.app/Contents/MacOS/IndigoPluginHost -e 'indigo.actionGroup.execute(87654321)'"
end try
end repeat
end removing folder items from
As mentioned earlier, the numbers used in the actionGroup functions need to match the proper Group ID numbers as listed in the Indigo Action Groups window.
Both of these files were created in Script Editor and saved as .scpt files (one named 1BS action on insert.scpt, the other named 1BS action on removal.scpt). These files were then placed in the ~/Library/Workflows/Applications/Folder\ Actions/ folder. Finally, they were attached to the /Volumes folder by Control-clicking that folder and selecting Folder Actions Setup… (our mini runs macOS 10.12, but this selection might be named something different or found in a different location within the contextual menu depending in what version of macOS you’re running). This Lifewire tutorial on enabling Folder Actions demonstrates the process.
The results (as you may have seen in the video towards the beginning of this post): our automated lights are working again, and we avoided a lengthy and costly delay in getting our studio back up and running. If you somehow find yourself in a similar situation, I hope this post will come in handy (although I should mention that I make no guarantee it’ll work for everyone, and if you decide to try it you do so at your own risk).
Comments (0)