I have an app in which I select multiple motion sensors and subscribe to events.
The issue is once I the event handler is called I’m trying to find out which device generated the event then call a custom handler on the device.
so according to the docs
should return the device object, hence I should call
to call my handler. When I’m debugging it, I can see $event.device shows the name of the device, however when it does event.device.customHandler() I’m getting a null object exception.
What am I missing here? Isn’t the event.device a device object on which I can call the handler?
The work around is to get the event.deviceId and then match that with the list of devices selected, which is kinda roundabout.