1

Is it possible to create an IFTTT widget which can turn on a LIFX light and fade it off over a specific time?

I had thought configuring a button to turn the light on then set a fade duration using the advanced settings would work. Nope.

Then I tried creating two web hooks which fire on receipt of an event. One turns the light on, the other fades off. Doesn’t work either.

There does not appear to be a schedule service or timed trigger, so I’m at a loss.

3

The Date & Time service allows you to trigger events at specific times, down to 15 minute granularity. So you could have one event to switch it on, and one to fade out 15 minutes later.

If you need it faster than that, you can trigger events using Google Calender. If you set up a custom calendar for IFTTT events, and use "Event from search starts", you can trigger IFTTT actions based on named events in that calendar. It usually works down to the minute, but it might be safer to have 2 or 3 minutes between your events.

  • I did end up creating recipes (is that still the term?) using the quarterly datetime trigger. Didn't know Google calendar had that option. Still feels like a service or trigger option could be provided, as part of the basic functions, to delay events. – Matt W Oct 21 at 4:52
  • I don't think G.calendar will work for me because I want the light to come on based on a physical event (getting home) and go off at a set amount of time after that (10 mins.) That's potentially a lot of events to configure. – Matt W Oct 21 at 4:54
  • 1
    In theory you can automatically create a calendar event from an IFTTT recipe, so you could automatically create the switch off event. But I've never done that so you'd have to experiment. At this point it starts to get a bit crazy though. I wish IFTTT would just allow more complex recipes... – squaregoldfish Oct 21 at 10:04
0

The final, whole, answer is this:

I created a Location trigger in IFTTT to fire a webhook action. The webhook action calls a script located at https://script.google.com/home. This script looks like this:

function doGet(e) {
  ScriptApp.newTrigger("notify")
  .timeBased()
  .after(5 * 60 * 1000)
  .create();
}

function notify() {
  UrlFetchApp.fetch("https://maker.ifttt.com/trigger/<my event name>/with/key/<my ifttt webhook key>");
}

The script sets up a 5 minute timer, which calls the second function in the script, which calls the IFTTT maker URL with an event name.

I then setup a webhook trigger which listens for the event and performs the required action, which turns off the light.

The light is turned on, initially, by a simple IFTTT Location trigger.

Some useful info: The script needs to be published as a web app to be called. The whole process of setting all this up required multiple steps of allowing google/ifttt to call each other, etc. Any time a change is made to the script, it needs to be re-published as a new version or it will not take effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.