# 设备远程监控接入说明 ## 遥测数据上报 PLC 或边缘网关使用登录后的 Bearer Token 调用: `POST /environmentAccess/deviceMonitor/report` ```json { "deviceLedgerId": 1, "temperature": 72.5, "pressure": 0.86, "vibration": 3.2, "energy": 12.6, "collectTime": "2026-11-03 10:30:00" } ``` 服务端会根据设备台账阈值判定 `normal`、`warning` 或 `alarm`,异常状态首次出现或升级时,通过 `/environmentAccess/deviceMonitor/alarm-stream` 实时推送给在线页面。 ## 远程启停网关 在配置文件中增加统一控制网关地址;令牌建议从环境变量读取,不要直接写入版本库: ```yaml unattended: device-control: gateway-url: http://127.0.0.1:9000/api/device/control auth-token: ${DEVICE_CONTROL_TOKEN:} ``` 系统向网关发送: ```json { "deviceId": 1, "deviceName": "空压机 1#", "action": "start", "commandTime": "2026-11-03T10:30:00" } ``` 网关返回任意 2xx 状态码视为设备确认,随后系统更新运行状态;连接失败或非 2xx 时不会修改状态。未配置网关地址时使用本地联调模式。 ## 自动模拟采集 默认每 30 秒自动生成一组联调数据。接入真实 PLC/网关后应关闭模拟采集: ```yaml unattended: telemetry: auto-collect-enabled: false collect-interval-ms: 30000 ```