如何通过 Beaglebone ZigBee Gateway 将传感器数据发布到 Bluemix

How to publish sensor data to Bluemix via Beaglebone ZigBee Gateway

我有三个 TI CC2650 SensorTags 运行 ZigBee(不是 BLE),它们连接到 Beaglebone Black 运行 Zstack 网关。我希望将传感器数据发布到 Bluemix,但找不到配方。

我见过 BLE 传感器通过 BBB 网关连接然后像这样连接到 Bluemix 的示例

https://github.com/ibm-messaging/iot-beaglebone

但我找不到任何基于 ZigBee 的传感器。

我需要一些帮助才能开始,因为我不确定我是否可以从头开始。

如有任何指导,我们将不胜感激。是否可以使用此 BLE 示例并对 json 代码进行一些编辑?

谢谢! 约翰

请看这个: https://git.ti.com/zigbee-iot-agent/zigbee-iot-agent

这是一个节点 js 应用程序,连接到 ZStack Linux 网关(运行 在 BBB 上)并提供以下功能:

  • 将 ZigBee 设备(灯、温度传感器、光传感器、开关)抽象为 JSON 对象。这已通过 Philips Hue Lights、TI ZLights (https://store.ti.com/cc2530zdk-zll-cc-debugger.aspx) 和 ZigBee 传感器标签(运行 ZigBee FW 可从 BLE iOS 应用程序下载)进行测试。

  • 提供一个网页,让您可以控制 ZigBee 网络和设备。

  • 将设备数据转发到 QuickStart 服务,无需 Bluemix 帐户即可访问。

  • Web 界面可用于供应设备,以便它们可以连接到供应的 Bluemix 服务。这是控制设备所必需的,但确实需要一个 Bluemix 帐户。

这是一个示例节点红色流,用于根据传感器标签光传感器报告的发光来控制光级别:

[{"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"]]}]

此致, TC.

您可以使用 python 的 Requests framework,它可以通过 url post 您的数据。 (REST 方法)您可以使用 post、get、put、delete 等。