I didn’t look over your JavaScript… just make sure that both JSONPath and JS xform Add-ons are installed
edit: what do you want to send to the command topic? a string based on the state of the UK_WE2_Livingroom_ScreenSwitch
Item ?
Why would you send the existing state (transformed) as a command?
What should be send when you toggle the Switch ON and what when OFF?
By the way: why not Zigbee binding ?