Wyze Motion Sensor Automation: A Step-by-Step Guide

Hey everyone, I wanted to share a project I’ve been working on with the Wyze Motion Sensor and IFTTT. It’s been a bit of a learning curve, but I’m really happy with how it turned out! I’ve been trying to figure out a good way to use the Wyze Motion Sensor as an ad-hoc occupancy sensor. My goal was to turn off my basement lights after 15 minutes of inactivity. I finally figured out a way to do it by using IFTTT & Webhooks and thought I would share the info here. The only prerequisites are owning a Wyze Motion Sensor, having a free IFTTT account, and activating the IFTTT Webhooks service. Having a free IFTTT Platform account is also helpful for more advanced functionality (but I believe this step is optional). Step 1: Find your Webhook Key. The “key” is the string of characters after “use/” in the URL (Example: https://maker.ifttt.com/use/xxxvxvxvxvxvxvxxv). Step 2: Create a new IFTTT Applet. For the THIS action use “If motion sensor becomes clear”. For THAT select the Webhooks service to “make a web request”. In the URL section use the following: http://lab.grapeot.me/ifttt/delay?event=EVENTNAME&t=15&key=KEY&reset=1 In the URL your EVENTNAME can be anything - mine was BASEMENTOFF. The key needs to be your personal key from step 1. The “15” in the URL can be any time delay you prefer. The method should be GET and the rest can be left alone. All credit for this webhook goes to Yan Wang who created the API. Here is the raw code if you’re interested in what’s under the hood. Step 3: Create another IFTTT Applet to perform the action. The THIS should be Webhooks “receive a web request”. The Event Name should match the EVENTNAME in your URL above. The THAT can be anything. In my case it was telling my Wink Hub to run a shortcut to turn off all the basement lights. When the motion sensor becomes clear it sends a webhook request to the URL. The webhook then holds the response for 15 minutes (or for whatever time you entered) and then sends it back to IFTTT. Once received, IFTTT triggers the new action applet. I’m just starting to understand Webhooks but so far it seems like it can be a very powerful tool! Hope someone else finds this useful. If you use this guide to create something cool, let me know!