How to reset timer if state changes?

You can create a Virtual Switch in the SmartThings app by clicking Menu, then Labs, then Virtual Switch

But I prefer to use @TAustin’s “vEdge Creator: a virtual device generator for end users”, it is much more robust and useful. You can learn more about it here: