As the sun sets over the horizon and your living room grows dim, it sure would be nice if your smart lights knew to turn themselves on. With a little magic, you can make your lights turn on as soon as the sun goes down.

Related: How to Automate Your Favorite Apps with IFTTT

For this, we're going to use a service called IFTTT (If This Then That). If you haven’t used IFTTT before, check out our guide to getting started for info on how to create an account and connect apps. Then, come back here to create the necessary recipe.

This little trick uses the Weather Underground IFTTT channel to find out when the sun sets. You can then turn on any smart light that has an IFTTT channel, including Philips Hue, Belkin WeMo, or LIFX. For your convenience, we've created an applet using Philips Hue lights here, or you can follow the steps below to make it for yourself. You'll need to connect the Weather Underground channel, as well as the channel for your preferred smart lights before you begin.

To get started, head to IFTTT's home page and log in. Then, click your profile picture.

Next, click "New Applet."

Click the word "this" highlighted in blue.

Search for "Weather Underground" or find it in the grid of products below. Click on it when you find it.

In the list of triggers, find "Sunset" and click on it.

On the next page, click the word "that" highlighted in blue.

Search for your smart light's IFTTT channel. In this case, we're searching for Philips Hue. Click on the channel when you find it. From here on, the steps may differ slightly depending on which brand of smart lights you use, but the basics should all be the same.

In the list of actions below, find "Turn on lights" and click on it.

In the dropdown box, choose the light or room you want to turn on when the sun goes down, then click "Create action."

On the last page, you can give your applet a unique name if you want to.

The Weather Underground trigger will activate within fifteen minutes of the sun going down, so don't expect it to happen instantaneously. However, it's still nice to have the light automatically come on when you need it most.