Please take a look at this:
https://git.ti.com/zigbee-iot-agent/zigbee-iot-agent
This is a node js application that connects to the ZStack Linux Gateway (running on BBB) and offers the following features:
Abstracts the ZigBee devices (Lights, Temp Sensors, Light Sensors, Switches) into JSON objects. This has been tested With Philips Hue Lights, TI ZLights (https://store.ti.com/cc2530zdk-zll-cc-debugger.aspx) and the ZigBee Sensor tag (running the ZigBee FW available to download from the BLE iOS app).
Serves up a web page allowing you to control the ZigBee network and devices.
Forwards devices data to the QuickStart service, which can be accessed without a Bluemix account.
The web interface can be used to provision devices so they can connect to a provisioned Bluemix service. This is required to control devices, but does need a Bluemix account.
Here is an example node red flow for controlling a Lights level based on the Luminescence reported from the Sensor Tag Light sensor:
[{"id":"12345678.abcde","type":"ibmiot","name":"a-4sogfzc9cogqrg7d"},{"id":"12345678.abcde","type":"ibmiotin","authentication":"apiKey","apiKey":"12345678.abcde","inputType":"evt","deviceId":"001289ec0b10","applicationId":"","deviceType":"","eventType":"","commandType":"","format":"","name":"IBM IoT AppIn","service":"registered","allDevices":false,"allApplications":"","allDeviceTypes":true,"allEvents":true,"allCommands":"","allFormats":true,"x":434,"y":260,"z":"6581e5ae.9a7e1c","wires":[["fbbb817e.04448"]]},{"id":"12345678.abcde","type":"ibmiotout","authentication":"apiKey","apiKey":"12345678.abcde","outputType":"cmd","deviceId":"0012dc63f111","deviceType":"zbdevice","eventCommandType":"blink","format":"json","data":"{\"a\":\"on\":1}","name":"Light0012dc63f111Out","service":"registered","x":1026,"y":260,"z":"6581e5ae.9a7e1c","wires":[]},{"id":"fbbb817e.04448","type":"function","name":"LuminToLevel","func":"var lightMsg ={\n\t\"payload\": {\n\t \"a\": {\n\t\t \"on\":1,\n\t\t \"level\":255,\n\t}\n\t}\n};\n\t\n//light sensor Lumin is 0-0xFFFF, may this to 0xFF-0 light level\nlightMsg.payload.a.level= 0xFF -msg.payload.d.lumin / 0x100;\n\n//bound check\nif(lightMsg.payload.a.level > 0xFF)lightMsg.payload.a.level = 0xFF;\n//if(lightMsg.payload.a.level < 0)lightMsg.payload.a.level = 0;\n\nreturnlightMsg;\n","outputs":1,"valid":true,"x":639,"y":260,"z":"6581e5ae.9a7e1c","wires":[["cebf6c53.31409"]]},{"id":"cebf6c53.31409","type":"json","name":"","x":807,"y":260,"z":"6581e5ae.9a7e1c","wires":[["a9314c4.f56ceb"]]}]
Regards,
TC.