[Solved] Item Sync Rules no longer work with openhab 2.4

Hi kind people, I have the below rule to sync 2 lights which worked just fine (thanks Rich) with OH 2.2.
Now after changing to OH 2.4, it doesnt work. I have read the docs but have not managed to get even close.

rule "sync Front Lights"

when
    Item SW2_01_2 changed or
    Item SW2_02_1 changed
then
    val newState = triggeringItem.state

    if(SW2_01_2.state != newState) SW2_01_2.sendCommand(newState)
    if(SW2_02_1.state != newState) SW2_02_1.sendCommand(newState)
end

Bellow is the error from the log

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'sync Front Lights': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.Number) on instance: null

Any help greatly appreciated.

It’s grizzling about Number, which seems odd - I guess your Items are Switch types.

Try
SW2_01_2.sendCommand(newState.toString)

Hi rossko57, even though I led you astray you still worked it out. The problem was introduced by openhab ver 2.4 not the mqtt 2. I very much appreciate the help,
James

You’d still expect it to work. Rules is just weird sometimes.