From a ZigBee extension lead I get states for each of the sockets like msg.payload.state_l1. I'm using node.send to filter out the rest so the button node will work.
This works, but it outputs as msg.payload and I can't get the JSON correct to output msg.payload.state_l1. So I want to change the payload: bit to something like payload.state_l1: but so it works.
Not exactly answering your question, but....
Wouldn't this be an opportunity to simplify the format of the zigbee msg, and instead of passing another JSON object (where you would then need to extract the value again later), move the value to payload, and add a msg.topic such as 'zigbee3' or something clearer like 'lounge_lighting', so the it can be easily identified as it runs through the flow.
This does work for the switch on the dashboard but it doesn't update if the device is physically pressed.
The switch node is set to JSON with {"state_l1":"ON"} and {"state_l1":"OFF"} for on and off, and it seems like it has to only have that message to trigger. If state_l2 and l3 is present in the object it doesn't work.
Took me awhile to figure this out as the zigbee2mqtt sends out a single state message if done from Node RED but not if the button physically pressed or triggered from another device, so it worked some of the time.
I've fixed it with a change node to move payload to payload.state_l1 for each of the outputs.
I was using the original message as I had to send it back to a MQTT node the same way for it to work. Just wish the dashboard stuff allowed me use something other than payload.