-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
95 additions
and
84 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
title: 配置说明 | ||
description: A guide in my new Starlight docs site. | ||
sidebar: | ||
order: 3 | ||
--- | ||
import { Tabs, TabItem } from '@astrojs/starlight/components'; | ||
|
||
## 配置说明 | ||
config.json 是 driver-box 用于实现设备接入的描述文件。通常情况下用户只需完成该文件的编写,便可实现设备接入。 | ||
|
||
该文件的主体结构如下所示: | ||
```json5 | ||
{ | ||
"deviceModels": [ | ||
{ | ||
"name": "circuit_breaker-2", | ||
"modelId": "65a641ce06a7d4709b5b31b9", | ||
"description": "", | ||
"devicePoints": [ | ||
|
||
], | ||
"devices": [ | ||
|
||
] | ||
} | ||
], | ||
"connections": { | ||
|
||
}, | ||
"protocolName": "modbus" | ||
} | ||
``` | ||
|
||
|
||
<Tabs> | ||
<TabItem label="config.json" icon="seti:csv"> | ||
| 参数名 | 类型 | 必填 | 说明 | | ||
|:-----------------------------------|--------|:---|:-----------------------------------------------------------------| | ||
| deviceModels | array | 必填 | 物模型配置。用于定义特定通讯协议类型`protocolName`的物模型及其接入设备列表 | | ||
| connections | object | 必填 | 连接配置,不同类型的插件配置各不相同 | | ||
| protocolName | string | 必填 | 协议插件名称,有效范围:<ul><li>[modbus](/driver-box/plugins/modbus/)</li><li>bacnet</li><li>mqtt</li><li>[mirror](/driver-box/export/mirror/)</li></ul> | | ||
</TabItem> | ||
<TabItem label="deviceModels" icon="seti:csv"> | ||
| 参数名 | 类型 | 必填 | 说明 | | ||
|:-----------------------------------|--------|:---|:-----------------| | ||
| name | string | 必填 | 设备模型名称,又可称为物模型名称 | | ||
| modelId | string | 必填 | 物模型 ID | | ||
| description | string | 可选 | 设备模型描述 | | ||
| devicePoints | array | 必填 | 设备点表配置 | | ||
| devices | array | 必填 | 设备列表 | | ||
</TabItem> | ||
<TabItem label="devicePoints" icon="seti:csv"> | ||
| 参数名 | 类型 | 必填 | 说明 | | ||
|:------------|--------|:---|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| name | string | 必填 | 点位名 | | ||
| description | string | 可选 | 点位描述 | | ||
| valueType | string | 必填 | 点位值类型,有效范围:int、float | | ||
| readWrite | string | 必填 | 点位读写类型,有效范围:<ul><li>R : 只读</li><li>W : 只写</li><li>RW : 读写</li></ul> | | ||
| unit | string | 可选 | 点位单位,例如:℃、m、s、m³ | | ||
| reportMode | string | 必填 | 点位上报模式,有效范围:<ul><li>`realTime`: 实时上报</li><li>`change`: 变化上报</li></ul> | | ||
| scale | float | 可选 | 点位值系数换算。<br/>读操作时,会将从设备读取到的值乘以 scale 得到最终值。例如:scale=0.1,则从设备读取到的值为10,则最终值为1。<br/>写操作时,将设定值除以 scale 得到设备可写入的值。例如:scale=0.1,设置点位写入值为1,则最终值为10。 | | ||
| decimals | float | 可选 | 保留小数位数,仅针对valueType=float的点位有效。例如:decimals=2,则最终值为1.00。<br/>当decimals=0时,表示不保留小数。<br/>当decimals=1时,表示保留一位小数。<br/>当decimals=2时,表示保留两位小数。<br/>当decimals=3时,表示保留三位小数。<br/>当decimals=4时, | | ||
|-|-| 可选 | 插件扩展点表配置。不同类型的插件会在上述配置的基础上额外添加新的配置项。例如:Modbus插件在配置中添加了`slaveId`、`timeout`等配置项。<br/><ul><li>[modbus](#modbus连接配置)</li><li>[bacnet](#bacnet连接配置)</li></ul> | | ||
|
||
</TabItem> | ||
<TabItem label="devices" icon="seti:csv"> | ||
| 参数名 | 类型 | 必填 | 说明 | | ||
|-------------|----|----|-----------------------------------------------------------------------------------------------------| | ||
| sn |string| 必填 | 设备序列号 | | ||
| description |string| 选填 | 设备描述 | | ||
| ttl |string| 选填 | 设备离线阈值,超过该时长没有收到数据视为离线。<br/>示例:<ul><li>`1m`: 1分钟</li><li>`1h`: 1小时</li><li>`1d`: 1天</li></ul>默认:24h | | ||
|connectionKey|string| 必填 | 设备连接标识 | | ||
|properties|object| 选填 | 设备属性。通常用于配置设备的保留属性或连接相关信息。 | | ||
</TabItem> | ||
</Tabs> | ||
|
||
|
||
**保留属性** | ||
|
||
保留属性是 driver-box 为设备提供的扩展信息配置能力。这类属性的业务逻辑交由用户实现,driver-box 只作配置的持久化。 | ||
|
||
目前开放的保留属性如下: | ||
- _area:设备所处的区域信息 | ||
- _parent_sn:父级设备 SN | ||
- _system_id:设备所属的系统 ID | ||
|
||
### 连接配置 | ||
- [modbus](/driver-box/plugins/modbus/#modbus连接配置) | ||
- bacnet | ||
- mqtt | ||
- http server | ||
- http client | ||
- tcp server | ||
- tcp client |