Case Study: Smart Light Bulbs

Let’s say you are building a smart light bulb that can be controlled remotely from a dedicated mobile app. It can also be programmed to switch on automatically at sunset and switch off at sunrise.

A customer probably would buy more than just one light bulb. Your app will need to be able to control multiple light bulbs. The light bulbs are likely to be installed to a home where multiple family members are living. Each family member should be able to control these light bulbs.

This is a fairly simple IoT product idea, but it is not a trivial system to build.

MODE’s IoT cloud platform is designed to provide the necessary functionalities to accomplish these with ease.

Controlling Light Bulbs Remotely from Mobile App

A customer bought your smart light bulb and connected it to her home Wi-Fi network. Since it is behind a firewall, mobile apps can’t reach the device directly when the user is away from home. With MODE, both the light bulb and the mobile app would connect to the MODE cloud to make the communications happen.

The light bulb will make a websocket connection and wait for commands from the cloud. The mobile app will issue commands on behalf of a customer (i.e. the user). The cloud routes the commands to the target device via the websocket connection.

Sending Device Commands Through Firewall

Controlling Multiple Light Bulbs at Home

The smart light bulb controller app needs to control multiple light bulbs that a customer owns. MODE provides the API to add devices to a home and to get the list of devices already added to the home. Via this API, the app can have full control over all the light bulbs belonging to the same home.

Controlling Multiple Devices in Home

Letting Family Members Control the Light Bulbs

One of your customers lives in a house with a wife and kids. His wife obviously wants to control the lights as well. Since the light bulbs belong to the home instead of any individual user, as soon as the wife is added as a member of the home, she will have control over the light bulbs. There is no need for the husband and wife to share a user account in order to share control of the devices.

Controlling Access to Home

Getting the Status of the Light Bulbs

It’s very likely that a smart light bulb’s state will be changed by means other than its owner’s mobile app. It may have a physical switch to turn it on and off. Other family members may turn on or off the light via their app.

For the mobile app to keep track of the current state of the light bulbs, you can use the event mechanism. The smart light bulb can implement a state change event and report such events to the MODE cloud. You configure the mobile app to subscribe to these events so that the app will be notified every time a state change occurs.

Receiving Device Events

Turning Lights on at Sunset

Remote-controlled light bulbs are not that smart. To make them truly smart devices, you want them to react to the environment. Let’s consider how you can turn the lights on at sunset. You want to be able to send commands to the devices without user interaction.

MODE allows you to provision API keys for your programs to do just that. You can run a server on the internet (e.g. on Heroku) which checks the time of sunset. At sunset, the server can make API calls to MODE to get a list of devices for the target home and send a command to turn on the lights.

Integration with External Server


This case study illustrates how MODE addresses the key use cases of a typical IoT system. To learn more about the implementation details, consult Getting Started with MODE.