Tile switching back on with sendEvent


I’m doing a small app to control a device that is on my local LAN, which I’m doing a new deviceHandler for.

The device has the switch capability and can be switched on/off from a tile.

When the switched is toggled I want to send a HTTP request to another device on the LAN, I’m doing this by having the handler sendEvent and then using a hubAction in my smartApp.

Handler code:

def on() {

log.debug "Executing 'on'"
sendEvent(name: "switch", value: "on");


All works very well with the minor exception being that the tile indicating the state has a tendency to turn itself back on eventhough the user just switched it off. The error does however only occur when I use the sendEvent call from the “def on()” callback in the deviceHandler, if I remove it the switch behaves nicely.

Has anyone experienced similar or have thoughts on how to trouble shoot is?


Try adding isStateChange: true to the sendEvent function

sendEvent(name: “switch”, value: “on”, isStateChange: true);

With isStateChange: true it now toggles back everytime i use the switch, instead of everyother :)…

But thanks for the idea!