Turn Off Lights Automatically with Stringify

One of the things about having kids is that they are really bad at turning out lights. I was just as bad when I was a kid, but my parents didn’t have as slick a solution as I have today with my smart lighting controls. I already have a lot of simple settings set up through IFTTT applets for my lighting, like turning on the outside lights at sunset and custom voice controls triggered through Google Assistant, but I wanted something a little more complex to solve for my kids leaving lights on problem. I wanted to turn off lights automatically when the kids turned them on.

Introducing Stringify

I found lots of really complex ways to tie together multiple conditions and counters, but the easiest for the simple use case of “turn the lights off automatically XX minutes after they are turned on” seemed like it should be easier. Stringify is a service which makes this (and much more) possible. And it is easy to use.

The first thing you need to do is download the Stringify app which you can find in the Google Play or Apple App Store (quick links can be found at https://www.stringify.com/). Create yourself an account on their system through the app, and you’re ready to go.

Turn Off Lights Automatically

My use case for this automation is very simple.

Whenever my hallway light is turned on, I want it to automatically turn off one minute later.

My hallway is a transient place that people don’t spend time in, but when you’re looking for a book in the hallway bookshelf or walking through at night it is nice to be able to turn on the light. Since nobody ever turns it off after they are done picking out a book, I want that light to turn itself off. I used to have a simple motion sensor in the hall that triggered the light to turn on, but the cat kept setting it off at all hours of day and night which was disruptive. With this solution someone has to choose to turn the light on, but the light will automatically turn off.

You could use this for any light you want to have automatically turn off, and you’ll see with the Stringify timer how easy it is to set (and adjust) the timing of that light.

Implementing Your “Auto-Off” Lighting

The tools you will need for this are a smart light switch which sends a trigger when it is turned on or off, an IFTTT account connected to your smart switch control, and a Stringify account connected to your IFTTT account.

I prefer the Sonoff switches which we carry in our store which both look elegant and deliver the functionality you need.

These switches come in three configurations with one, two, or three switches in a single plate and are installed fairly easily if you’re comfortable with home wiring. (See our post on Easy Smart Switch Updates For Your House).

The Sonoff switches work with the Smart Life app and they provide a trigger to IFTTT whenever they are turned on or off which is the key function we need for this application.

Step 1: Set Up Your Stringify Flow

Our first step is to set up our Stringify “flow” that we can call from IFTTT when the switch turns on, and which will trigger IFTTT to turn off the light.

In Stringify this flow is made up of three simple elements:

  1. An IFTTT Trigger which is called from an IFTTT action.
  2. A Timer
  3. An IFTTT Action which will trigger an IFTTT applet.

(Note: If you don’t see IFTTT as an option in Stringify when creating a flow, you haven’t connected it to your IFTTT account yet. Go to IFTTT, search for Stringify, and connect the service to see IFTTT in Stringify).

You simply drag the actions into the Stringify grid, ensure you have selected the right option (ie. IFTTT Trigger for the first node, whatever delay time you want on your timer, and IFTTT Action for the last node) and then tap and drag to connect the nodes together as in the picture.

Step 2: Set Up Your IFTTT Applets

Now switch to your IFTTT app and create a new Applet. For your trigger you will select the Smart Life triggers and choose “Device or group is turned on” and then the device which you want to trigger the countdown.

Not all switches or smart plugs work for this as they don’t all send a signal when they turn on and off immediately. If your smart switch doesn’t notify IFTTT of the trigger, then the flow will never kick off or could have a lengthy delay.

You can test this by setting up a test Applet in IFTTT that notifies you when the switch is turned on and then test it. If you get a notification right away, then you should be good.

The action on your IFTTT applet will be Stringify and you will select the “Run a Stringify Flow” option and select the flow you just saved.

Save your applet, and the front half of your work is done.

You now need to create a second IFTTT applet which will be triggered from Stringify after the timer runs.

For your IF option on the new applet choose Stringify and select “Stringify Flow runs” and select the flow you saved in the previous step.

For the THEN of your new applet, choose Smart Life, and select to Turn Off the switch you want to automatically turn off after the timer elapses.

Save this second applet, and you should be good to go.

Couple of notes: I’m still in the early stages of playing with this combination and I would say the setup runs successfully about 85% of the time. For some reason sometimes the IFTTT applet seems to trigger when the light is turned on, but the trigger never returns from Stringify to turn the light off. I’m still pretty happy with the simple solution, because it means that 85% of the time I don’t have to turn the light off manually.

As an added bonus, now that the switch is “smart”, for those other times where the auto-off option doesn’t run, I just have to ask Google to turn off the hallway light and she is happy to oblige!

We can install and configure this type of automation for your house as well. Simply contact us to learn more about how we can make your home smart!

Tim Empringham

Leave a Reply

Your email address will not be published.