Just playing around here, but trying to implement a Switch statement using a text variable. Here is my code. It doesn't work and wondering if it is possible and how to do it.
The best first step would be figuring out what exactly doesn’t work. Putting some log statements through throughout your code to see what is or isn’t running would be the biggest help for that. For example, you could put one at the beginning of your handler method to see if it’s running--And maybe also print the value of evt.value to see if it’s what you expect.
Just spitballing here, but suggest casting toString and make sure you have breaks; and strange to have the case 'uppercase' in the evt.value, so add a default to tell you what you missed.
String name = evt.value.toString()
switch (name) {
case "Name1": log.debug "Name is $name"; break
case "Name2": log.debug "Name is $name"; break
default:
log.debug "${device.displayName} did not process name:$name
}