Transform String „OFF“ to Switch OFF

All,

I get a long string using curl from a website.
From the response I extract multiple states like „OFF“ as a string.

Currently I check something like:
if(string.state == „OFF“) {
Switch.postUpdate(OFF).
}

I have seen something more straight forward somewhere like with a transform „OFF“ to switch state OFF within one LOC.
I cannot find it again, though.

Could someone please give me a hint?

The postUpdate and sendCommand accept strings too:

Switch.postUpdate(string.state.toString).

The toString is there to force the DSL parser to pass a string just in case

Cool stuff.
Thanks a lot.

Thanks for your response.
As always, I will check out your design pattern tips as well :slight_smile:
Very helpful, Rich!