联犀 联犀
首页
使用指南
开发指南
技术分享
  • 中台接口 (opens new window)
  • 物联网接口 (opens new window)
在线体验 (opens new window)
  • gitee (opens new window)
  • github (opens new window)
  • 边缘网关-RHILEX (opens new window)
  • 边缘网关-opengw (opens new window)
首页
使用指南
开发指南
技术分享
  • 中台接口 (opens new window)
  • 物联网接口 (opens new window)
在线体验 (opens new window)
  • gitee (opens new window)
  • github (opens new window)
  • 边缘网关-RHILEX (opens new window)
  • 边缘网关-opengw (opens new window)
  • 介绍

  • 快速开始

  • 设备接入

    • 联犀协议

      • 设备身份认证
      • mqtt认证
      • http协议接入
      • 自定义协议
      • mqtt认证主要流程
      • 设备动态注册
      • 物模型协议
      • OTA升级
      • NTP时间同步
      • 网关子设备
      • 设备本地日志上报
      • 设备远程配置
      • RHILEX接入
        • 简介
        • 操作流程
          • 新建产品
          • 新建物模型
          • 新建设备
          • 设备接入
          • 指令下发
          • 指令下发响应
          • 数据上报
        • 注意事项
      • openGW接入
    • 第三方协议

  • 系统管理模块

  • 合作案例

  • 使用指南
  • 设备接入
  • 联犀协议
godLei6
2024-10-05
目录

RHILEX接入

# 简介

联犀是一个基于golang实现的轻量级物联网平台,具备数据存储,设备接入,设备管理、物模型等功能。RHILEX有强大的数据处理能力和外部系统接入能力,本文主要展示如何通过RHILEX边缘规则引擎将Modbus数据推送到联犀。

# 操作流程

# 新建产品

首先在联犀系统内新建一个网关产品:

新建成功后联犀会生成一个产品示例:

# 新建物模型

然后根据自己的数据字段来新建物模型。建好的物模型如下所示:

# 新建设备

产品设计完成以后新建一个设备。

新建设备完成后即可在列表查看:

# 设备接入

接下来在RHILEX端新建联犀接入。首先在联犀平台找到对应的产品ID、设备名、秘钥,然后填入资源配置参数里面即可。

新建成功以后就会生成一个接入资源:

同时联犀管理后台也会提示上线:

# 指令下发

在调试界面测试指令下发效果:

# 指令下发响应

当联犀下发指令的时候,可以通过配置回调函数来执行,下面的示例是用来执行iothub的一个简单闪烁LED的指令:

Actions = {
    function(args)
        Debug("[====] Received Remote Data:" .. args)
        local dataT, errJ2T = json:J2T(args)
        if (errJ2T ~= nil) then
            Throw('json:J2T error:' .. errJ2T)
            return false, args
        end
        if dataT.method == "control" then
            Debug("[====] IThings Send Control CMD:" .. args)
            if dataT.params.led1 == 0 then
                rhilexg1:Led1Off()
            end
            if dataT.params.led1 == 1 then
                rhilexg1:Led1On()
            end
            if dataT.params.do1 == 1 then
                rhilexg1:DO1Set(1)
            end
            if dataT.params.do1 == 0 then
                rhilexg1:DO1Set(0)
            end
            if dataT.params.do2 == 1 then
                rhilexg1:DO2Set(1)
            end
            if dataT.params.do2 == 0 then
                rhilexg1:DO2Set(0)
            end
            local errIothub = IThings:ActionReplySuccess('OUTSKGLIQJX', dataT.msgToken)
            if errIothub ~= nil then
                Throw("data:ToMqtt Error:" .. errIothub)
                return false, args
            end
        end
        return true, args
    end
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

同时RHILEX的Debug窗口也会打印出来日志:

注意

注意:该示例仅仅在rhilexg1网关内有效,具体的设备操作接口有所不同。

# 数据上报

数据上报也可以通过脚本来实现,下面是个简单的示例:

Actions = {
    function(args)
        local errIothub = iThings:PropertyReport('DEVICE62MJLVLS', {
            temp = 12.45,
            humi = 45.6,
            oxygen = 23.1
        })
        if errIothub ~= nil then
            Throw("iThings:PropertyReport Error:" .. errIothub)
            return false, args
        end
        return true, args
    end
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

上报的数据示例:

注意

注意:需要提前在联犀系统内建好物模型。

# 注意事项

  • 本次实验用到的设备为RHILEX Pro1边缘计算网关(https://www.hootrhino.com/ecosystem (opens new window))。
  • 具体的设备级IO接口操作函数不是通用的,比如rhilex pro1就没有GPIO。
上次更新: 2025/02/17, 09:47:32
设备远程配置
openGW接入

← 设备远程配置 openGW接入→

Theme by Vdoing | Copyright © 2022-2025 昆明云物通科技有限公司|GNU | 滇ICP备2024043132号-1 |
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式