[RELEASE] Auto Off - Automatically turn off devices after set amount of time on

Great work, it fixed my issues when I was trying to use the delay timer built into RM, specifically regarding my startup procedure and when the internet is in an unknown state.

As a result, the delay action was called with at an incorrect time code, since the internet was down at that time, and then when the time got updated, since the internet came up, it would jump past the time at which it would trigger the delayed action, causing that action to never get called.

The unpredictable time codes are still an issue with your app, but I am guessing your comparison is not just an "equal to" comparison, so if/when the time gets updated, the auto-off still triggers even if the jump is massive, which is fine for me since I am controlling a network device and once the internet is online, it no longer has to be.

Anyway, thank you, very simple setup and it works very well.

The implementation is pretty naive and simple since I wanted a rock solid app, not a clever one with potential issues. I'm actually storing the requested off-time in native microsecond resolution and checking if now() is greater than that time for any registered device that has turned on, every minute. Not optimized but good enough :slight_smile:

FYI for anyone using the app:
One side effect is that the actual time before the device is turned off can be as long as 59.999999 seconds after the requested off delay since the list is only checked every minute.

Glad it worked!


Cool app, I was looking for something exactly like this as setting up a rule in RM for each device is tedious in the extreme, even if using the cloning feature!

Does this run a timer for each individual device or a global timer?

Btw, my only suggestion for improving this awesome app is to add an option for using a house mode or virtual switch to prevent timers from running. eg I have a virtual switch called WFH that disables my rule machine 1hr timer for my Study lights and switch to a 4 hour timer instead.

It would also be nice to have timers disabled while the house is in eg Away mode so I can run a random lights program at night that simulates us being home.

No, I wanted to keep this app as simple as possible (implementation-wise) so there is one timer per app instance. The app gets a callback every minute and checks if any lights have been on for longer than it should. I was considering doing a callback for each device but decided against it since the only downside of a single timer is that it may take 59 seconds longer for a device to turn off, but the code complexity would be much higher.

You can probably do that with virtual switches and the master switch in the Auto-Off app. Have two instances of Auto-Off, one with 1-hour and the other with 4-hour. Add all devices to both Apps. Make a virtual switch that is the inverse of another virtual switch, feed one virtual into the 1-hour instance, and the inverted into the 4-hour.

Similar setup with Home-Away.

1 Like

Any possibility of making the rules we create children of the app? No particular reason at the moment other than it triggers my OCD for some reason.


1 Like

Hi @lewis.heidrick and apologies to the OP for going of topic, but which site do you use for the emoji's you are using.


Just click the copy button.

1 Like

Thanks again. :+1:

1 Like

I would like this too, it’ll just tidy up the app list.

1 Like

I’m having issues where it doesn’t turn off if I manually turn the switch on. Any thoughts?

Z-Wave or Z-Wave Plus? It matters because Z-wave non-plus don't report state changes. Which is why you see so many recommendations to replace them. You could poll them on a limited basis but it causes a lot of noise on the z-wave network and is generally not recommended.

Plus. There’s an option for master switch and I’m wondering what that is for. I haven’t really read the code yet.

@MFornander awesome simple app. I've been using a combination of RM and driver capabilities to accomplish the same function. I'd much prefer to use this app to consolidate preferences. Is there a recommended or least resource expensive way to do this? I would think a driver based "auto off" function would be best when possible, wondering if there's a best way?

Any chance of adding specific time to the OFF options?

I love this app for lights that people always tend to leave on. But one thing that has continuously frustrated me with HE is that Simple Automation doesn't allow you to pair "On at Sunset" with "Off at Specific Time."

Not that having an ON rule and OFF rule is much of a burden, but it just seems like something so basic.

For my holiday lights (I'm revisiting this again because Halloween is coming up), I want to turn them on at Sunset (+/-), but have them turn off at 11pm. So I currently have one rule for "On at Sunset" and a separate rule for "Off at 11pm."

Hardly killing me, but just grinds my gears.


RM4 is a large app, and generally purpose built apps are much smaller and execute faster. Also rules take very little resources so a bunch of simple rules are generally better than large complex rules.

1 Like

Is a native driver setting for auto off going to be better option compared to an Auto Off app?

That function is better performed by apps. Drivers provide data from device and app acts on that action. There are cases where functions have been built into drivers such as double tap function but that can have an adverse affect on the device. Speed wise there wouldn't be a difference. Devices that support auto off in the device firmware such as motion sensors it can be faster by the response time it would take the hub. This can been observed on motion sensors. Turn on occupancy and have the hub turn it on at say 5% brightness. The motion sensor will turn on the light then like a quarter second later the hub will turn it to 5%.

Appreciate the OCD viewpoint! :slight_smile: However a child/parent app is more complex than just a single app so unfortunately not going to go down that path. One of the fitness criteria for this app is reduction in complexity to make sure it's a reliable app.

1 Like

No sorry, that function would be best handled with Simple Automation or RM4. Not meaning to be rude, just trying to keep this app super simple and reliable.

Np, I went with another app.


Download the Hubitat app