Accesing Custom Device Attributes?

I have a custom device handler called, let’s say, Dev1. It has two custom attributes called, let’s say, Att1 and Att2.

I want to watch for changes in either of these attributes from a custom SmartApp.

I need help writing the “subscribe” statement - I can’t seem to make it work.

Should be be like subscribe(“DevName”,Dev1,Handler)? Or like subscribe(“DevName”,Dev1.Att1,Handler)? Or like subscribe(“DevName”,“Dev1.Att1”,Handler)?
Seems no matter what I try, I get “Access denied”.

Coach me please!

There are only three parameters:

  1. Device pointer (retrieved from a settings input where the device is selected)
  2. Attribute name (string)
  3. Callback method to call on events, pointer to a method that accepts a single parameter, an EventWrapper

None of the ones you list matches the three params.

First param should be of the form settings.input (where input is the name you gave your input)

I got it to work using settings/inputs. I was trying to hard code the
device name as there’s only one of them. Bottom line, it’s working now.
Thank you.

  • ->>> John <<<-*
1 Like