Extrapolate Device Network ID from Device Input


(Adam Outler) #1

Hi,
I’m trying to figure out a good way to extract the network ID from a specified device.

Lets say I have a switch

preferences {
    section() {
        input "myswitch", "capability.switch"
    }
}

I want to get the NetworkID of that switch from within my Device Type, so I can send a Zigbee Command over to it.

How can I do this?


(Eric) #2

myswitch.deviceNetworkId


(Adam Outler) #3

That doesn’t seem to be working.

This is my code

...
     section() {
        input "myswitch", "capability.switch"
    }
...
final ArrayList < String[] > getDevices() {
  log.trace settings.myswitch
  log.trace settings.myswitch.deviceNetworkId
...

And I’m getting this output

2:19:05 PM: error groovy.lang.MissingPropertyException: No such property: deviceNetworkId for class: java.lang.String @ line 153
2:19:05 PM: trace afbddadb-c2aa-4172-880b-ec0d16fb556b

So, it’s reading the device as a string, and it is not able to obtain the NetworkID or the Endpoint. How do i get the networkID from this?


(Ben W) #4

I believe deviceNetworkId is only for IP based products (not zigbee).

What are you trying to do that you need the netwrok id? ST can send commands to the switch with myswitch.on or any function in the device handler.


(Adam Outler) #5

SmartApps don’t handle lights well because they are rather slow. Zigbee is instantaneous. Zigbee is more appropriate for controlling lights. Device Type requires manual entry of the NetworkID and the endpoints for the lights. When the network id changes, you have to manually update it. I’m trying to avoid the manual update.


(Adam Outler) #6

I’m still looking for information.

I think I could write a smart app that would receive a specific event and then update the device state, which could be read next time the device operates. Is this correct? Can I have a device send a “device” reference within an event, then the smart app can look up the address and send it back? Is this a viable option?

This seems like something that should be part of SmartThings infrastructure.


(John) #7

Did you get anywhere with this?