Turn off an outlet after a variable amount of time?

@jwflutterby

You may be able to do this with CoRE, version v0.1.10e and up. Can you have your Apple Watch application (the one you tap on) send an HTTPS request? If not, can you get that number of minutes you want to wait to an IFTTT recipe as an ingredient? If you can, then here’s what you can do:

Install CoRE, see instructions here.

Go to IFTTT and have a recipe send a Maker request to CoRE’s endpoint followed by /ifttt/poolFilter
To find out the endpoint URL, enable OAuth for CoRE in the ST IDE and go to the dashboard (within the CoRE ST app), copy the URL for the dashboard, then replace the /dashboard… with /ifttt/poolFilter, like so:

URL should look like this:
https://graph.api.smartthings.com/api/token/0adfffff-cfff-4fff-8fff-9fffffffffff/smartapps/installations/e76fffff-efff-4fff-afff-5ffffffffff/ifttt/poolFilter

Use application/json as content type. In the body, enter {time: X} where X is the number of minutes. If using IFTTT you may be able to get this as an ingredient from the event (this). Body should look like {time: {{ingredientName}}} You can use the chemical flask icon to select an ingredient. I trust you know how to use that :wink:

Now go back to CoRE and create a new piston. Tap on IF and add a new condition, select the IFTTT capability, enter poolFilter as the value. Scroll down to Set variables on true, enable Import event data on true. Get out of the IF and go to THEN. Add a new action, select to control switches, select your switch. Add a task, Turn on. Get out and save the piston. Then trigger your watch tap and look into the CoRE dashboard, under the piston you just created (tap on it). You will see a list of variables under the piston itself. A variable called “time” should show up once the IFTTT recipe runs and the dashboard piston page refreshes. Go back to the CoRE piston, to the THEN section, tap on the Turn on task. Add a second task (to the same action): Wait (variable). Select the time variable from the list, then select “minutes” from the next select. Add a third task, Turn off. Get out and save using Done. try your watch app again, the switch should turn on, wait for the given number of minutes, then turn off. You don’t need to “remember” to turn it off anymore…

Please let me know how it goes, if you decide to give it a shot.

Thanks

2 Likes