.lowerCase

I am using the latest smarthome designer. When uploading the XBMC rule from this boardi get an error that the .lowercase (on line7) is undefined for the type string. Is this a designer bug or something has changed in OH2 syntax?

rule "Adjust Living lighting when XBMC starts/stops"
when
Item XbmcLiving_Player changed
then
var String state = XbmcLiving_Player.state.toString()
logInfo("XBMC State:", state.toString)
switch (state.lowerCase) {
case "play" :  {
	   		sendCommand(Light_GF_Living_Floor, OFF)
	   		sendCommand(Light_GF_Living_Iris, OFF)
	   		sendCommand(Light_GF_Living_Strip, OFF)
			 }
case "pause" : {
	   		sendCommand(Light_GF_Living_Floor, ON)
	   		sendCommand(Light_GF_Living_Iris, ON)
	   		sendCommand(Light_GF_Living_Strip, ON)
}
case "stop"  : {
	   		sendCommand(Light_GF_Living_Floor, ON)
	   		sendCommand(Light_GF_Living_Iris, ON)
	   		sendCommand(Light_GF_Living_Strip, ON)
}
}
end

Have you instead tried state.toLowerCase?

1 Like

As always- your fixes work like a charm. Thanks

1 Like