Device Profiles

Cấu hình template cho từng loại thiết bị — transport protocol, rule chain, queue, và MQTT topics

Device Profiles

Device Profile là template cấu hình dùng chung cho nhiều thiết bị cùng loại. Thay vì cấu hình từng thiết bị riêng lẻ, bạn tạo một profile và áp dụng cho toàn bộ fleet.

Tạo Device Profile

Vào Device Profiles > Create new profile, điền:

TrườngMô tả
NameTên profile (vd: Temperature Sensor)
DescriptionMô tả tùy chọn
Default QueueQueue xử lý message (mặc định: Main)
Rule ChainRule chain xử lý dữ liệu từ thiết bị

Transport Type

Profile định nghĩa giao thức thiết bị dùng để kết nối:

Default

Tương thích ngược với tất cả giao thức. Dùng khi không cần cấu hình đặc thù.

MQTT

Tùy chỉnh topic filter và payload format:

Telemetry topic filter: sensors/+/telemetry Attributes topic filter: sensors/+/attributes RPC request topic: sensors/+/rpc/request/+ RPC response topic: sensors/+/rpc/response/+

Hỗ trợ wildcard MQTT: + (một cấp), # (nhiều cấp).

Payload format: JSON hoặc Protobuf (tiết kiệm băng thông ~60%).

CoAP

Giao thức UDP cho thiết bị bị giới hạn tài nguyên. Xem CoAP API.

LwM2M

Chuẩn IETF cho quản lý thiết bị. Hỗ trợ PSK, RPK, X.509. Xem LwM2M API.

SNMP

Tích hợp thiết bị mạng truyền thống (router, switch, camera IP).


Alarm Rules

Định nghĩa điều kiện tạo alarm trực tiếp trong profile:

Alarm Type: High Temperature Severity: CRITICAL Condition: temperature > 80 Dashboard: (optional) link to dashboard

Alarm rules trong profile được đánh giá trước rule engine, phù hợp cho các ngưỡng đơn giản.


Rule Chain và Queue riêng

Gán rule chain và queue độc lập cho từng profile:

Profile: Fire Alarm Sensor → Rule Chain: fire-alarm-processing → Queue: high-priority (xử lý ngay, không đợi) Profile: Status Sensor → Rule Chain: default → Queue: Main (xử lý thông thường)

Điều này đảm bảo thiết bị quan trọng không bị block bởi traffic từ thiết bị khác.


Firmware mặc định

Gán firmware version mặc định vào profile. Thiết bị mới gia nhập sẽ tự nhận firmware này (OTA):

Firmware: v2.1.0 (ESP32_Firmware_v2.1.0.bin) Software: v1.5.0 (optional)

Xem thêm OTA Updates.


Mobile Dashboard

Tùy chỉnh giao diện chi tiết thiết bị trên app mobile:

  • Mobile dashboard: Dashboard hiển thị khi mở thiết bị trên mobile
  • Cho phép mỗi loại thiết bị có giao diện riêng

Ví dụ thực tế

Profile: Smart Energy Meter Transport: MQTT Topic: energy/${serialNumber}/telemetry Payload: JSON Rule Chain: energy-processing Queue: energy-queue Alarm Rules: - Overvoltage: voltage > 250V → CRITICAL - Low Power Factor: pf < 0.8 → WARNING Firmware: meter-fw-3.0.bin

API

POST /api/deviceProfile GET /api/deviceProfile/{id} GET /api/deviceProfiles?pageSize=10&page=0 DELETE /api/deviceProfile/{id}