Best way to store settings for a group of devices in state?

I am working on a SmartApp where I want to store some information about certain devices before I override their values, so I can revert back to their original values at a later time. I would like to temporarily switch multiple thermostats off given a certain trigger (or all fans on, or all to heat, or whatever), and restore their previous settings at a later time.

My current thought is that I’ll grab their mode and fan settings, and store them in state. However, since I have multiple thermostats, I’m not sure how to organize them in state so I can later assign the correct settings to each.

Does anybody have any thoughts?

Don’t know anything about coding as I just copy what other smart folks like yourself accomplish!

Saying all of that, in wenCoRE, there is an option to store attributes to local or global store. There is another option to load attribute from local or global store.

Maybe that will help you…


You could store them in a single state with the Key DNI. Could look something like the below:

[deviceDni1:[paramA: {valueA1}, paramB: {valueB1}], deviceDni2:[paramA: {valueA2}, paramB: {valueB2}]]

Then call up the state, filtered on the deviceDNI, and grab the parameters to send to the child to update.

1 Like

Not an expert but I would use something like…


You could also store the device defaults with the device. It is actually more logical and you can easily call up the command from the SM using child.restoreDefaults (a method in the DeviceHandler). Then use individual states

sstate: power - on/off/auto
state.fanSpeed - if supported
state.heat/cool/automatic - if supported

You can get as complicated as you want. For instance, for cool, you can have a unique set of default values).

Resetting would be simply reading the default setting and commanding the system.

Thanks Dave.

Is it a correct assumption that DNIs are immutable?

Yes. I believe so, within the system. Usually it is dependent on the Service Manager that installed the device.

The current custom is to use the MAC address for LAN devices, all caps, all alpha-numeric (i.e., A124BC23…). for Z-wave and Zigbee, they use that system identifier. The MAC is unique. If you use IP / Port or other formats, then you may have issues.