Subscribing to device events

I’m finding the ability to subscribe to device attributes is fairly useless.

The passed data only contains the change - is there any way to know which device the change was on?

If I do something like the below - I get told when a switch changes state, or hue/saturation is changed - but I have no idea on which device the change occured.

def deviceAttributes = theDevice.supportedAttributes
for ( attr in theDevice.supportedAttributes ) {
	def attrName = "${attr}"
	subscribe(theDevice, attrName, stateChange)
}

The event should contain the deviceid

https://graph.api.smartthings.com/ide/doc/event

2 Likes