modify: aibox_sophon_adapter

This commit is contained in:
2026-07-27 14:26:48 +08:00
parent 98ee0e29af
commit f95857f1f0
10 changed files with 97 additions and 3 deletions
@@ -0,0 +1,8 @@
# board_ping — MQTT 心跳上报端点
# 设备通过 MQTT 主题 /board_ping 上报系统状态信息
# MQTT Bridge 自动路由到 chongming/aibox_sophon_adapter/board_ping
[MQTT]
summary = "AI Box 设备心跳上报"
docstring = "设备通过 MQTT 定期上报系统参数及状态信息,包含芯片温度、硬盘、内存、通道、任务、TPU 等"
auth_required = false
+16
View File
@@ -0,0 +1,16 @@
[worker]
name = "aibox_sophon_adapter"
version = "0.1.0"
description = "AI Box Sophon 设备适配器 — MQTT 心跳上报与设备状态监控"
config_version = "1.0"
defaults = { method = "GET", timeout = 30, auth_required = false, cacheable = false, internal = false }
[worker.registration]
router_prefix = "/aibox"
tags = ["aibox", "sophon", "adapter"]
# 心跳超时配置(秒),超过此时间未收到心跳视为离线
[worker.heartbeat]
interval = 5 # 设备上报间隔(秒)
timeout = 15 # 超时阈值(秒),超过此时间未收到心跳视为离线
check_interval = 10 # 服务端检查离线设备的间隔(秒)
@@ -0,0 +1,13 @@
# get_device — 查询单个设备详情
[GET]
summary = "查询单个设备详情"
docstring = "根据 BoardId 查询设备的完整心跳数据和在线状态"
params = ["board_id: str"]
auth_required = false
[GET.response_model]
board_id = { type = "str", required = true }
is_online = { type = "bool", required = true }
last_ping_time = { type = "str", required = false }
ping_data = { type = "dict", required = false }
@@ -0,0 +1,11 @@
# get_offline_devices — 查询离线/异常设备
[GET]
summary = "查询离线/异常设备列表"
docstring = "返回所有超过心跳超时时间未上报的设备列表"
params = []
auth_required = false
[GET.response_model]
offline_devices = { type = "list[dict]", required = true }
total = { type = "int", required = true }
@@ -0,0 +1,11 @@
# list_devices — 查询所有设备状态
[GET]
summary = "查询所有设备状态"
docstring = "返回所有已上报过心跳的设备及其在线状态和最后心跳时间"
params = []
auth_required = false
[GET.response_model]
devices = { type = "list[dict]", required = true }
total = { type = "int", required = true }