IFTTT Triggers with a MacBook Touch Bar

IFTTT lets you create applets that let you control things like web services with custom triggers (eg. Create a To Do Item if you receive an email).  I’ve been using it to control the lighting in my house based on triggers I’ve put on my Touch Bar.
This guide goes through setting up IFTTT with my Xiaomi Yee Lights and then adding triggers for them on my MacBook’s Touch Bar.

IFTTT Setup

Before you start this step, you’ll want to make sure you’ve got what you want to trigger already configured. In my case, it’s my Yee Lights that I’ve configured via the Yeelight app. I set mine up in Scenes.
In my examples, I’m using a scene I created called Chillflow (dim lighting that slowly flows through pastel green/blues).
You’ll also need an IFTTT account setup.
First, create a new Applet on IFTTT. For the service select Webhooks.
WebHooksIcon.png
For the trigger, pick “Receive a web request”
Now give it a trigger name.
WebHookCreateTrigger.png
For the second part, pick what service you want to use, I’m using the Yeelight service.
Pick your action, I’m using “Set Scene” then “chillflow”
YeeLightOptions.png
Next up, go to the webhooks settings here: https://ifttt.com/services/maker_webhooks/settings
(You can also get there by clicking on the webhooks icon in the top right of the applet, then clicking on settings)
Copy down the URL they give you, you’ll need the last bit which is your Key.
WebHooksSettings.png
Now you can test it out in the Terminal by pasting the following line (replace {event} with the trigger name (in my case: “timeToChill”) and the {yourKey} part with the key from the step above):
curl -X POST https://maker.ifttt.com/trigger/{event}/with/key/{yourKey}
eg. Here’s mine:
curl -X POST https://maker.ifttt.com/trigger/timeToChill/with/key/asdadasdasdasd213980
All work?  Great! Now to make the buttons appear on your touch bar.

Touch Bar Setup

For this you’ll need Better Touch Tool (BTT).
With BTT installed, go to the Touch Bar section and add a Touch Bar Button.
Give it a name and then go to Predefined Action -> Controlling Other Applications -> Run Apple Script in Background.
BTTOptions1.png
In the box, enter the following text (don’t forget to replace {event} and {yourKey} as you did above.
return do shell script "curl -X POST https://maker.ifttt.com/trigger/{event}/with/key/{yourKey}"
BTTAppleScript.png
Hit save and push that button!

My Setup

The lights I’m using are the Xiaomi Yeelight E27 RGBW Smart LED Bulb and the Xiaomi Yeelight RGB Smart Light Strip.  I actually wanted to get the Phillips Hue setup, but it’s way more expensive.
LEDStripBed.jpg
On my Touch Bar I set up a Group for all my lights, so I tap the Light button, then pick a light setting (picking a setting will close the group too using the “Add Additional Action” thing in BTT).
TouchbarLights.png

1 comment

[…] Duck’s Tech Blog в последнее время опубликовал руководство для управления рецептами IFTTT с панели Touch Bar. Он […]

Leave a Reply