Dump that command node. That’s really confusing. I’m still baffled as to where you found that. You already have z2m set up.
You need to use a trigger that goes into an out node that runs the command
As you see in my flow above:
zigbee motion happens with an in node
it’s filtered from active and inactive which then turns the lights on, but when inactive turns the lights off after 20 seconds. If movement happens, then the timer is stopped until inactive again.
The light off is into an out node for the other zigbee device. All of the commands happen within that node. No extra nodes need to be added to control the device.
You can import this flow and take a look
[{"id":"f6a48bf2cf19d842","type":"switch","z":"437f14e945a3983d","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":1480,"wires":[["28cf2ffe3fa3223c"],["47c86147ba15ec70"]]},{"id":"28cf2ffe3fa3223c","type":"stoptimer","z":"437f14e945a3983d","duration":"20","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":750,"y":1460,"wires":[["681b77f5f2052ccd","602f790fcdcb9f03"],[]]},{"id":"8ad14bdb693b8f6a","type":"change","z":"437f14e945a3983d","name":"stoptimer","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":1500,"wires":[["28cf2ffe3fa3223c","1648bbbbb1f64b8a","79c36da4c6cf5e84"]]},{"id":"1648bbbbb1f64b8a","type":"zigbee2mqtt-out","z":"437f14e945a3983d","name":"","server":"c292ab1e.8d2318","friendly_name":"SPAREBedroomLampL","device_id":"0xb0ce18140362d0a6","command":"state","commandType":"z2m_cmd","payload":"on","payloadType":"z2m_payload","x":990,"y":1500,"wires":[]},{"id":"681b77f5f2052ccd","type":"zigbee2mqtt-out","z":"437f14e945a3983d","name":"","server":"c292ab1e.8d2318","friendly_name":"SPAREBedroomLampL","device_id":"0xb0ce18140362d0a6","command":"state","commandType":"z2m_cmd","payload":"off","payloadType":"z2m_payload","x":990,"y":1460,"wires":[]},{"id":"47c86147ba15ec70","type":"switch","z":"437f14e945a3983d","name":"","property":"spare_button_single","propertyType":"global","rules":[{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":550,"y":1500,"wires":[["8ad14bdb693b8f6a"]]},{"id":"41f5672677dc1054","type":"zigbee2mqtt-in","z":"437f14e945a3983d","name":"","server":"c292ab1e.8d2318","friendly_name":"SpareBedroomMotion","device_id":"0x000d6f00057c1d88","state":"occupancy","outputAtStartup":true,"x":260,"y":1480,"wires":[["f6a48bf2cf19d842"]]},{"id":"602f790fcdcb9f03","type":"zigbee2mqtt-out","z":"437f14e945a3983d","name":"","server":"c292ab1e.8d2318","friendly_name":"SPARELampRight","device_id":"0xb0ce18140362cbc4","command":"state","commandType":"z2m_cmd","payload":"off","payloadType":"z2m_payload","x":1250,"y":1460,"wires":[]},{"id":"79c36da4c6cf5e84","type":"zigbee2mqtt-out","z":"437f14e945a3983d","name":"","server":"c292ab1e.8d2318","friendly_name":"SPARELampRight","device_id":"0xb0ce18140362cbc4","command":"state","commandType":"z2m_cmd","payload":"on","payloadType":"z2m_payload","x":1250,"y":1500,"wires":[]},{"id":"c292ab1e.8d2318","type":"zigbee2mqtt-server","name":"COREZ2M","host":"10.10.2.1","mqtt_port":"1883","mqtt_username":"johnnysilverhand","mqtt_password":"9^P+Y)[7yy}]","mqtt_qos":"0","tls":"","usetls":false,"base_topic":"zigbee2mqtt"}]