App to turn off a lot of devices with retry

I put up a new simple app in our public GitHub repo that will turn off a bunch of devices, and retry for devices that don't turn off, and keep retrying them until they do (or some max number of retries). This app could be used two ways: (1) to overcome the fact that a Group or Scene may fail for a long list of devices, or (2) to find out which device is problematic.

github.com

hubitat/HubitatPublic/blob/master/example-apps/allOff.groovy

definition(
	name: "All Off",
	namespace: "hubitat",
	author: "Bruce Ravenel",
	description: "Turn Devices Off with Recheck",
	category: "Convenience",
	iconUrl: "",
	iconX2Url: ""
)

preferences {
	page(name: "mainPage")
}

Map mainPage() {
	dynamicPage(name: "mainPage", title: "All Off", uninstall: true, install: true) {
		section {
			input "appName", "text", title: "Name this instance of All Off", submitOnChange: true
			if(appName) app.updateLabel(appName)
			input "switches", "capability.switch", title: "Switches to turn off", multiple: true
			paragraph "For the trigger use a Virtual Switch with auto-off enabled, turning it on fires the main off command for the switches above"
			input "trigger", "capability.switch", title: "Trigger switch"

This file has been truncated. show original

12 Likes

This looks great, would it take much to make this create child apps so we can use it more than once? I'd like to use it to turn off all the lights when we leave, turn off most of the lights when we both go to bed, and turn off just a subset when we're both in bed when we have company. I could copy the app and rename it if it's a lot of extra code.

Thanks.

This is awesome @bravenel ! I will definitely use this for some specific scenarios!

@Terk - Depending on Bruce's answer, for more complex setup and child apps, I'm using @bptworld 's excellent Device Check Plus community app to do what you are asking. I specifically use it as it also supporting checking locks and trying to lock the locks if they are found open. (e.g. Bedtime routine or vacation mode)

2 Likes

All you have to do is add these two lines of code right before where it has input "switches"

input "appName", "text", title: "Name this instance of All Off", submitOnChange: true
if(appName) app.updateLabel(appName)

I will update the GitHub copy as well.

2 Likes

Thanks!

Been doing this with groups on each hub...I'll be trying this out!

@bravenel
I love this app. Have a question, it does not appear to issue an off command to switches the system thinks is off. Is there a way to send all switches off commands?

Test for that is on line 55.

@bravenel Great, I see that. How do you recommend I modify that statement to always send an off command; ie set them all to maybeOn?

Will this mess up the “reported off”/“still on” function?