近期,笔者发布了有关我们改造开源物联网平台Thingsborad的几篇文章,总体来讲CE版本还是很棒的,提供了物联网平台该有的基础能力。Thingsboard CE版本提供了Gateway网关能力,实现了物联平台和设备之间互联的功能。还是和往常一样,我们在研究的过程中,通过“物联网平台Thingsboard之Gateway使用实例”,尝试“接入bacnet/ip协议数据实现空调控制”,以此达到我们所改造平台和设备的协调一致。下面就将这个小小的使用示例或实例,分享给大家,感兴趣的朋友可以搭建平台并运行体验,或者私信联系我们体验。

1、基本介绍

Thingsboard gateway 目前只能接入bacnet/ip 协议的数据,非ip协议的bacnet的模块还不能直接接入;因此,在测试bacnet网关功能要主要购买带有bacnet/ip网关的产品;

2、硬件产品

采购的产品为海思Igate400网关和两个温控器,温控器与网关的通讯是走标准modbus RTU。

3、ip网关配置

ip网关配置好网络后,可以得到ip地址和port端口; 例如:ip=192.168.254.88 port=47808

4、打开海思Igate400网关的扫描工具!

工业物联网网关开源(开源物联网平台ThingsBoard之gateway网关配置空调控制实例)(1)

5、thingsboard gateway的bacnet配置

{ "devices": [ { "address": "192.168.254.88:47808", "attributeUpdates": [ { "key": "brightness", "objectId": "analogOutput:1", "propertyId": "presentValue", "requestType": "writeProperty" } ], "attributes": [ { "key": "temperature", "objectId": "analogOutput:1", "propertyId": "presentValue", "type": "string" } ], "deviceName": "BACnet Device ${objectName}", "deviceType": "default", "pollPeriod": 10000, "serverSideRpc": [ { "method": "set_state", "objectId": "binaryOutput:1", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_state", "objectId": "binaryOutput:1", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_ok", "objectId": "analogOutput:1", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_ok", "objectId": "analogOutput:1", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_fan", "objectId": "analogOutput:3", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_fan", "objectId": "analogOutput:3", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_backlight", "objectId": "analogOutput:25", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_backlight", "objectId": "analogOutput:25", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_state1", "objectId": "binaryOutput:3", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_state1", "objectId": "binaryOutput:3", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_ok1", "objectId": "analogOutput:96", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_ok1", "objectId": "analogOutput:96", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_fan1", "objectId": "analogOutput:98", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_fan1", "objectId": "analogOutput:98", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" }, { "method": "set_backlight1", "objectId": "analogOutput:120", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "writeProperty" }, { "method": "get_backlight1", "objectId": "analogOutput:120", "propertyId": "presentValue", "requestTimeout": 10000, "requestType": "readProperty" } ], "timeseries": [ { "key": "temperature", "objectId": "analogOutput:1", "propertyId": "presentValue" }, { "key": "backlight", "objectId": "analogOutput:25", "propertyId": "presentValue" }, { "key": "backlight1", "objectId": "analogOutput:120", "propertyId": "presentValue" }, { "key": "temperature1", "objectId": "analogOutput:96", "propertyId": "presentValue" } ] } ], "general": { "address": "192.168.254.201/24", "maxApduLengthAccepted": 1024, "objectIdentifier": 599, "objectName": "TB_gateway", "segmentationSupported": "segmentedBoth", "vendorIdentifier": 15 }, "name": "BACnet" }

6、启动网关后,在云平台的设备列表得到bacnet的设备

工业物联网网关开源(开源物联网平台ThingsBoard之gateway网关配置空调控制实例)(2)

7、配置dashboard,增加卡片部件和控制部件

工业物联网网关开源(开源物联网平台ThingsBoard之gateway网关配置空调控制实例)(3)

8、测试:通过温度旋钮发送数据到温控器,实现温度调节

(1)调节前

工业物联网网关开源(开源物联网平台ThingsBoard之gateway网关配置空调控制实例)(4)

(2)调节后

工业物联网网关开源(开源物联网平台ThingsBoard之gateway网关配置空调控制实例)(5)

可以看出,通过温控器按钮调节温度是有了变化的。

时间仓促,也没写多少文字,只是大概写了几个实例的执行思路,通过这些步骤基本实现了对空调温度的控制,当然里面的细节有时还是需要大家认真对待哦。

,