Sometimes you need quiet on the set!
At Treeline Interactive, we like our open space office, but we also do a fair amount of phone and Skype meetings. Our office has a unique setup spread over three floors, and sometimes people can create too much noise without realizing they are disturbing a meeting. Our solution was an “ON AIR” light to let others know when someone is in a meeting.
To avoid running wires upstairs and through walls, we opted for an internet of things (IoT) solution. Also, we wanted to experiment with using #Slack as a controller for the Internet of Things.
We all religiously use #Slack for team communication so we tapped their API for the controller and it works really well.
We created a dedicated “#onair” channel in Slack and when a team member needs it they simply type the command \on or \off.
We have since been playing around with settings.
We use a Slack Bot to remind us to turn off the light when done; we set a default ninety-minute timer to automatically turn off the light and if you are in another room and want to know if the light is on or off you simply type /status.
We’d love to know if anyone else has used the Slack API in conjunction with an internet of things applications. Please let us know in the comments below if you know of any or if you have any ideas you’d like to see us build next.
How to build your own (video)
Here’s What You’ll Need
Hardware Bill of Materials
Software Bill of Materials
NOTE: These are the instructions for how to setup a Master “On Air” light installation. Slave installations are configured differently.
For the “On Air” light project to work properly, the following items must be properly installed and configured.
- This project has been developed and tested on Raspbian 7.1. It is recommended that you use this version.
- You can obtain the latest version of Raspbian following this link: https://www.raspberrypi.org/downloads/
- There are image install instructions available at this link: https://www.raspberrypi.org/documentation/installation/installing-images/README.md
- Make sure that you obtain the latest version of the OS system image from the dev team as there are important startup scripts that are included in /etc/rc.local.
- Change your Raspberry Pi hostname by changing the Pi’s name value in /etc/hosts and /etc/hostname. Refer to RPBI document for Treeline to make sure the name you use does not conflict with other devices in the office.
General Purpose IO Library
- For this project, we are using Wiring Pi. Information on this library can be found at this link: http://wiringpi.com/
- Download and installation instructions can be found here: http://wiringpi.com/download-and-install/
- We will be using Apache. However, you could use any web server as long as PHP is enabled on your server.
- Instructions on installing Apache web server on a Raspberry Pi can be found by following this link: https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md
- You must also open a port on your network to allow your web server to be publicly available to the Slack API. This port should be forwarded to the IP address assigned to the network device on your Raspberry Pi ( on port 80). Talk to your network administrator before performing this task.
On Air Light Software
- Obtain the On Air Light software from our dev team (get it here on GitHub) It is a single PHP file that handles the Slack API’s calls to your web server.
- This file should be placed in the root directory for your web server. It is usually located in /var/www/html.
Slack API Configuration and Setup
- Create a new app by going to api/slack.com and clicking the ‘create new application’ button.
- Fill in all of the details about your installation, and pay close attention to the uri and url sections.
- In both uri and url sections, add the following url: http://<ip address>:<port> where ip address and port are the values given to you by your network administrator in step 3c above.
- On the sidebar, select ‘outgoing webhooks’. Scroll down and click the url ‘outgoing webhooks integration’. On the next page, click on the button labeled ‘Add outgoing webhooks integration’.
- Scroll down and select the #onairlightapptest channel. For trigger words add : /on, /off, /status . For Urls add: http://xxx.xxx.xxx.xxx:port/airlightMaster.php . Copy and save the token. Add a name and description to this webhook. Click ‘Save Settings’.
- You can test the webhooks are working by going into the #onairlightapptest (or the channel to defined for your webhook)channel in Slack and typing /status.
Note: you can change the name #onairlightapptest to reflect any slack channel that you want to listen for the trigger word(s). Alternatively, you could choose to listen on all channels (Not recommended unless ultimately desired).
On Air Light Safety Considerations
Assembling “On Air Light” requires working with line level power. It is recommended that you use precaution and adhere to appropriate safety guidelines when working with line level power. Please read the following article before attempting to build the on air light project: http://swartzelectric.biz/ten-electrical-safety-tips-for-homeowners/
Also, keep the following safety tips in mind:
- Never work on pcb assembly with power connected to your circuit.
- Cover exposed wires with proper housing or electrical tape.
- Cover all wires with housing wherever possible.
- Double check your connections. Have another engineer check your connections as well.
- Keep a fire extinguisher in your work environment and make sure you have it checked regularly.
The Internet of Things series is brought to you by Treeline Interactive and is authored by Tim Homuth and Joe Austin. Our objective is to provide you with information about the rapidly evolving field of the Internet of Things by bringing you interviews and insight from industry leaders. If you have any questions, insight, or suggestions for articles please email us at IoT@treelineinteractive.com.