Don’t. Maybe this will help -
States are not commands, even when they look alike. Sending xxxItem.state
as a command is quite often problematic. You’ll find it does not work with a simple Switch type Item.
someSwitch.sendCommand(otherSwitch.state) // this will FAIL
// because state OFF is not command OFF
Although when it is a Number or a Quantity (number with units), it usually works.
The bomb-proof workaround is to send a string as command, because the command parser will always try to parse out the type of command it is looking for.
myItem.sendCommand(otherItem.state.toString)