Chris Widner

March 5, 2021

Inexpensive Alert System w/ Philips Hue Lights

Cost: $180 (1 Hue Hub/Bridge, 1 Smart Button, 3 A19 Color Bulbs)
On the cheap: $70 (1 Hue Hub/Bridge, 2 A19 White Bulbs)

Time: 2-4 hours
Skills Required: NodeJS familiarity
Other Tools Required: A local machine to run the scripts (Raspberry Pi works great)
Fun Level: 4 out of 5 stars

The Problem: The scheduling tool within our manufacturing system required far too much manual work and didn’t work the way our company did. We developed our own schedule tool that integrated with the manufacturing system, so long as our project managers entered the data exactly the same way in the manufacturing system as they had on within our scheduling tool.

In short, it was human error. Specifically it was a copy/paste problem, a costly and frustrating one.

The Solution: Typically the Philips Hue system is used for lighting at home. However, we were in need of a system that would alert the manager and our COO when the copy/paste issue occurred. We tried email notifications, but you never know when the appropriate person would check their email (and you don’t want people using email as an instant messaging tool).

We needed something that would immediately identify when the issue occurred and alert people even if their email wasn’t open. That’s when I had the lightbulb moment (pun intended). At $180, using the Philips Hue system was worth the shot.

With a Raspberry Pi running Ubuntu Server already active, we were able to get the system up and running within 4 hours.

The Details: Connecting the Philips Hue Hub/Bridge with our system turned out to be fairly easy.

  1. Install Philips Hue lightbulbs where the team’s manager and our COO would see them.
  2. Connect Philips Hue Hub/Bridge
  3. Install Philips Hue app on my iPhone & follow instructions
  4. Install huejay via npm on the Raspberry Pi device
  5. Grab Hue Hub/Bridge ID from the Philips Hue app
  6. Create a script to check for discrepancies and trigger lights
  7. Install Philips Hue lightbulbs where the team’s manager and our COO would see them.
    I had 2 bulbs, so this was very easy. Both already had a floor lamp in their offices, so I simply replaced their old bulbs with the new Hue bulbs.
  8. Connect Philips Hue Hub/Bridge
    Just follow the instructions that come with the Hue Hub. I used the 2nd generation one, so the instructions may have changed. Should be as simple as connecting power and ethernet to the Hub.
  9. Install Philips Hue app on iPhone (or Android) and follow instructions
    Again, just follow the instructions. They make it very easy to setup.
  10. Install huejay via npm on a machine (I used a Raspberry Pi running Ubuntu Server)
    You can learn more about huejay here. I’ll include my code snippets in the following steps for reference as well.
  11. Grab Hue Hub/Bridge ID from the Philips Hue app
    1. Open the app and press “Settings”
    2. Select “Hue Bridges”
    3. Press the info icon
    4. Find the “ID” (you’ll need this for using the API via huejay)
  12. Create a script to check for discrepancies and trigger lights
    Now we get to the fun stuff. Below is some basic code I wrote for this a few years ago. You may want to clean this up a bit.
    huejay-1-1506x2048.png

    I also decided to have this ran via cronjob in conjunction with Cronitor.io for quick and lazy notifications if it didn’t run for some reason.

That’s it! Let me know if you come up with clever uses for the Hue system at the office.