Retrieve an attribute from a DTH


#1

1) Give a description of the problem
I have a custom DTH which i am using to trigger actions in webCoRe (a button press on the tile), the piston also is triggered remotely via AskAlexa. Is there a method of retrieving a setting/attribute value from the device.

2) What is the expected behavior?
For example pressing the power button in the custom device (from within the mobile smartapp) triggers the piston (this is all working fine), i want to then send a local http post to a wifi controller, but want the parameter that i send to the controller to be retrieved from the ST device parameter. Means i don’t need to store the parameters as variables in webcore.

3) What is happening/not happening?
I can’t find a method of retrieving a attribute/setting from the custom device i have created.


#2

Check if you can pull it from the Evaluation console. If you get the expected value, then you can send it.

Expression: [devicename:attribute]


#3

When i enter the expression [Kitchen TV Remote : internal_ip] it returns Invalid attribute. If i enter [Kitchen TV Remote : switch] it returns ‘on’.

I set internal_ip in the smartthings app under the device settings.


#4

I don’t know much about device handlers to mess with it but that’s basically what is needed, for the device handler to expose those attributes to webcore so the you/we can use the values.


#5

That’s the bit i’m struggling with. I think i could send the value i want with the sendEvent command in the device handler, but that would be a little limiting. It would be great to be able to access these attributes some how.


#6

You need to define the custom attribute at the top of the handler otherwise it won’t be available to webCoRE.

attribute “internal_ip”,“string”


#7

And take a look at my value tiles DTH for some inspiration:


#8

Perfect thanks, appreciate it.
I’d been playing with attributes but hadn’t worked out the send event bit.
I had seen your thread when searching but hadn’t joined the two together. Never like asking what has already been covered!