Hard Code Preference in Smart App

Is there a way to hard code a device in a Smart APP? In other words, instead of having a preference that needs an entry have a device pre-defined.

Hope that makes sense.

Hmmm… Not really that I know of. The point of selecting a device from within a SmartApp is to get a reference to that device’s particular unique ID. Since everyone’s devices are unique, I can’t think of an easy way to hard-code it.

I suppose you could iterate through all of the devices and look for one that matches some criteria, and then essentially auto-assign it.

Also, a SmartApp can create a child device. Is that possibly what your looking to do?

1 Like

It was more of a curiosity than anything. I have been writing some smartapps just for my own use. Simple things which I know will only use 1 or 2 items. It’s no problem putting them in as preferences. I just kinda wondered if it could be done. Thanks for the insight.

1 Like