Device name attribute

Within a smartapp, I am trying to retrieve the text for the field “Name” found within the IDE/My Device/Device Names/Name The Label field is obtained via “evt.displayName” but “evt.name” simply displays “switch” or the likes. Is the data for the Name field not retrievable? If not, what use is it?

BTW: .label supposedly is a valid attribute but when used in a smartapp (i,e, evt.label) I get an error indicating the attribute is not valid.

1 Like

Why is “Event.displayName” insufficient?

You could try fetching the Device Object (maybe??) using “Event.deviceId”, right? Since your SmartApp must have the entire list of Devices in it (though it will be split among the various input settings.variables.

Yes, if the event is associated with a device, you can do:

evt.device?.displayName

Reference:

1 Like

The problem is that I pass the name (in current version displayName) to a server to manipulate wemo devices. The displayName in ST is a rule name (cant contain spaces) at the server side.

i.e ST Virtual on/off button = BackyardFloods
calling Wemo server looks like
httpGet(“http://ip:port/wemo.php?name=BackyardFloods&state=${st}&udn=${deviceID}&caller=end”)

I would prefer that the st name would look like Backyard Floods versus BackyardFloods. So, my thinking was that the label (dfisplayName) is Backyard Floods while the name field would contain the name without the spaces.

1 Like

So try Jim’s suggestion…?