How to change the state of a tile?

createEvent just returns a Event object. It doesn’t fire it. (The parse method of a DTH fires the Event of its return command).

So sendEvent() is the correct method to call.

I’m not sure at a glance why the code isn’t working, but it’s helpful to look at the docs and several simple examples from the SmartThings GitHub.

There are quirks.

Try, for example, using just “tamper” rather than “device.tamper” in the Tile definition. It might work.