State.remove() - what have I got wrong?

state."${thisKey}" = [onoff: 'off', level:0, hue: 0, sat:0, colortemp: 2700]
state.remove("${thisKey}")

It's not being removed. How do you remove this sort of multi-key entry?

You need

state.remove(thisKey)

thisKey is a string. "$thisKey" is a gstring

4 Likes

Brilliant - thanks! Grrr I thought I'd tried it every way lol

Download the Hubitat app