Start on motion and stop after x seconds


I am new to the forum, and so if I am in the wrong area, a point in the right direction would be appreciated.

I am looking for a reliable method to accomplish the following… I want to run a model train (hooked to a Smartthings outlet) for 15 seconds when there is motion in the room. I would only want the train to run, at most once, every 30 minutes (so, if the train had run in the last 30 minutes the train should not be switched on by motion).

Here are some more detailed requirements… When motion is detected (Smartthings motion detector), then turn on an outlet /plug module for (S) seconds. After (S) seconds, the outlet module should switch back off. I would only want the routine to turn on the train every (M) minutes.

I tried the lighting automation app but could not figure out how to get the automation to run only once every 30 minutes. I was able to add turn off the outlet 1 minute after motion had stopped; however, I was not able to get it to turn off after 15 seconds (I tried .25 minutes – but no luck). In addition, I noticed the train appeared to keep going past one minute if the motion continues.

I don’t have a lot of experience, and I am not a programmer, but I was able to figure out how to add existing apps (that others had made) to My Apps. That is about the extent of my technical knowledge.

Please let me know if you are aware of an application that I might use to accomplish my goals.

Thank you,

Smartthings do not recommend any timer app to use anything less than 1 minute.
It could be done with a custom smartapp or perhaps with webcore but I don’t know how reliable it would be.
What you appear to be asking for is multiple conditions which the smart lighting app is not really capable of.
I would suggest if you are ok with copy/paste in the ide the webcore is probably a good thing to look at.
Although possibly a steep learning curve, what you can do with it is almost unlimited.

Have a look here.