Toggle Wi-Fi Light when using Zoom with JavaScript


February 22, 2017

Reading time
3 min read

As a remote employee I am often sharing my video on Zoom while working. I may be pair programming, in a meeting, or just checking in with a co-worker. This happens numerous times throughout the day, but it's hard to predict when I'm on.


Being on Zoom with a family at home can be interesting, especially when you work in your bedroom closet like I do. I usually don't mind if my wife or kids come into my office when I'm on a Zoom call unless I'm on with a client or during an important meeting. So, how is my family supposed to know when I'm on a conference call? Even if they were to come into my office, its not always obvious that I'm sharing my video.


So, I ended up writing a program that uses the Wemo Insight Wi-Fi Switch to toggle a Night Light outside my office when I launch or exit Zoom! In addition, I bought some [red light bulbs](Link: // to make the light easier to see.

Interfacing with Wemo

I used the node package wemo-client (by @timonreinhard) to interface with my Wemo. The following code is all that I needed to communicate with my Wemo device.

const Wemo = require('wemo-client');
const wemo = new Wemo({
  port: 1234,
  discover_opts: {
    unicastBindPort: 1235,
}); (device) {
  console.log(`Wemo Device Found: ${device.friendlyName}`);

  var client = wemo.client(device);

  client.on('error', function (err) {
    console.log(`Error: ${err.code}`);

  client.on('binaryState', function (value) {
    console.log(`Light State changed to: ${!!value}`);

  checkZoom(client); // Will expand on this method down below

Detecting Zoom and Updating Wemo

I used the node package process-exists (by @sindresorhus) to determine if I was currently running Zoom. Since I wasn't aware of any hook to determine when an app launches or exists, I just used a setTimeout to re-check for Zoom every so often. When I found that the state of the application changed, it was pretty easy to call the setBinaryState method to toggle the wemo light. Finally, to help me know when the light is toggled, I added the node package node-notifier (by @mikaelbrevik) to alert me when the light turns on or off.

const processExists = require('process-exists');
const notifier = require('node-notifier');
const path = require('path');
const INTERVAL = 60000;

let isRunning;

function checkZoom(client) {
  setTimeout(function refresh() {
    processExists('').then((exists) => {
      if (isRunning === exists) {
      isRunning = exists;
      updateLight(client, isRunning);
    setTimeout(refresh, INTERVAL);

function updateLight(client, flag) {
  notify(`Turn ${flag ? 'on' : 'off'}`);

function notify(message) {
        title: 'Wemo Zoom',
        icon: path.join(__dirname, 'zoom.png'),
        sound: true,
      { message },

Other ideas

Going forward, instead of checking for the Zoom process, I'd rather find a way to detect my computer's webcam usage. I haven't quite figured out how to do that yet, but I think that would be a better solution.


This little project was not only fun, but it has become an extremely handy tool for my family while I'm working. In addition, the kids really enjoy seeing the light turn on and off. The wemo light can also be controlled with Alexa, the Wemo app on my phone, or you could create a recipe on IFTTT;

Web Mentions

Tweet about this post and have it show up here!