Device preference

I found that a input call can specify device.deviceTypeName. Can anyone give an example of what such a call would look like?

Let’s say you’ve written a custom device type handler named “My Cool Device Type”. Let’s also say your device does not expose “standard” capabilities like ‘switch’ or ‘contactSensor’. So how do you select this device in your smart app? Turn out you can select devices using their device types instead of capabilities like this:

input "myCoolDevice", "device.myCoolDeviceType", title:"Which Cool Device?"
2 Likes

So does this mean that, for example, I could discriminate between "capability.momentary" devices, and limit it to virtual ones by using "device.momentaryTileButton"?

Yes, but the caveat here is that you can only select devices that have namespace that matches your app’s namespace. E.g. you cannot select devices published in “smartthings” namespace.

aah…so I see a bit of an issue here. IF the device type contains a space, like many of the devices do, then they don’t seem to be listed. I created a device type call “A B C” and listed “device.A B C” in the input method call but nothing listed. I changed to “ABC” and it worked. I was thinking of using device.typeName to list existing device types, but those spaces screw everything up. is there a workaround?

umm…I created the following:

definition (name: “blahman”, namespace: “smartthings”, author: “SmartThings”)

it has the smartthings namespace and the device was listed.

Yes, you can have spaces in the device type name, like I showed in my example:

“My Cool Device Type” -> “device.myCoolDeviceType”

Notice the lowercase ‘m’.

No, can’t do that. It has to be in your “private” namespace.

So it doesn’t look at the namespace the app is published under, just your “private” namespace?

what about things like “SmartSense Open/Closed Sensor”, what would be the device type name for that?

I tried device.smartSenseOpen/ClosedSensor but that doesn’t work

I believe they have to match, but you also have to “own” it, i.e. you cannot select devices published by someone else (i.e. smartthings). Even if you self-publish your app in “smartthings” namespace, you cannot bind it to devices published by ST. Documentation is not very clear on this though.

2 Likes

Ew:mask:

SmartThings device selection loses all it’s “swap-out / swap-in” brand/model agnosticism when you use deviceTypeName instead of Capability name. Of course, with the Capabilities Taxonomy being stagnant, I guess it is not surprising that these special cases are desired.

Essentially, it’s a “backdoor” for creating custom devices that don’t fit existing capability taxonomy. There’s nothing wrong with that, imho. I love backdoors :smile:

1 Like

Just an update on this.
You can create a new device, based using the existing simulated devices that are already published by ST.
IDE/My Devices/Add new Device, then select the simulated device of choice.

I selected Simulated Motion Sensor.
Then in the smart App

type	: "device.simulatedMotionSensor"

Note the casing as pointed out by @geko , this appears to be the key (and missing documentation ingredient @Jim )

1 Like

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.