Skip to content

Releases

v0.8.6

Choose a tag to compare

@github-actions github-actions released this 25 Nov 08:38

[0.8.6] - 2026-11-25

新增

  • Modbus 点位级字节序布局:设备点位新增「字节序布局」配置(device_address.byte_order),留空 = 跟随设备 protocol_json。可选集合按值宽度:16 位 ABCD/BADC,32 位 ABCD/CDAB/BADC/DCBA,64 位 ABCDEFGH/CDABGHEF/BADCFEHG/HGFEDCBA/GHEFCDAB/DCBAHGFE,字符串仅 ABCD/BADC。切换数据类型会清空失效布局;保存与 Excel 导入按宽度校验。采集、控制下发与点位扫描共用同一布局,布局参与配置校验和,改完热加载生效。导入模板新增第七列「字节序布局」,旧六列文件仍可导入。
  • 欧姆龙 FINS 点位级字节序布局:四种 FINS 协议(UDP/TCP/Serial/HostLinkTCP)同样支持点位级 ByteOrderLayout,覆盖 16/32/64 位数值与 BCD/LBCD/Date;空串沿用设备级 byteOrder/wordOrder,读写共用同一份布局。FINS 的字符串、bool 与 8 位类型(以及任何位地址)没有点位级布局,保存时拒绝、前端不显示。后端新增协议白名单:只有 Modbus 与 FINS 接受非空布局,其余协议保存/导入时明确报错,不再「能存但被驱动静默忽略」;导入模板的布局下拉也随设备协议收敛。
  • 属性绑定点位支持两级分页选择:新增 GET /thingModel/pageThingModelPointDevices(仅返回有点位的设备,带 pointCount,按名称/编码搜索)与 GET /thingModel/pageThingModelPointOptions(按设备分页的点位候选,按地址名/说明搜索),镜像到 /agentApi。属性弹窗改用「先设备、后点位」的选择器,全量 listThingModelPointOptions 保留兼容。
  • 物模型复制:新增 POST /thingModel/copyThingModel,按 ID 复制一条新模型,只带基础信息(标识/名称/分类/版本/描述/状态),不复制属性;标识与名称自动追加 -copy 后缀并查重(-copy2…),返回 {id, code, name},镜像到 /agentApi。控制台模型详情头新增复制按钮,复制后直接选中副本。

Added

  • Point-level byte order layout for Modbus points: points gain a byte-order layout setting (device_address.byte_order); empty follows the device's protocol_json. Available layouts depend on value width: ABCD/BADC for 16-bit, ABCD/CDAB/BADC/DCBA for 32-bit, ABCDEFGH/CDABGHEF/BADCFEHG/HGFEDCBA/GHEFCDAB/DCBAHGFE for 64-bit, and ABCD/BADC for strings. Switching the data type clears a layout that no longer applies; saving and Excel import validate against the width. Collection, control writes and point scan share the same layout, which is part of the config checksum, so changes apply via hot reload. The import template gains a seventh "byte order layout" column; old six-column files still import.
  • Point-level byte order layout for Omron FINS: all four FINS protocols (UDP/TCP/Serial/HostLinkTCP) support ByteOrderLayout for 16/32/64-bit numeric types plus BCD/LBCD/Date; an empty string follows the device-level byteOrder/wordOrder, and reads and writes share the layout. FINS strings, bool, 8-bit types and any bit address have no point-level layout: they are rejected on save and hidden in the dialog. The backend now enforces a protocol allowlist: only Modbus and FINS accept a non-empty layout, and other protocols return a clear error on save/import instead of storing a value the driver silently ignores. The import template's layout dropdown follows the device protocol as well.
  • Two-level paged point picker for property binding: adds GET /thingModel/pageThingModelPointDevices (only devices that have points, with pointCount, searchable by name/code) and GET /thingModel/pageThingModelPointOptions (a device's points paged, searchable by address name/label), mirrored to /agentApi. The property dialog now picks a device first and then a point; the full listThingModelPointOptions stays for compatibility.
  • Thing-model duplication: POST /thingModel/copyThingModel copies a model by ID with only its basics (code / name / category / version / description / status) and no properties; the code and name get a -copy suffix with collision avoidance (-copy2…), and the response returns {id, code, name}. Mirrored to /agentApi; the console's model detail header gains a duplicate action that selects the copy.

变更

  • 物模型标识支持改名:编辑物模型时可修改模型标识,全表仍保持唯一(撞名报 41001,格式非法报 41007)。设备绑定按模型 id 关联,改名不断绑;但开放接口、导入导出与订阅映射里按旧标识配置的引用需同步更新——开放接口按 code 定位模型,拿旧标识再 upsert 会落成新模型。编辑弹窗在标识被改动时把提示切到警示色。
  • 物模型属性标识符支持改名:编辑属性时可修改标识符,模型内仍保持唯一(撞名报 41003,格式非法报 41008)。点位绑定按 property_id 关联,改名不断绑;但映射、脚本与推送里按旧标识符命中的引用需同步更新。采集侧把属性标识符纳入配置校验和,改名后自动热加载,记录中的 propertyCode 随新值更新;错误码 41009 保留但不再下发。
  • 物模型属性列表展示绑定点位:属性与点位已改为 1 对 1,「点位数」恒为 0/1、没有信息量,该列改为「绑定点位」,直接展示 设备名称.点位名称(点击仍打开点位明细抽屉),未绑定显示「未绑定」。属性分页与全量接口的响应新增 pointDeviceName / pointName;存量多绑数据显示首个点位并以 +N 提示剩余条数。
  • 依赖 SDK v0.6.0 与官方驱动 v0.6.1(新增 FINS 点位级布局):线协议 APIVersion 由 4 进位到 5,全部插件必须与主二进制成对重编;旧插件在新网关、新插件在旧网关上均会在握手期被拒绝。
  • 物模型属性数据类型改为纯说明:属性的 kind 不再作为点位绑定的兼容性前提(不再报 41016),绑定点位时不校验类型;管理页面(属性列表、新增/编辑弹窗、点位选择器)不再展示数据类型,新建、编辑、Excel 导入与开放接口均允许留空(未指定)。被点位绑定后仍禁止修改 accessMode(41018),但 kind 随时可改。采集与推送本就不依赖属性类型,运行时行为不变。
  • 属性与点位改为严格 1 对 1:一个属性最多绑定一个点位(addressIds 上限 1,超出报新错误码 41022),从点位侧绑定同样受约束;存量多绑属性照常读取,保存时收敛为选中的那一条。
  • 控制台表单改版:设备对象页改为主从工作台——左侧设备列表、右侧直接管理该设备的点位,原点位页与设备页共用同一面板;设备、物模型、属性、推送通道的新增/编辑弹窗统一为分区卡片,推送通道先选类型再填参数。
  • 物模型改为主从工作台:物模型页左侧为模型列表、右侧直接维护选中模型的属性,选中项同步到 URL(?modelId=),窄屏切换为「列表 / 详情」二选一;模型标识可一键复制。原独立属性页保留为旧深链与属性控制下发的返回落点,主体复用同一属性面板。

Changed

  • Thing-model codes can be renamed: the model dialog now allows editing the model code while keeping it unique across all models (41001 on collision, 41007 when malformed). Device bindings are keyed by the model id, so renaming does not unbind; however, external references configured with the old code (open API, import/export, subscription mappings) must be updated — the open API locates models by code, so a later upsert with the old code creates a new model. The dialog switches its code hint to the warning color once the value is changed.
  • Thing-model property identifiers can be renamed: the property dialog now allows editing the identifier while keeping it unique within the model (41003 on collision, 41008 when malformed). Point bindings are keyed by property_id, so renaming does not unbind; mappings, scripts and pushes that match the old identifier must be updated. The collector includes property identifiers in its config checksum, so a rename hot-reloads and new records carry the new propertyCode; error code 41009 is kept but no longer emitted.
  • Property list shows the bound point: properties and points are now 1:1, so a point count of 0/1 carries no information. The column becomes "Bound Point" and shows deviceName.pointName directly (clicking still opens the point detail drawer), with "Not bound" when empty. The paged and full property responses gain pointDeviceName / pointName; legacy multi-bound rows show the first point plus +N remaining.
  • Depends on SDK v0.6.0 and official drivers v0.6.1 (adding the FINS point-level layout): the wire APIVersion moves from 4 to 5, so all plugins must be rebuilt together with the main binary; old plugins are rejected at handshake by a new gateway, and vice versa.
  • Thing-model property data type is now descriptive only: a property's kind is no longer a binding compatibility prerequisite (the 41016 check is gone), so point type is not validated on binding; the admin UI (property list, create/edit dialog and point picker) no longer shows it, and create, edit, Excel import and the open API all accept an empty value (unspecified). A point-bound property still locks accessMode (41018), while kind can change at any time. Collection and pushing never depended on the property type, so runtime behavior is unchanged.
  • Property-to-point binding is strictly 1:1: a property binds at most one point (addressIds capped at 1, exceeding returns the new 41022), and binding from the point side enforces the same rule; legacy multi-bound rows still load and converge to the selected point on save.
  • Console form redesign: the device page becomes a master-detail workbench — a device list on the left and that device's points managed on the right, sharing one panel with the original point page; the device, thing-model, property and push-channel create/edit dialogs share sectioned cards, and a push channel picks its type before its parameters.
  • Thing models become a master-detail workspace: the thing-model page shows a model list on the left and manages the selected model's properties on the right, with the selection reflected in the URL (?modelId=); narrow screens switch between list and detail, and the model code is copied with one click. The standalone property page stays as the landing for legacy deep links and the property-control back link, reusing the same property panel.

Full Changelog: v0.8.5...v0.8.6

v0.8.5

Choose a tag to compare

@github-actions github-actions released this 21 Nov 09:21

[0.8.5] - 2026-11-21

新增

  • 物模型属性独立页与属性级控制下发:属性从模型抽屉独立为页面(/industrial/thing-model/:id/properties,支持按标识符/名称筛选、点位抽屉与「控制下发」入口)。一个属性可绑定多台设备的点位,属性控制页按设备分行、逐台确认写入;实时页与属性页共用写入弹窗(ControlWriteDialog)。
  • 物模型菜单开关:运行开关新增 ui.thingModelMenu.enabled(default.yaml 的 ui 段,热读)。关闭只隐藏左侧「物模型」菜单,路由、数据与采集均不受影响。
  • 开放接口点位对象补充属性字段:4.3 批量点位标签与 4.4/4.5 点位对象统一返回 propertyId / propertyIdentifier / propertyName / propertyModelId / propertyModelName(未绑定为空串);新增 listAllThingModelProperties 跨模型属性下拉,并镜像到 /agentApi。
  • Apache IoTDB 2.x 推送通道:新增 iotdb-v2 时序通道,经官方 Go 原生客户端(Thrift RPC,纯 Go 免 CGO,默认 6667)写入 IoTDB 2.x 树模型。每个 (设备, 点位) 映射为设备路径 {database}.{device}_{address}_{hash},value 按 kind 落到 value_bool / value_int / value_float / value_str 测量列,quality 与物模型/属性编码逐行写入;支持单机与集群(nodes)、TLS、RPC 压缩、攒批与断网缓存补发。序列依赖服务端 enable_auto_create_schema=true(2.x 默认)。

变更

  • 物模型不再绑定设备:移除 deviceIds 与设备页的物模型选择(device.model_id 列仅保留旧库兼容),属性通过 addressIds 直接绑定任意设备的点位,单次上限仍为 200。采集记录的 thingModelCode 改由点位绑定的属性所属模型推导。开放接口配置同步支持点位级 modelCode,设备级 modelCode 仅作默认命名空间;设备导入模板由 6 列减为 5 列(去掉「物模型」)。物模型删除保护改为仅看属性是否仍被点位绑定(41005)。
  • 推送按「设备 + 采集组 + 物模型」拆帧:同一设备的点位绑定不同模型时拆成多帧,保证帧内 thingModelCode 一致、主题模板不串。
  • 接口调整:移除 listThingModelDeviceOptions、listThingModelDevices 与物模型列表的 deviceCount;listThingModelPointOptions 改为返回全部设备点位;设备点位对象补充 propertyModelId / propertyModelName;属性分页新增 keyword(同时匹配标识符与名称)。菜单与文档中的「设备地址标签」统一更名为「设备点位」。
  • 时序入库组件独立为可复用 Go 模块:新增仓库内模块 github.com/Ellisata/iot-gateway/tsdb,集中通用记录模型、Writer/Sink 契约、投递层(非阻塞队列、断网缓存、补发与最近写入观测)及 TDengine / InfluxDB / IoTDB 后端;backend/push 以适配器与类型别名沿用原通道 API,MQTT / HTTP / Kafka / OPC UA 通道无需改动。Docker 构建纳入 tsdb/ 作为本地 replace 目标。

Added

  • Standalone property page and property-level control: properties move out of the model drawer into their own page (/industrial/thing-model/:id/properties, with identifier/name search, a point drawer and a control entry). One property may bind points across devices; the property control page lists devices separately and confirms each write per device. The realtime page and the property control page share one write dialog (ControlWriteDialog).
  • Thing-model menu switch: runtime config gains ui.thingModelMenu.enabled (ui section of default.yaml, hot-read). Turning it off only hides the sidebar entry; routes, data and collection are unaffected.
  • OpenAPI point objects gain property fields: batch point labels (4.3) and point objects (4.4/4.5) now return propertyId / propertyIdentifier / propertyName / propertyModelId / propertyModelName (empty when unbound). Adds listAllThingModelProperties for a cross-model property picker, mirrored to /agentApi.
  • Apache IoTDB 2.x push channel: a new iotdb-v2 time-series channel writes to the IoTDB 2.x tree model through the official Go native client (Thrift RPC, pure Go, CGO-free, port 6667). Each (device, point) maps to a device path {database}.{device}_{address}_{hash}; values land in value_bool / value_int / value_float / value_str measurements by kind, with quality and thing-model/property codes written row by row. Supports standalone and cluster (nodes), TLS, RPC compression, batching and offline spool replay. Time-series auto-creation relies on the server's enable_auto_create_schema=true (the 2.x default).

Changed

  • Thing models no longer bind devices: deviceIds and the device-page model picker are removed (device.model_id is kept only for old databases). Properties bind points of any device through addressIds, still capped at 200 per request. thingModelCode in collection records is derived from the model owning the point's bound property. OpenAPI config sync supports point-level modelCode with device-level modelCode as the default namespace; the device import template drops from six columns to five (no "thing model" column). Model deletion is now blocked only when its properties are still bound to points (41005).
  • Push frames are bucketed by device + group + thing model: points tied to different models on one device are split into separate frames so thingModelCode stays consistent per frame and topic templates never cross models.
  • API changes: listThingModelDeviceOptions, listThingModelDevices and the model list's deviceCount are removed; listThingModelPointOptions now returns points from all devices; device point objects gain propertyModelId / propertyModelName; property paging gains keyword (matches identifier and name). "Device address label" is renamed to "device point" across menus and docs.
  • Time-series ingestion extracted into a reusable Go module: a new in-repo module github.com/Ellisata/iot-gateway/tsdb houses the neutral record model, the Writer/Sink contracts, the delivery layer (non-blocking queue, offline spool, replay and recent-write observation) and the TDengine / InfluxDB / IoTDB backends. backend/push keeps its channel API through an adapter and type aliases, so MQTT / HTTP / Kafka / OPC UA channels are untouched. The Docker build includes tsdb/ as the local replace target.

Full Changelog: v0.8.4...v0.8.5

v0.8.4

Choose a tag to compare

@github-actions github-actions released this 20 Nov 15:12

[0.8.4] - 2026-11-20

修复

  • 同一串口上的多台设备交替超时:串口独占驱动(SerialExclusive)的采集互斥从
    「设备」提升到「物理端口」,同一端口上的所有设备(含控制下发)共用一把总线锁,
    整条总线串行收发。端口名按 driver.CanonicalSerialPort 归一(Windows 大小写与
    \\.\、Linux /dev/serial/by-id 软链),与插件共享句柄的判据一致。
  • 跨插件共用物理口(issue #2 的终局修复):同一端口上分属不同协议的设备,
    若所用插件都声明了 SerialProxy,采集任务会打开网关串口代理 —— 物理句柄只由
    网关主进程持有,插件经 serial.open/lock/read/write/unlock/close 反向 RPC 收发
    字节,并共用网关的跨进程总线锁(pluginhost/serialhost.go)。混有不支持代理的
    插件时保持各自直连并 WARN(需分口或 DTU);同协议共用为 INFO(插件进程内
    driversdk/serialbus 已共享句柄)。设计见 backend/specs/serial-proxy.md。
  • 依赖 SDK v0.5.0(driver.CanonicalSerialPort、driversdk/serialbus、
    driversdk/serialproxy)。网关新增直接依赖 github.com/goburrow/serial(BSD-3),
    仅用于代理持有物理端口。

Fixed

  • Multiple devices on one serial port timed out alternately: the collection
    mutex for serial-exclusive drivers (SerialExclusive) is now keyed by
    physical port instead of device. Every device on the same port (including
    control writes) shares one bus lock, so the whole bus is serialized. Port names
    are canonicalized with driver.CanonicalSerialPort (Windows case / \\.\,
    Linux /dev/serial/by-id symlinks), matching the rule plugins use to share
    handles.
  • Cross-plugin sharing of one physical port (the end-game fix for issue #2):
    when devices on one port belong to different protocols and every plugin
    involved declares SerialProxy, task construction enables the gateway serial
    proxy — the gateway process owns the only physical handle and plugins exchange
    bytes over the serial.open/lock/read/write/unlock/close reverse RPC, sharing
    the gateway's cross-process bus lock (pluginhost/serialhost.go). A port that
    mixes in a plugin without proxy support stays direct with a WARN (split it or
    use a DTU); a bus shared by one protocol is INFO (the in-process
    driversdk/serialbus already shares the handle). Design:
    backend/specs/serial-proxy.md.
  • Depends on SDK v0.5.0 (driver.CanonicalSerialPort,
    driversdk/serialbus, driversdk/serialproxy). The gateway gains a direct
    dependency on github.com/goburrow/serial (BSD-3), used only by the proxy to
    own the physical port.

v0.8.3

Choose a tag to compare

@github-actions github-actions released this 20 Nov 01:53

[0.8.3] - 2026-11-20

新增

  • 本机数据备份与恢复(P0):新增 .igbak 备份包(manifest + VACUUM INTO 一致性快照 + 外部 default.yaml / <APP_ENV>.yaml / 插件清单),在线备份不阻塞采集与推送;后台默认每 6 小时生成一次,保留 14 份 / 512MB,超限删最旧。恢复必须停服执行,校验 sha256、integrity_check、schema 兼容性与数据目录排他锁后,把 db / -wal / -shm 三件套一起替换,旧库保留为 *.pre-restore-<时间戳>;支持 takeover(保留网关 ID)与 clone(重新生成 ID)两种身份模式。CLI:iot-gateway backup create|list|verify、iot-gateway restore --bundle ... [--identity clone] [--restore-config] [--yes]。设计见 backend/specs/data-backup.md。
  • 备份配置段:default.yaml 新增 backup.*(enabled / dir / defaultScope / startupDelayMinutes / intervalHours / keep / maxTotalMB / snapshotTimeoutSeconds)。备份目录与文件权限收紧为 0700 / 0600;包内含 MQTT 口令、开放接口密钥与用户口令哈希,上传异机前仍需另行加密(P2)。
  • CLI 子命令入口:backup / restore 在 main() 中先于 Windows 服务检测解析;磁盘 default.yaml 损坏时 CLI 回退到内置默认路径,仍可按 --db / --dir 完成紧急恢复。
  • 本机备份与恢复(P1):新增 config 范围白名单快照(用户、设备、点位、物模型、推送通道、订阅、触发规则、运行开关、开放接口密钥、网关身份),不含 push_outbox / alarm / control_log 等运行与历史表。配置白名单表写入后 60 秒防抖生成 config 包,启动 5 分钟后先备一份基线;定时任务仍每 6 小时生成 full。config 恢复采用表级覆盖而不是整库替换:停服后在一个事务里删除并复制白名单表,保留当前报警历史、控制审计与断网缓存,事务前另存完整库副本。管理端新增 /backup/*(列表、状态、创建、下载、删除、暂存、上传、取消待恢复),只走管理员 JWT,刻意不挂 /openApi 与 /agentApi。上传/暂存只做校验,重启时在 InitDB 之前应用;校验失败时目录改名为 restore-pending.failed-<ts>,旧库照常启动。备份、下载、删除、暂存与恢复均写入 data/backups/audit.log。新增页面「系统设置 → 备份与恢复」,CLI 支持 backup create --scope config 与 restore --pending。
  • 物模型绑定管理:创建/编辑物模型可直接绑定设备(deviceIds),创建/编辑属性可直接绑定设备点位(addressIds),均为三态同步(省略 = 不改、空数组 = 全部解绑、非空 = 以列表为准),单次上限 200。已有点位绑定属性的设备拒绝改绑/解绑模型(41013);已绑定其他属性的点位拒绝抢绑(41019);同一设备对同一属性只能绑一个点位(41021)。新增错误码 41019–41021。
  • 物模型绑定查询接口:/thingModel 新增 listThingModelDeviceOptions(设备候选,keyword 远程搜索、locked 标记、超 200 条 truncated)、listThingModelDevices(模型已绑设备)、listThingModelPointOptions(属性表单点位候选,kind 由协议类型推导)、listThingModelPropertyPoints(属性已绑点位),并镜像到 /agentApi。物模型列表新增「设备数」抽屉,属性列表新增 pointCount 与「点位数」抽屉;表单支持多选绑定与锁定/类型不符的原因提示。
  • 协议插件卸载:协议页新增「卸载插件」入口,粒度为插件文件而非单行(一个插件可供给多个协议,确认弹窗会列出全部)。执行顺序为停插件进程 → 删除 plugins/ 下的二进制并清理热升级残留的 .old 文件 → 删除其供给的 iot_protocol 行(含表单)。卸载前按 device.protocol_id 反查设备(含停用设备),仍有引用时拒绝并列出设备名与协议名(90009);只接受插件目录内的文件名,路径注入被拒。Windows 上必须先退役进程再删文件(运行中的 exe 不能直接删除);若文件删不掉,下一轮扫描会重新加载插件,状态回到卸载前而不是留下半死状态。管理端新增 GET /plugin/list(插件 → 协议名映射)与 POST /plugin/uninstallPlugin,镜像到 /agentApi,不开放到 /openApi;新增错误码 90008–90010。插件文件意外消失时仍沿用既有策略保留协议行,只有显式卸载才删行。
  • FANUC 机器人 CIP 驱动:新增 FANUC.CIP 协议(iot-driver-fanuc),经 EtherNet/IP(CIP 显式消息)读写数值寄存器 R[]——整型 0x6B / 实型 0x6C,连接前用 ListIdentity 校验厂商号 591。同一 class 下间隙 ≤16 的连续点位自动合并为 Get_Attribute_All 块读(默认 100 个/请求、上限 124,设 1 关闭);设备拒绝或数据错位时退回单读并暂停块读 5 分钟。位置寄存器、DI/DO 与字符串寄存器暂不支持。协议总数 15 → 16,drivers.version 升至 v0.4.1。
  • 压测工具覆盖 FANUC:backend/cmd/loadtest 新增 -protocol fanuc 与 -fanuc-block,假设备在 TCP 44818 上同时应答 UDP ListIdentity;建库批次由 2000 行降为 1000 行,避开 SQLite 绑定变量上限(10 设备 × 1000 点位矩阵此前报 too many SQL variables)。

变更

  • 同一数据目录只允许一个网关实例:启动时在数据目录获取 OS 级排他锁(Unix flock / Windows LockFileEx),锁被占用时拒绝启动。这同时让 restore 能可靠判断“服务是否已停止”。
  • WAL 维护器不再把进程内备份快照误报为外部读者:备份期间跳过 “pinned by an external reader” 的 WARN(降级为 Debug)。CLI 跨进程备份仍可能看到该 WARN,属预期。
  • 点位属性绑定唯一性:设备点位创建/修改(含 /openApi 配置同步 upsert)新增「同一设备同一属性只能绑一个点位」校验,先返回 41021 而不是 SQLite 唯一约束原文。属性改类型/读写模式前可同时清空绑定,一次保存完成。

修复

  • 实时值长文本撑破单元格:实时监控与设备点位列表里的长十六进制 / 字符串值改为单行省略号截断,悬停显示完整值,质量标签不再被挤出单元格。

Added

  • Local backup and restore (P0): introduces the .igbak bundle (manifest + consistent VACUUM INTO snapshot + external default.yaml / <APP_ENV>.yaml / plugin manifest). Online backups do not block collection or pushing; the scheduler runs every 6 hours by default and keeps 14 bundles / 512 MB, deleting the oldest when over the limit. Restore requires the gateway to be stopped: it verifies sha256, integrity_check, schema compatibility and the data-directory lock, then replaces the db / -wal / -shm trio together and keeps the old database as *.pre-restore-<timestamp>. Both takeover (keep the gateway ID) and clone (regenerate the ID) identity modes are supported. CLI: iot-gateway backup create|list|verify, iot-gateway restore --bundle ... [--identity clone] [--restore-config] [--yes]. Design: backend/specs/data-backup.md.
  • Backup configuration: default.yaml gains backup.* (enabled / dir / defaultScope / startupDelayMinutes / intervalHours / keep / maxTotalMB / snapshotTimeoutSeconds). The backup directory and files are tightened to 0700 / 0600; bundles contain MQTT credentials, OpenAPI keys and password hashes, so off-machine copies still require separate encryption (P2).
  • CLI subcommands: backup / restore are parsed in main() before Windows service detection. If the on-disk default.yaml is broken, the CLI falls back to the built-in defaults and can still perform an emergency restore via --db / --dir.
  • Local backup and restore (P1): adds a config scope whitelist snapshot (users, devices, points, thing models, push channels, subscriptions, trigger rules, runtime switches, OpenAPI secrets, gateway identity) that excludes runtime and history tables such as push_outbox / alarm / control_log. Writes to config tables trigger a config bundle after a 60-second debounce, with a baseline bundle 5 minutes after startup; scheduled backups still produce a full snapshot every 6 hours. Restoring a config bundle performs table-level replacement instead of replacing the database file: after the service is stopped, whitelisted tables are deleted and copied in one transaction, preserving alarm history, control audit and offline buffering, with a full pre-restore copy saved first. Adds admin-only /backup/* endpoints (list, status, create, download, delete, stage, upload, cancel pending), deliberately not mounted under /openApi or /agentApi. Upload/stage only validates; the restore is applied on the next startup before InitDB. If validation fails the directory is renamed restore-pending.failed-<ts> and the old database starts normally. Backup, download, delete, stage and restore are recorded in data/backups/audit.log. New UI page under System Settings → Backup & Restore; CLI supports backup create --scope config and restore --pending.
  • Thing-model binding management: creating/updating a thing model can bind devices (deviceIds), and creating/updating a property can bind device points (addressIds); both use tri-state sync (omitted = unchanged, empty = unbind all, non-empty = authoritative), capped at 200 per request. Devices with points bound to properties cannot be re-bound/unbound from a model (41013); points bound to another property are never stolen (41019); one device may bind at most one point to a property (41021). New error codes 41019–41021.
  • Thing-model binding query APIs: /thingModel gains listThingModelDeviceOptions (device candidates with keyword remote search, locked flag and truncated past 200), listThingModelDevices (devices bound to a model), listThingModelPointOptions (property-form point candidates with kind derived from the protocol type) and listThingModelPropertyPoints (points bound to a property), all mirrored to /agentApi. The model list gains a "device count" drawer and the property list gains pointCount plus a "point count" drawer; forms support multi-select binding with reasons for locked/incompatible entries.
  • Protocol plugin uninstall: the protocol page gains an "Uninstall Plugin" action whose unit is the plugin file, not a single row (one plugin may supply several protocols, and the confirmation dialog lists them all). It stops the plugin process, deletes the binary under plugins/ together with any hot-upgrade .old leftover, then deletes the iot_protocol rows (and their forms) supplied by that plugin. Before unloading it looks up devices by device.protocol_id (disabled devices included) and refuses while any remain, listing device and protocol names (90009); only file names inside the plugin directory are accepted, so path injection is rejected. On Windows the process must be retired before the file can be removed (a running exe cannot be deleted); if the file cannot be deleted, the next scan reloads the plugin and the state returns to pre-uninstall instead of a half-dead one. Admin endpoints: GET /plugin/list (plugin → protocol mapping) and POST /plugin/uninstallPlugin, mirrored to /agentApi and deliberately not exposed under /openApi; new error codes 90008–90010. When a plugin file disappears unexpectedly, protocol rows are still kept as before — only an explicit uninstall deletes them.
  • FANUC robot CIP driver: adds the FANUC.CIP protocol (iot-driver-fanuc), reading and writing numeric registers R[] over EtherNet/IP (CIP explicit messaging) — integer object 0x6B, real object 0x6C — with vendor ID 591 verified via ListIdentity before connecting. Contiguous points of the same class (gap ≤16) are merged into Get_Attribute_All block reads (100 registers per request by default, max 124; set 1 to disable); on rejection or shifted data the driver falls back to single reads and pauses block reads for 5 minutes. Position registers, DI/DO and string registers are not supported yet. Protocol count 15 → 16 and drivers.version bumped to v0.4.1.
  • FANUC coverage in the load-test tool: backend/cmd/loadtest gains -protocol fanuc and -fanuc-block; its fake device answers ListIdentity on the same port over UDP alongside TCP 44818. Seeding now batches 1000 rows instead of 2000 to stay under SQLite's bound-variable limit (the 10 × 1000 device/point matrix previously failed with too many SQL variables).

Changed

  • One gateway instance per data directory: startup takes an OS-level exclusive lock on the data directory (Unix flock / Windows LockFileEx) and refuses to start w...
Read more

v0.8.2

Choose a tag to compare

@github-actions github-actions released this 17 Nov 07:42

[0.8.2] - 2026-11-17

新增

  • 点位级工程量变换:设备点位新增「工程量变换」(device_address.transform_json,迁移 036_device_address_transform.sql),在采集侧对原始值执行一次 scale / round / trim / default 流水线。实时值、点位阈值报警、触发规则、断网缓存与全部推送通道(MQTT / Kafka / HTTP / OPC UA / TDengine / InfluxDB)使用同一个工程值,时序库不再需要单独配置换算。scale(或保留小数位的 round)会把数值点位的 kind 提升为 float,OPC UA 整数节点相应提升为 Double;变换失败保留原值并限频记录日志。出站 mapping-json 的 transform 仍作为展示层保留,迁移到点位级后应删除通道侧重复的 scale。
  • 点位配置列表展示绑定与变换:设备点位配置列表新增「工程量变换」列,展示 缩放 ×0.1 → 四舍五入 2 位 形式的可读摘要(悬停看完整流水线),未配置时显示「原始值」;「物模型属性」列不再在窄屏下隐藏 —— 绑定关系与换算规则都属于排查采集值的必要信息。
  • 开放接口配置同步:/openApi 新增配置同步接口(文档 4.16):能力协商 GET /config/capabilities、物模型 / 设备点位 / 推送通道 / 告警 Webhook / 运行开关的脱敏只读(附 contentHash),以及推送通道、告警 Webhook、运行开关、设备点位的批量写入。只改网关配置、不触达设备,逐条部分成功;"***" 表示保留现有密钥,hash 采用 sha256-canonical-json-v1(密钥只计存在性)。物模型 upsert 新增 replaceProperties 删除未出现的属性;新增错误码 42001–42009。
  • 开放接口推送通道连通性测试:/openApi 新增 POST /pushChannel/testConnectivity(文档 4.16.7),用调用方传入的类型与未保存的通道配置真实连接一次下游(MQTT / HTTP / 时序库等)后立即断开,供管理平台保存推送通道前校验。configJson 与配置同步的 config 同结构,但密钥必须是真实值("***" 无法鉴权);失败时原样返回网关的具体原因(口令错误、地址不可达、端口拒绝)。只探测,不落库、不改网关配置。
  • 开放接口采集组列表:/openApi 新增 GET /collectorGroup/list(文档 4.16.2),按可选 deviceId 返回网关各设备的采集组,供管理平台推送通道「采集组订阅」下拉框使用 —— config.groupIds 是网关本地主键,平台只能从网关取这份列表。采集组 VO 新增设备编码 deviceCode,便于平台按「设备编码 + 组编码」与主数据对齐。
  • 开放接口出站映射预览:/openApi 新增 POST /pushChannel/previewMapping(文档 4.16.8),用网关内固定样例批次试编码 native-json / group-json / mapping-json / script,供管理平台可视化映射编辑器与无需映射的格式即时预览;native-json / group-json 不需要 mapping,只按 format 选编码器。只编码,不发送、不落库,映射或编码错误放在 data.error 而不当作接口失败。
  • 开放接口推送通道运行状态:/openApi 新增 GET /pushChannel/status(文档 4.22),返回推送引擎内存快照(运行/连接状态、队列与补发深度、发布/写出/丢弃计数、最近成功与错误),供管理平台按网关聚合监控。只读、不触达下游;计数重启清零,仅含已启用且加载成功的通道。
  • 物模型分类支持平台自定义 code:开放接口的分类校验由内置枚举改为格式校验(小写字母开头、≤32),词表由管理平台维护;本地管理端仍只能新建内置分类,但会保留并展示已下发的自定义分类。
  • Docker 基础镜像可覆盖:Dockerfile 新增 NODE_IMAGE / GOLANG_IMAGE / ALPINE_IMAGE 构建参数,docker-compose.yml 透传同名环境变量,便于切换国内镜像源或私有 registry,默认仍为官方标签。
  • 发现广播携带平台信息:notify / reply 新增 os / arch 字段,取自 Go 的 runtime.GOOS / runtime.GOARCH(如 linux/amd64、linux/arm64、windows/amd64),供管理平台发现网关后下发与它匹配的插件二进制。字段带 omitempty,旧版接收方照常解析。
  • 开放接口插件二进制下发:/openApi 新增 GET /plugin/info(平台 / 命名规则 / 上传限制)、GET /plugin/status(已加载插件的 sha256 快照)与 POST /plugin/importPlugin(multipart 上传,可选 X-Content-SHA256 完整性校验),供管理平台按 os/arch 选包下发;上传仍受 plugin.enabled、单文件 / 单批 / 请求体上限约束,新增错误码 90007(文档 4.17)。
  • 开放接口设备扫描:/openApi 新增设备扫描接口(文档 4.18):能力查询、发起 / 查询 / 续扫 / 取消、点位扫描能力,以及两种点位扫描——已下发设备按 deviceCode 取网关侧配置,未下发设备按 protocolName + protocolJson 用平台主数据配置直接扫描;discoverPointsFromScan 按 jobId + index 扫描结果中的设备,连接配置由服务端从任务快照取,不采信客户端。只提供扫描能力,结果不直接落库,设备与点位仍走 4.16.3 deviceConfig/batchUpsert 下发;受 deviceScan.enabled 控制,新增错误码 40021–40027。
  • 开放接口设备实时数据快照:/openApi 新增 GET /realtime/snapshot(文档 4.19),按 deviceId 或设备编码 code 定位设备(二者同时给出以 deviceId 为准),返回在线 / 采集中 / 采集引擎状态、最近成功时间与逐点最新值(质量码、stale 过期标记),供管理平台做设备实时监控。值直接取自采集引擎内存快照,不读时序库、不触达现场设备;未采集到的点位仍占位返回(collected=false)以保证分页之间行序稳定,stale=true 表示距上次更新超过该点位生效周期(绑定采集组时取组周期)的 3 倍。管理端按 UUID 查询、开放接口按自然键查询,两条路最终复用同一个 GetDeviceSnapshot,实时值语义不漂移。
  • 开放接口控制能力查询:/openApi 新增 GET /control/capability(文档 4.20),按 deviceId 或设备编码 code 返回 control.enabled、协议可写性 writable 与不可写原因 reason(disabled / device_disabled / protocol_missing / protocol_not_writable),供管理平台在展示写值入口前判断「现在能不能写、为什么不能写」。只读、不触达现场设备;真正写值仍走 4.8 /control/write。
  • 开放接口设备连接测试:/openApi 新增 POST /device/testConnection(文档 4.21),用调用方传入的协议名与未保存的连接配置真实连接一次现场设备(与管理端 POST /device/testDeviceConnection 同一条驱动路径),供管理平台「新建设备对象」在保存前校验连接配置。只探测:不写网关配置、不改设备状态;失败返回 40003 并原样带回驱动错误(地址不可达、串口被占用、超时等),调用方应原样展示。
  • OPC UA 验证工具:新增 backend/cmd/opcuaprobe,用标准 OPC UA 客户端完成 connect / browse / read / subscribe,独立验证网关 OPC UA Server 通道有没有把点位供出去,不依赖 UaExpert,便于在服务器、CI 或录屏环境里重复执行。
  • 实时监控写值区分原始值与工程值:设备实时快照透传点位 transformJson;控制下发弹窗的输入框始终按原始值填写,并按工程量变换只读预览对应的工程值(下发链路不做逆变换,避免把工程值当成原始值写入设备);同一弹窗新增设备信息卡与「复制地址」。前端换算算子与后端 mappingdsl 对齐(scale 默认 ×1+0、round 定长小数),换算失败时不显示预览。

变更

  • 控制台交互优化:点位与触发规则编辑弹窗改为分栏卡片并补充内联帮助,点位弹窗加宽到 min(900px, 94vw);设备扫描页重做统计卡、协议说明侧栏与结果区布局,扫描中的结果不再随轮询跳动。
  • 构建脚本目标校验:build.bat 新增 linux / native 目标,未知目标直接报错退出;此前未知目标会静默回落到全量构建,build.bat linux 实际编译了四个平台。

修复

  • 开机后的无谓采集重建:插件管理器首次扫描(Manager.Start)不再安排采集配置刷新。该次扫描必然早于采集引擎启动,加载到的驱动会自然进入首个采集任务;此前它仍会排一次 2s 防抖刷新,定时器到期时引擎已运行,导致每次开机后约 2 秒白白重建一轮全部采集任务(go test -race 下还会表现为 TestCollectionContinuesAcrossPluginHotUpgrade 偶发失败)。运行期的插件增删与热升级行为不变。

Added

  • Per-point engineering transform: device points gain an "engineering transform" (device_address.transform_json, migration 036_device_address_transform.sql) that runs a scale / round / trim / default pipeline once at collection. Live values, point threshold alarms, trigger rules, the offline spool and every push channel (MQTT / Kafka / HTTP / OPC UA / TDengine / InfluxDB) see the same engineering value, so TSDB channels no longer need their own conversion. scale (or round with decimal digits) promotes numeric points' kind to float, and integer OPC UA nodes become Double accordingly; on failure the raw value is kept and the error is logged with rate limiting. The outbound mapping-json transform remains a presentation layer — remove any duplicate scale from channel mappings after moving it to the point.
  • Point list shows bindings and transforms: the device point configuration list gains an "Engineering Transform" column with a readable summary (e.g. Scale ×0.1 → Round 2 dp, full pipeline on hover) and "Raw" when unset; the "Thing Model Property" column is no longer hidden on narrow screens, since both the binding and the conversion rule are needed to interpret a collected value.
  • OpenAPI configuration sync: adds a configuration-sync API group under /openApi (docs 4.16): capability negotiation via GET /config/capabilities, masked reads for thing models / devices & points / push channels / alarm webhooks / runtime switches (each with contentHash), and batch writes for push channels, alarm webhooks, runtime switches and device points. Writes only change gateway configuration — never field devices — and report per-item results; "***" keeps the existing secret, and hashes use sha256-canonical-json-v1 (secrets count by presence only). Thing-model upsert gains replaceProperties to drop absent properties; new error codes 42001–42009.
  • OpenAPI push channel connectivity test: /openApi gains POST /pushChannel/testConnectivity (docs 4.16.7), connecting once to the downstream (MQTT / HTTP / time-series database, …) with the caller's channel type and unsaved config, then disconnecting immediately, so the management platform can validate a push channel before saving it. configJson has the same shape as the config used by configuration sync, but secrets must hold real values ("***" cannot authenticate); failures return the gateway's concrete reason (bad credentials, unreachable host, refused port). Probe only — nothing is persisted and gateway configuration is unchanged.
  • OpenAPI collector group list: /openApi gains GET /collectorGroup/list (docs 4.16.2), returning the gateway's collector groups with an optional deviceId, for the management platform's push channel "collector group subscription" selector — config.groupIds are gateway-local keys, so the platform can only get this list from the gateway. The collector-group VO gains the device code deviceCode, so the platform can align groups with master data by "device code + group code".
  • OpenAPI outbound mapping preview: /openApi gains POST /pushChannel/previewMapping (docs 4.16.8), encoding native-json / group-json / mapping-json / script against the gateway's fixed sample batch, for the management platform's visual mapping editor and mapping-less formats to preview instantly; native-json / group-json need no mapping and pick the encoder from format alone. Encoding only — nothing is sent downstream or persisted, and mapping/encoding errors are returned in data.error rather than as API failures.
  • OpenAPI push channel runtime status: /openApi gains GET /pushChannel/status (docs 4.22), returning the push engine's in-memory snapshot (running/connected state, queue and spool depth, publish/row/dropped counters, last success and error) for the management platform to aggregate per gateway. Read-only with no downstream access; counters reset on restart and only enabled, successfully loaded channels appear.
  • Platform-defined thing-model categories: OpenAPI category validation now checks the format (lowercase letter start, ≤32) instead of a built-in whitelist, so the management platform owns the vocabulary; the local console still creates only built-in categories but keeps and displays custom codes delivered through the API.
  • Overridable Docker base images: Dockerfile gains NODE_IMAGE / GOLANG_IMAGE / ALPINE_IMAGE build args wired through docker-compose.yml, easing the switch to mainland mirrors or a private registry; defaults stay on the official tags.
  • Discovery broadcasts carry platform info: notify / reply gain os / arch fields taken from Go's runtime.GOOS / runtime.GOARCH (e.g. linux/amd64, linux/arm64, windows/amd64), so the management platform can deliver the matching plugin binaries. Both fields use omitempty, so older receivers parse the rest unchanged.
  • OpenAPI plugin binary delivery: /openApi gains GET /plugin/info (platform / naming rules / upload limits), GET /plugin/status (sha256 snapshot of loaded plugins) and POST /plugin/importPlugin (multipart upload with optional X-Content-SHA256 integrity check), so the management platform can select and deliver a package by os/arch. Uploads remain bounded by plugin.enabled and the per-file...
Read more

v0.8.1

Choose a tag to compare

@github-actions github-actions released this 11 Nov 03:04

[0.8.1] - 2026-11-11

新增

  • Kafka 推送通道:新增 kafka 类型,基于纯 Go 的 franz-go 实现,支持多个 seed broker、SASL/PLAIN、TLS、acks(all/leader/none,非 all 自动关闭幂等写入)、自动建 topic 开关与断网缓存/补发。复用消息类通道的全部载荷格式(native-json / group-json / mapping-json / script)、采集组订阅、载荷预览与测试发送;record key 固定为设备编码(缺失回落设备 ID),同一设备落在同一分区,workers 默认 1 保证按序发送。新增迁移 035_add_kafka_push_channel_form.sql。
  • 开放接口报警明细:新增报警历史分页 GET /openApi/alarm/pageAlarm、当前活跃离线报警 GET /openApi/alarm/listActive(不分页)与越限记录分页 GET /openApi/alarm/pageThresholdRecord,与既有的可靠性 / 异常聚合报表互补,回答「具体是哪几条」(开放接口文档 v1.7,4.9–4.11)。
  • 开放接口订阅设备与点位同步:新增 GET /openApi/subscription/devicePoint/sync,按 deviceId 游标分批返回订阅报文维护的设备 / 点位元信息(mqtt_subscription_device_point),形态与 4.5 设备同步一致,供外部系统全量遍历(开放接口文档 v1.8,4.12)。
  • 开放接口物模型批量 upsert:新增 POST /openApi/thingModel/batchUpsert,外部系统可按 code / identifier 自然键批量创建或更新物模型与其属性(没有则创建,有则更新)。每个模型一个事务、跨模型部分成功,逐条返回 created/updated/failed 与错误码;请求中未出现的属性不删除,已被点位绑定的属性改变 kind/accessMode 仍被拒绝(41018)(开放接口文档 v1.9,4.13)。
  • 开放接口物模型批量删除:新增 POST /openApi/thingModel/batchDelete(按 code 批量删模型,连带其属性)与 POST /openApi/thingModelProperty/batchDelete(按 modelCode + identifier 批量删属性),逐条返回 deleted/failed 与错误码,跨条部分成功;沿用单条删除的绑定保护(模型被设备绑定或其属性被点位绑定返回 41005,属性被点位绑定返回 41006),已不存在时分别返回 41002 / 41004(开放接口文档 v1.10,4.14–4.15)。
  • 按协议生成完整设备导入模板:GET /device/importTemplate 支持 protocolId。指定协议时,模板在基础列(名称/协议/描述/编码/物模型/状态)之外追加该协议 form_json 的全部连接参数列,标题按当前语言解析、必填项带标记、下拉项带 Excel 数据验证;连接参数会按字段类型写入 protocol_json(input→字符串、inputNumber→数字、select→选项原始类型)。含参数列的模板要求整表同一协议,混协议或模板与协议表单不一致时整表拒绝。示例行移到第二张工作表,直接导入未修改的模板不会产生示例设备。按协议模板导入时还会根据 host/port/unitId/dstNode 生成扫描身份签名(scan_identity),让导入设备参与扫描判重;通用模板与串口协议仍留空。手工新建与修改设备连接配置时也会按配置生成/重算扫描身份(修改配置此前是直接清空),只有认不出 host 时才写空串。
  • 设备导入的「编码」改为必填:模板必须包含编码列,逐行留空、格式非法或重复只让该行失败,不再按名称自动生成。旧的三列模板(无编码列)不再支持,四列及以上(含编码)的旧模板仍可导入。
  • 设备导入支持物模型与启停状态:模板新增「物模型」(名称或标识,必须存在且启用)与「状态」(启用/禁用,默认启用)两列。
  • 导入模板表头标注优化:必填列统一在列名末尾加 *,表头按必填(深蓝底 + 红色下边框)/选填(浅蓝底)分色,示例表底部附一行图例。导入仍按列名与 [fieldKey] 识别,不受配色影响。
  • 设备列表展示在线状态:设备对象列表的「状态」列改为「在线状态」,按「禁用 / 未接入 / 在线 / 离线」四态展示,并带悬停说明。后端 DeviceVO 新增 collected 字段,区分「启用但尚未进入采集调度」与真正的在线/离线,口径与首页设备总览一致。
  • 扫描结果导出为设备导入模板:POST /deviceScan/exportTemplate 把勾选的扫描结果按该协议的设备导入模板导出(.xlsx)。文件与 GET /device/importTemplate?protocolId= 同构,表头下方直接填好名称、编码、描述与 protocolJson 里的连接参数;在 Excel 里改完编码/名称后,走设备导入即可落库。扫描页「添加为设备」弹窗新增「导出 Excel」按钮。

修复

  • 被推送通道订阅的采集组拒绝删除:删除采集组前检查各推送通道的 config_json.groupIds,仍被任一通道(含停用通道)订阅时返回新错误码 40050,避免删除后通道配置里留下永远匹配不到任何批次的组 ID。设备删除(单条与批量)会级联删掉名下采集组,因此名下任一组被订阅时同样整批拒绝并返回 40065;批量删除不做部分成功。先从通道配置中移除该组即可恢复删除。
  • 设备/点位被触发规则引用时拒绝删除:删除设备(单条与批量)前检查事件触发规则的动作设备、动作点位与条件点位引用;删除点位(单条与批量)前检查动作点位与条件点位引用。有引用时分别返回新错误码 40063 / 40064 并整批不删,避免删除后规则持续报 condition address ... not found、且再也无法触发。先修改或删除相关规则即可恢复删除。

Added

  • Kafka push channel: adds the kafka type backed by the pure-Go franz-go client, supporting multiple seed brokers, SASL/PLAIN, TLS, acks (all/leader/none, with idempotent writes disabled for non-all), an auto-create-topic switch and the shared offline spool/replay. It reuses every message format (native-json / group-json / mapping-json / script), group subscriptions, payload preview and test send; the record key is the device code (falling back to the device ID) so one device stays on one partition, and workers defaults to 1 for ordered sends. Adds migration 035_add_kafka_push_channel_form.sql.
  • OpenAPI alarm details: adds alarm-history paging GET /openApi/alarm/pageAlarm, currently-active offline alarms GET /openApi/alarm/listActive (unpaginated) and threshold-record paging GET /openApi/alarm/pageThresholdRecord, complementing the existing reliability / abnormality aggregates with "which alarms exactly" detail queries (OpenAPI docs v1.7, 4.9–4.11).
  • OpenAPI subscription device/point sync: adds GET /openApi/subscription/devicePoint/sync, returning device/point metadata maintained from subscription messages (mqtt_subscription_device_point) in device-level cursor batches, mirroring 4.5 for full external traversal (OpenAPI docs v1.8, 4.12).
  • OpenAPI thing-model batch upsert: adds POST /openApi/thingModel/batchUpsert, letting external systems create or update thing models and their properties in batches by the code / identifier natural keys (create if absent, update if present). Each model is one transaction with partial success across models; every entry reports created/updated/failed plus an error code. Properties absent from the request are never deleted, and changing kind/accessMode on a property bound to a point is still rejected (41018) (OpenAPI docs v1.9, 4.13).
  • OpenAPI thing-model batch delete: adds POST /openApi/thingModel/batchDelete (delete models by code, including their properties) and POST /openApi/thingModelProperty/batchDelete (delete properties by modelCode + identifier). Each entry reports deleted/failed plus an error code, with partial success across entries. The single-delete binding guards are reused (a model bound to a device or whose properties are bound to points returns 41005; a bound property returns 41006), and missing entries return 41002 / 41004 (OpenAPI docs v1.10, 4.14–4.15).
  • Protocol-aware complete device import template: GET /device/importTemplate accepts protocolId. For a selected protocol the template adds every connection-parameter column from that protocol's form_json to the base columns (name / protocol / description / code / thing model / status), localizes titles, marks required fields and adds Excel data validation for options; imported values are written into protocol_json with their proper types (input → string, inputNumber → number, select → the option's original type). Templates with parameter columns require a single protocol for the whole file; mixed protocols or a stale template are rejected wholesale. The sample row moves to a second worksheet so importing an untouched template creates no sample device. Protocol-template imports also derive the scan identity (scan_identity) from host/port/unitId/dstNode, so imported devices participate in scan duplicate detection; universal templates and serial protocols stay empty. Manual creation and connection-config edits now generate/recompute the scan identity from the config (edits previously cleared it), writing an empty value only when no host can be derived.
  • Device import code column is now required: the template must contain a code column; empty, invalid or duplicate codes fail only that row, and codes are no longer generated from names. The legacy three-column template (without a code column) is no longer supported; legacy four-or-more-column templates that include a code column still import.
  • Thing model and enabled status in device import: two new columns — "thing model" (name or code, must exist and be enabled) and "status" (enabled/disabled, default enabled).
  • Clearer required/optional header annotations: required columns now end with *, and header cells are color-coded (required: deep blue with a red bottom border; optional: light blue). The example sheet ends with a legend. Import still matches columns by header name and [fieldKey], so the styling does not affect parsing.
  • Online status in the device list: the device object list's status column now shows a four-state "online status" — disabled / not collected / online / offline — with a hover explanation. DeviceVO gains a collected field so "enabled but not in the collection schedule" is distinguishable from genuinely online/offline, using the same semantics as the dashboard overview.
  • Export scan results as a device import template: POST /deviceScan/exportTemplate exports the selected scan results using the protocol's device import template (.xlsx). The file matches GET /device/importTemplate?protocolId= exactly, with names, codes, descriptions and connection parameters from protocolJson prefilled below the header; edit the codes/names in Excel and import them from the device object page. The scan add dialog gains an "Export to Excel" button.

Fixed

  • Collector groups subscribed by push channels can no longer be deleted: deleting a collector group now checks every push channel's config_json.groupIds; if any channel (including disabled ones) still subscribes to it, deletion is rejected with the new error code 40050, so channel configs no longer retain group IDs that can never match a batch. Since deleting a device cascades to its collector groups, single and batch device deletion are rejected wholesale with 40065 when any group of the device is subscribed; batch deletion never partially succeeds. Remove the group from the channel configuration first.
  • Devices and points referenced by trigger rules can no longer be deleted: single and batch device deletion check event-trigger rules for references through the action device, action points and condition points; single and batch point deletion check action and condition points. A referenced device or point returns the new error code 40063 / 40064 and the whole batch is left untouched, so deleting them no longer leaves rules logging condition address ... not found and unable to fire. Modify or delete the referencing rule first to proceed.

v0.8.0

Choose a tag to compare

@github-actions github-actions released this 05 Nov 07:52

[0.8.0] - 2026-11-05

新增

  • 扫描建库支持自定义设备编码:扫描结果新增建议编码 suggestedCode(按地址派生,批内唯一),「添加为设备」弹窗新增编码列并预填,可修改;创建接口 items[].code 可选,留空仍按名称自动生成,显式给出时逐行校验格式与库内/批内唯一,不合法或重复只让该行失败(不自动避让 —— 编码创建后不可改,悄悄改成 -2 比报错更糟)。
  • 设备扫描两阶段:TCP 可达性预筛:插件在 DiscoverySpec 里新增可选 Transport(tcp / udp / 留空)。对声明 tcp 的协议,网关先用高并发、短超时(默认 256 / 500ms)拨一遍扫描端口,连不上的地址直接判死(计入 scanned、不产生错误),只把端口开着的主机交给插件 probe。广播目标永远绕过,udp/未声明协议行为不变。典型 /24 的协议探测次数从 254 次降到十几台,/16 从小时级降到分钟级。新增配置 deviceScan.prefilterEnabled / prefilterConcurrency / prefilterTimeoutMs(均需重启)。需要 SDK v0.4.0 与 drivers v0.4.0 配套。

变更

  • 设备扫描默认并发 8 → 32,上限 32 → 128:扫描耗时 ≈ ceil(目标数 / 并发) × 单目标耗时,一个网段里不可达地址占绝大多数、每个都要等满插件侧的拨号超时,因此并发是最直观的加速旋钮。默认值下 /24(254 个目标)按 1.5s 拨号超时由约 48 秒降至约 12 秒。升级后若保留了旧的 default.yaml,需手动把 deviceScan.maxConcurrentProbes 调到 32 或以上;本项改动需重启网关。
  • 扫描剩余批次自动续扫:单批上限(deviceScan.maxTargets,默认 1024)仍作内部安全阀,但扫描页在任务正常结束(done 且 truncated=true)时自动调用 POST /deviceScan/continue,直到 remainingTargets=0,无需逐批点按钮;取消、失败或自动续扫失败时停止续扫,工具条上的「继续扫描」供手动重试。前端轮询上限改为按本批估算耗时每批重新计时,跨批总时长不再受 30 分钟限制。

Added

  • Custom device codes when creating devices from scan results: scan results now carry a suggested suggestedCode (derived from the address and unique within the batch), and the "Add as devices" dialog gains a prefilled, editable code column. items[].code is optional on the create API: when omitted the code is still generated from the name; when provided it is validated per row for format and uniqueness against both the database and the batch, and invalid or duplicate rows fail individually (no silent -2 renaming — codes are immutable after creation, so quietly changing one is worse than an error).
  • Two-stage device scan: TCP reachability prefilter: DiscoverySpec gains an optional Transport (tcp / udp / unset). For protocols declaring tcp, the gateway first dials the scan port at high concurrency with a short timeout (default 256 / 500ms); unreachable addresses are marked done (counted in scanned, no error entry) and only hosts with an open port reach the plugin's probe. Broadcast targets always bypass it, and udp/unset protocols behave as before. A typical /24 drops from 254 protocol probes to a dozen, and a /16 from hours to minutes. New settings deviceScan.prefilterEnabled / prefilterConcurrency / prefilterTimeoutMs (all require a restart). Requires SDK v0.4.0 and drivers v0.4.0.

Changed

  • Device-scan concurrency default raised from 8 to 32, cap from 32 to 128: scan time ≈ ceil(targets / concurrency) × per-target time. Most addresses in a subnet are unreachable and each waits out the plugin's dial timeout, so concurrency is the most direct speed lever. At the new default a /24 (254 targets) drops from about 48s to about 12s with a 1.5s dial timeout. If an existing deployment keeps its old default.yaml, raise deviceScan.maxConcurrentProbes to 32 or more manually; this setting requires a restart.
  • Automatic continuation of remaining scan batches: the per-batch cap (deviceScan.maxTargets, default 1024) stays as an internal safety valve, but the scan page now calls POST /deviceScan/continue automatically after a batch completes normally (done with truncated=true) until remainingTargets=0, so users no longer click through batches. Cancelling, a failure, or a failed auto-continue stops the chain and leaves the toolbar's Continue scan button for manual retry. The frontend poll timeout is now re-armed per batch from that batch's estimate, so the total time across batches is no longer capped at 30 minutes.

v0.7.2

Choose a tag to compare

@github-actions github-actions released this 05 Nov 03:42

[0.7.2] - 2026-11-05

新增

  • MQTT 订阅复制:新增 POST /mqttSubscription/copyMqttSubscription,按 ID 复制为一条默认停用的副本(避免同一 topic 重复入库),配置列原样取自库中原行、不经前端表单往返;名称自动加 -copy / -copy2 后缀并查重,拼缀后仍受 100 字符上限约束。控制台列表新增复制按钮,接口镜像到 /agentApi。

变更

  • 订阅 Topic 长度上限 500 → 2000:创建、编辑与连通性测试同步放宽,表单输入框显示字数;控制下行 Topic 仍保持 500。

修复

  • pluginhost:已取消的 RPC 立即失败:client.call 在写帧前先检查 ctx.Err(),已取消/超时的调用不再发送请求,修复取消扫描时探测偶发"成功"的问题。

Added

  • MQTT subscription duplication: POST /mqttSubscription/copyMqttSubscription copies a subscription by ID into a disabled-by-default copy (so the same topic is not ingested twice); config columns come straight from the stored row with no form round-trip. The name gets a -copy / -copy2 suffix with collision avoidance and is truncated to stay within the 100-character limit. The console list gains a copy action and the route is mirrored to /agentApi.

Changed

  • Subscription topic limit raised from 500 to 2000 characters: create, update and connectivity-test validation are relaxed together and the form shows a character counter; the control downlink topic stays capped at 500.

Fixed

  • pluginhost: cancelled RPCs fail fast: client.call now checks ctx.Err() before writing a frame, so cancelled/timed-out calls are never sent — fixes probes intermittently "succeeding" after a scan was cancelled.

v0.7.1

Choose a tag to compare

@github-actions github-actions released this 05 Nov 01:35

[0.7.1] - 2026-11-05

变更

  • group-json 载荷重构(破坏性):values/errors 字典合并为 points 数组,坏点保留并携带 quality(< 128 判坏);帧头新增 deviceCode/protocol/thingModelCode/groupCode,timestamp 更名为 collectedAt、intervalMs 更名为 groupIntervalMs。字段契约见 specs/push-payload.md §1.1;映射编辑器同步补充批次字段 intervalMs。

Changed

  • group-json payload redesign (breaking): the values/errors dictionaries are replaced by a single points array that keeps bad-quality points (quality < 128); the frame header now carries deviceCode / protocol / thingModelCode / groupCode, timestamp is renamed to collectedAt, and intervalMs to groupIntervalMs. The field contract lives in specs/push-payload.md §1.1; the mapping editor also exposes the intervalMs batch field.

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 04 Nov 03:39

[0.7.0] - 2026-11-04

新增

  • OPC UA 通道监控:服务端通道记录最近写入地址空间的批次,publishCount / rowsCount 改为更新批次 / 更新点位,extra 展示点位覆盖度、订阅与监控项数及重建次数;Connected 表示监听已就绪。
  • 事件触发采集规则:新增规则管理与触发历史(迁移 033_trigger_rule.sql)。条件为 DNF(组间 OR、组内 AND),可配冷却与读取超时;采集样本出现上升沿后异步读取动作设备指定点位并定向推送到一个通道,结果按 success / offline / timeout / read_failed / push_failed / dropped 落库,保留规则、条件与结果快照(7 天或 2 万行)。控制台新增「事件触发规则」「触发历史」页,接口整组镜像到 /agentApi,新增错误码 40051–40062。
  • 触发规则读取超时:设备锁等待改为 context 感知。设备正被慢采集或重连占用时,规则读取在超时(默认 5s,最大 60s)后放弃等待并记录新状态 timeout;已开始但超时后才返回的读取不再推送迟到结果。控制下发同样按调用方 ctx 放弃等锁。
  • 触发执行按设备隔离:规则引擎把读点/推送交给动作设备各自的串行执行者,全局分发协程不再直接执行 I/O。单台慢设备只会占住自己的执行队列,其他设备的规则照常执行;同一设备仍严格串行,单设备队列满时记 dropped 并释放规则的单飞标记。
  • 触发规则编码:trigger_rule 新增全局唯一的业务编码 code(迁移 034_trigger_rule_code.sql),创建必填、创建后不可修改,格式与设备/采集组编码一致;存量规则按 ID 回填。事件载荷的 trigger 对象新增 ruleCode,触发历史新增 rule_code 快照;列表支持按编码检索。
  • 事件触发载荷元数据:事件触发规则定向推送的动作记录新增可选 trigger 对象(source / ruleId / ruleCode / ruleName / triggerId / firedAt),firedAt 为条件上升沿时刻。仅事件推送携带,正常采集与外部订阅载荷逐字节不变;断网缓存补发保留该元数据。native-json / group-json 直接输出,mapping-json / script 可按需取用。
  • 触发规则实时监控:规则引擎在内存保留最近 100 次已结束的触发(成功/离线/超时/读失败/推送失败/丢弃),新增只读 GET /triggerRule/recentTriggers(可按规则过滤,镜像到 /agentApi);控制台「事件触发规则」页新增实时监控抽屉,展示触发时间、规则、状态、目标通道、动作设备、耗时与错误,展开可看本次实际读到的点位值,打开期间每 3 秒刷新。仅内存、重启即清空;持久化历史与条件快照仍走触发历史页。

Added

  • OPC UA channel monitoring: the server channel keeps its recent
    address-space batches; publishCount / rowsCount now mean update batches /
    updated points, extra exposes point coverage, subscription and
    monitored-item counts plus rebuild count, and Connected means the listener
    is up.
  • Event-triggered collection rules: adds rule management and trigger history
    (migration 033_trigger_rule.sql). Conditions are DNF (OR across groups, AND
    within a group) with optional cooldown and read timeout; on a rising edge in
    collected samples the engine asynchronously reads the action device's points
    and pushes them to one channel, recording success / offline / timeout /
    read_failed / push_failed / dropped with rule, condition and result
    snapshots (7 days or 20,000 rows). The console gains Event Trigger Rules and
    Trigger History pages; routes are mirrored to /agentApi and error codes
    40051–40062 are added.
  • Trigger-rule read timeout: device-lock acquisition is now
    context-aware. When a slow poll or reconnect owns the device, a rule read
    gives up waiting at its timeout (default 5s, max 60s) and records the new
    timeout status; a read that was already in flight and finishes late is no
    longer pushed. Control writes also give up waiting on the caller's ctx.
  • Per-device trigger execution: the rule engine now hands reads and pushes
    to a serial executor per action device; global dispatch goroutines no longer
    perform I/O. A slow device only occupies its own queue, while rules for other
    devices keep running. The same device remains strictly serial; a full
    per-device queue records dropped and clears the rule's single-flight flag.
  • Trigger rule code: trigger_rule gains a globally unique business code
    code (migration 034_trigger_rule_code.sql), required on creation,
    immutable afterwards, using the same format as device and collector-group
    codes; existing rows are backfilled from their IDs. Event payload trigger
    objects gain ruleCode, trigger history stores a rule_code snapshot, and
    the rule list can be searched by code.
  • Trigger metadata in event payloads: action records pushed by a trigger
    rule carry an optional trigger object (source / ruleId / ruleCode /
    ruleName / triggerId / firedAt, where firedAt is the rising-edge
    time). Only event pushes include it, so normal collection and
    external-subscription payloads stay byte-for-byte unchanged; offline spool
    replay preserves the metadata. native-json and group-json expose it directly,
    while mapping-json and script can opt in by referencing trigger.*.
  • Live trigger-rule monitoring: the rule engine keeps the last 100 completed
    triggers in memory (success / offline / timeout / read failed / push failed / dropped)
    behind the read-only GET /triggerRule/recentTriggers (optional rule filter,
    mirrored to /agentApi). The Event Trigger Rules page gains a live monitor
    drawer showing fired time, rule, status, target channel, action device,
    duration and error; expanding a row shows the point values actually read,
    refreshing every 3 seconds while open. Memory-only — cleared on restart;
    persisted history and condition snapshots remain on the Trigger History page.