Tech Blog

IT Administration, Technology

Celebrating Christmas – 42Gears Way

By Onkar Singh3 min read
← Back to blog
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!

Keep reading

You may be interested in

Browse all articles →
Using SCEP Certificates with Okta and SureMDM for Zero Trust Security
August 5, 20257 min read

Using SCEP Certificates with Okta and SureMDM for Zero Trust Security

For businesses embracing zero-trust principles, secure certificate-based authentication isn’t just nice to have—it’s a necessity. With Okta as your Identity Provider (IdP) and SureMDM as your unified endpoint management solution, you can now seamlessly distribute and manage device certificates using Simple Certificate Enrollment Protocol (SCEP). This blog will guide you through: Why Use SCEP with […]

By Sunny KumarRead More →
How to move machine images in Google Cloud Platform from one project to another?
September 20, 20221 min read

How to move machine images in Google Cloud Platform from one project to another?

In GCP (Google Cloud Platform), there are various kinds of resources like images, snapshots, vm instances, etc. Sometimes there is a need to move the private images of one project to another project, to create a similar machine. So here are the steps which you can follow to move it from one project to another […]

By Sachin.kumarRead More →
Next Big Thing in Cloud Security
March 11, 20226 min read

Next Big Thing in Cloud Security

Cloud security refers to the method of securing cloud computing environments, applications, and data.

By Sachin.kumarRead More →