codersaur/SmartThings

cleanup method

Closed this issue · 4 comments

Suggest you use state.remove("variable") as it will remove all from state rather than leaving them as null.

Are you also cleaning up settings?

I'm not aware it's possible to alter or remove settings via code. But, if you can post an example, I'll take a look.

app?.updateSetting("$name", [type: "$type", value: value])

app?.updateSetting(name.toString(), value)

can't remove them like you do with state afaik, but can clear them

I know it works for smartapps

another option is parent child, so you have no settings in child

Well I never!
device.updateSetting(settingName, value) seems to work, but only if the setting already has a value.

This is something I've been asking SmartThings for for ages. I have a lot of device handlers that could use this!

Fixed in v0.07