sendEvent from SmartApp not working

For those who would be interested in a workaround I’ve found :
You can use the method “sendLocationEvent” which is supposed to trigger location events, but in fact can raise any event type you would need.
To raise device related events, you will need the deviceId of the device itself, which is not supposed to be a problem if you can access to the deviceWrapper object that your “input” statement give.
You can use sendLocationEvent like this :
> sendLocationEvent(name:"switch", value:"on", data:[ . . .], descriptionText: "description you want", deviceId: :"the-128bit-device-identifier-here", source: "DEVICE", isStateChange:true)
The parameters “source” and “isStageChange” are necessary to trigger the event. The system is made not to propagate raised events if there is no state change
You have to understand that it will not make your device to switch on, but, it will propagate the event through your ZigBee network and trigger any smartapp that rely on this kind of event (through “subscribe” statements)

3 Likes