One time scheduled event


(Morgan) #1

Is there any way to do a one time scheduled event on devices? I.E… I want to let my kids stay up to watch a movie, but i want to turn off a z-wave switch in 45 mins, and I don’t want to stay awake to do that. Or, I want to change the mode of the house to Night in an hour, or turn on a light at a certain time.

I would like to be able to do a one time scheduled event without having to install a smart app, and then run it on a schedule and then uninstall it when I’m done.

Is there a way to do that?


#2

This is one of the many features I have wanted for awhile now.


(Morgan) #3

Does anyone know of an easy way to do this?

Or what is the easiest way? What app do people use for this? Or do they just not do it?

I was thinking maybe IFTTT could do something easily, but not sure. Can you schedule with IFTTT?


(Morgan) #4

Bump!!

Does anyone have any ideas about this?

Is this a feature the might be implemented in the future??

It would simple be (pick a device, set a time… and schedule a one time event to fire off)

turn off a light, or tv or change a mode… at a particular time.

It isn’t scheduled, it is just a one time occurrence. Are there any clever work around for this now? Anyone?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5

I’d offer to code it; but only if the usual deluge of other helpful Community Members promises not to swoop in and have it done before I even manage to type the opening 10 lines of code! – Not because I’m a slow coder, but because everyone is too quick to offer help … and they are super fast coders!

In other words: You’ll see a solution here in no time (but you’ll need to do the paste-into-IDE procedure).

One thing small snag is that there is no date-time input preference type, so needs a touch of input error handling to be “clean” about it.

Unless you would find it sufficient to just specify the “Number of Minutes” until Off?


(Morgan) #6

@tgauchat I’m a little confused on your reply.

I can write a SmartApp to do a one time schedule, and I’ve done a few that isn’t the issue.
I’m wondering if there is a better way, or if there is any plan to do this in the future within the existing framework of ST not by writing an app.

I’ve done this before, I have a smart app, but I have to go in and configure the time, select the device or device(s) that I want to change. Save the app, and the run the app.

The app is very simple, so i’m hoping that as a new feature we would be able to add a “scheduled” task and in the backend it creates the app and runs it, and then removes the app after everything is complete.


(Bruce) #7

I must be missing something: No matter what the mechanism (custom app, built-in app), you will still have to set the target time and device(s) to act on. So if it’s a custom app, you open the app with the little gear, set the time and devices, and boom, it’s done. How is that any different than a built-in app? @tgauchat is right that any number of people could write this app. You don’t need to delete the app when its done either, it literally runs once, and then won’t run ever again until it is updated with new time/devices. Such an app could be dirt simple (turn off in x minutes), or more elaborate with extra options, e.g., change mode, run phrase, turn devices on, off or change dim level, etc. Irrespective, the app would run once, then be dead until the next time it was updated (preferences set).


(Geko) #8

You’re right. This feature should be built-in into scene management framework. Vera, for example, has a timer object that you can use run a scene at specific time in the future. In case of ST, this feature could be integrated into “Hello Home”. It already has a periodic timer. It shouldn’t be too hard to add a single-shot timer as well.


(Morgan) #9

@geko Yea, I agree. I have a smart app that I’ve written, but it takes like 7 or 8 steps to run it, and it just isn’t easy.


(Bruce) #10

Here is the dirt simple app to turn off some switches after x minutes, one time only. Only takes 2 or 3 steps depending on how you’re counting steps. After it’s installed, clicking on its gear icon (in My Apps) allows it to be reused with either the same or different switches, and a new amount of time. It works the first time it is installed, and each time it is updated (pressing Done in the preferences):

/**

  • One Time TurnOff

*/
definition(
name: “One Time TurnOff”,
namespace: “”,
author: “Bruce Ravenel”,
description: “Turn off some switches in x minutes”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“Turn off these switch(es)…”) {
input “switches”, “capability.switch”,
multiple: true,
title: “Which…”,
required: true
}

section("This many minutes from now...") {
	input "minutes", "number",
    title: "How many?",
    required: true
}

}

def installed() {
runIn(minutes*60,turnOff)
}

def updated() {
runIn(minutes*60,turnOff)
}

def turnOff() {
switches.off()
}


Best way to do a one time mode change at a predetermined time
(Bob) #11

I know this is an old thread, and I may be misunderstanding the request, but here’s how I handled a similar need via Android. In my case, I wanted a simple way to turn on the ceiling fan for 1 hour (useful at bedtime in the summer). I used the MacroDroid app (requires the paid version) and created a macro (similar to a Tasker scene or IFTTT recipe) as follows:

  1. Trigger: Shortcut Launched
  2. Actions: Launch SmartThings (Force New)
    Wait Before Next Action (8 seconds)
    Launch Home Screen
    Wait Before Next Action (1 second)
    Screen Off
    Macro Run [call a 2d macro of your choosing - in this case, one I called “Fan OFF”]
  3. Constraints: None

Fan OFF:

  1. Trigger: Empty Trigger
  2. Actions: Wait Before Next Action (1 hour)
    Screen On
    Launch SmartThings (Force New)
    Wait Before Next Action (8 seconds)
    Press Back Button
    Wait Before Next Action (1 second)
    Press Back Button
  3. Constraints: None

This requires Android 4.1 or better + a rooted device. The “Shortcut Launched” trigger means it can only be invoked by pressing the shortcut icon on the home screen (other options are available). The “Launch SmartThings” action plays back a recording of your keypresses when you created the macro. The “Wait 8 seconds” action allows the keypresses to be played back and executed (in this case, tapping the homescreen icon to open the SmartThings app, pressing “Things” in the dashboard, and then tapping the icon to turn on the fan). The macro then goes back to the homescreen, but keeps the macro loaded in memory. The screen goes off and the phone sleeps for 1 hour. In the second (Fan OFF ) macro, the Empty trigger serves two purposes: 1) if the first macro fails to execute for some reason, the second macro won’t execute (which would have the undesired effect of turning the fan on instead of off); 2) Prevents it from being called by any other method except from another macro. The rest I think is self evident. I simulate two Back Button presses to get to the home screen instead of using the “Launch Home Screen” action again, so that it is unloaded from memory. The screen turns off and the phone goes to sleep on its own (and presumably I’M asleep by then too :smile:).

Hopefully this will be useful for someone.