Celebrating Christmas – 42Gears Way


Christmas Tree with Lights (Created using DALL.E)
Christmas Tree with Lights (Created using DALL.E)

One fun activity that everyone, from children to adults, loves to do is set up a Christmas tree – decorated with lights and ornaments. 

Every year, we love setting up a Christmas tree with decorative lights in our office.

We, however, like to add a touch of our own technology to this experience. This year we wanted to control the Christmas Tree lights remotely from the SureMDM console – which our customers use to normally manage Android, iOS, macOS, Windows, and Linux devices.

Our core requirement was to be able to remotely turn on and turn off the Christmas Tree Lights. Sections below describe what all equipment and steps that helped us accomplish this objective.

What do we need

  1. Christmas tree with lights
  2. TP-Link HS100 Smart plug
  3. Linux gateway to send commands to the smart plug
  4. Android smartphone with camera mounted in front of the Christmas tree

How does it work

  1. Insert the smart-plug into the power socket and use the Kasa app to connect it to the wireless network.
  2. Use nmap on Linux or Fing on Android to determine the ip address of the smart-plug.
  3. Take a Linux device (a full Linux or Raspberry would do) for use as a gateway. Enroll this device into SureMDM, manually name it “Christmas Tree”.
  4. Get an Android device with Camera, enroll it into SureMDM. Point the camera towards the Christmas tree.
  5. Download the script from here and copy it to a folder on the gateway device. Thanks to Philip Branning and others for developing this script that makes it super easy to control the TP-Link smart plug over TCP/IP on a local network.
  6. Go to SureMDM Console and create the following Run Script jobs for Linux platform

    Turn On Christmas Lights” script job : Use the following command to create the script to turn on the smartplug.

<path_to_the_file>/hs100.sh on

Replace path_to_file with the folder path where hs100.sh is located.

Turn Off Christmas Lights” script job : Use the following command to create this run script job to turn off the smartplug.

<path_to_the_file>/hs100.sh off

Replace path_to_file with the folder path where hs100.sh is located.

  1. Customize the toolbar by adding two buttons On and Off and assign the above jobs to them.
  2. Select the Android device. Click on Remote to start the remote control session. Launch the Camera application. You should be able to see the Christmas tree through the Camera on your laptop.
  3. Select the gateway device and
    – Click the On button on the toolbar. This should turn on the lights.
    – Click the Off button on the toolbar. This should turn off the lights.

There’s more

Rather than manually turning the lights ON and OFF, we wanted to turn them on and off at specific times and days of the week. We achieved this using the powerful scheduled job feature of SureMDM.

We applied “Turn On Christmas Lights” as a scheduled job which runs Monday-Friday, at 9:00am. Similarly “Turn Off Christmas Lights” is scheduled to run at 5:00pm during those days.

Here is a video of the whole setup in action.

Even though this is only a simple – fun project, it demonstrates how SureMDM can be used to control and manage almost anything. If this inspires any creative ideas that you decide to implement, please let us know.

Happy Holidays!

Leave A Comment

Your email address will not be published. Required fields are marked *