新增功能: - 配网管理模块 (provisioning.py): 支持设备扫描、配网、超时处理 - 配网配置步骤: UI 配置流程增加配网参数配置(Network Key, App Key 等) - 分组管理:支持 SIG 分组和 VENDOR 分组的加入/删除操作 - HA 服务调用:7 个配网和分组相关的服务 文件变更: - const.py: 添加配网相关常量(CONF_NETWORK_KEY, PROV_TIMEOUT 等) - config_flow.py: 增加 prov_config 配置步骤和 OptionsFlow 菜单 - provisioning.py: 新建配网管理器(ProvisioningManager 类) - coordinator.py: 集成配网管理器,添加配网状态管理方法 - services.py: 新建服务定义和注册 - services.yaml: HA 服务定义文件 - __init__.py: 集成服务注册和卸载 - PRD.md: 更新服务调用接口和配置参数文档 配网功能说明: - 首次使用需配置 Network Key, App Key, Network ID, IV Index - 配网超时时间:180 秒 - 组地址范围:0xC000 - 0xCFFF - 支持 SIG 标准分组和 VENDOR 自定义分组
183 lines
4.2 KiB
YAML
183 lines
4.2 KiB
YAML
# SigMesh Gateway 服务定义
|
||
|
||
# 开始扫描设备
|
||
start_scan:
|
||
name: 开始扫描设备
|
||
description: 开始扫描可用的 Bluetooth Mesh 设备
|
||
fields: {}
|
||
|
||
# 停止配网
|
||
stop_provisioning:
|
||
name: 停止配网
|
||
description: 停止当前的配网操作
|
||
fields: {}
|
||
|
||
# 开始配网
|
||
start_provisioning:
|
||
name: 开始配网
|
||
description: 开始配网指定的设备
|
||
fields:
|
||
device_address:
|
||
name: 设备地址
|
||
description: 要配网的设备地址(16 进制字符串)
|
||
example: "001A"
|
||
required: true
|
||
selector:
|
||
text:
|
||
|
||
# 绑定 App Key
|
||
bind_appkey:
|
||
name: 绑定 App Key
|
||
description: 为已配网设备绑定 App Key
|
||
fields:
|
||
device_address:
|
||
name: 设备地址
|
||
description: 设备地址(16 进制字符串)
|
||
example: "001A"
|
||
required: true
|
||
selector:
|
||
text:
|
||
element_address:
|
||
name: 元素地址
|
||
description: 元素地址(默认为 0)
|
||
example: 0
|
||
default: 0
|
||
required: false
|
||
selector:
|
||
number:
|
||
min: 0
|
||
max: 255
|
||
|
||
# 添加设备到组
|
||
add_to_group:
|
||
name: 添加到组
|
||
description: 将设备添加到指定的组地址
|
||
fields:
|
||
target_address:
|
||
name: 目标设备地址
|
||
description: 目标设备地址(16 进制字符串)
|
||
example: "001A"
|
||
required: true
|
||
selector:
|
||
text:
|
||
element_address:
|
||
name: 元素地址
|
||
description: 元素地址(默认为 0)
|
||
example: 0
|
||
default: 0
|
||
required: false
|
||
selector:
|
||
number:
|
||
min: 0
|
||
max: 255
|
||
group_address:
|
||
name: 组地址
|
||
description: 组地址(16 进制字符串,建议使用 0xC000 以上)
|
||
example: "C001"
|
||
required: true
|
||
selector:
|
||
text:
|
||
model_id:
|
||
name: Model ID
|
||
description: Model ID(16 进制,默认 0x1100 传感器)
|
||
example: 4352
|
||
default: 4352
|
||
required: false
|
||
selector:
|
||
number:
|
||
min: 0
|
||
max: 65535
|
||
is_sig:
|
||
name: SIG 标准分组
|
||
description: 是否为 SIG 标准分组(默认为 true)
|
||
example: true
|
||
default: true
|
||
required: false
|
||
selector:
|
||
boolean:
|
||
|
||
# 从组中移除设备
|
||
remove_from_group:
|
||
name: 从组移除
|
||
description: 将设备从指定的组地址移除
|
||
fields:
|
||
target_address:
|
||
name: 目标设备地址
|
||
description: 目标设备地址(16 进制字符串)
|
||
example: "001A"
|
||
required: true
|
||
selector:
|
||
text:
|
||
element_address:
|
||
name: 元素地址
|
||
description: 元素地址(默认为 0)
|
||
example: 0
|
||
default: 0
|
||
required: false
|
||
selector:
|
||
number:
|
||
min: 0
|
||
max: 255
|
||
group_address:
|
||
name: 组地址
|
||
description: 组地址(16 进制字符串)
|
||
example: "C001"
|
||
required: true
|
||
selector:
|
||
text:
|
||
model_id:
|
||
name: Model ID
|
||
description: Model ID(16 进制,默认 0x1100 传感器)
|
||
example: 4352
|
||
default: 4352
|
||
required: false
|
||
selector:
|
||
number:
|
||
min: 0
|
||
max: 65535
|
||
is_sig:
|
||
name: SIG 标准分组
|
||
description: 是否为 SIG 标准分组(默认为 true)
|
||
example: true
|
||
default: true
|
||
required: false
|
||
selector:
|
||
boolean:
|
||
|
||
# 发送 VENDOR 命令
|
||
send_vendor_command:
|
||
name: 发送 VENDOR 命令
|
||
description: 发送 VENDOR 自定义命令到设备
|
||
fields:
|
||
target_address:
|
||
name: 目标设备地址
|
||
description: 目标设备地址(16 进制字符串)
|
||
example: "001A"
|
||
required: true
|
||
selector:
|
||
text:
|
||
element_address:
|
||
name: 元素地址
|
||
description: 元素地址(默认为 0)
|
||
example: 0
|
||
default: 0
|
||
required: false
|
||
selector:
|
||
number:
|
||
min: 0
|
||
max: 255
|
||
opcode:
|
||
name: 操作码
|
||
description: VENDOR 操作码(16 进制字符串)
|
||
example: "1102"
|
||
required: true
|
||
selector:
|
||
text:
|
||
payload:
|
||
name: 数据负载
|
||
description: 数据负载(16 进制字符串,不含空格)
|
||
example: "0000"
|
||
required: true
|
||
selector:
|
||
text:
|