This piston will turn on a light with motion and off after 5 minutes of no motion. But if user switches the light on it will not be turned off by motion, instead user will need to turn if off from the ST app. If motion turned on the light and you want it to stay on till you turn it off, just switch the light off and on. The isBetween check sets the light level to 100% when between 4am to 11pm otherwise to 10% only when turned on by motion. note that while i use a light in this example it could be any device controlled by motion.
EDIT: edited the description to clarify that when you need to take the light out of the stay on mode, you turn off the light from the ST app.
EDIT2: added the following version as well which can be found in the thread below for use with smart switch and dumb bulb. the first version works with dumb switch and smart bulb combo. this has the additional option of not controlling the lights unless it was turned on by this piston.