Cấu hình thiết bị (Device Profiles)
Device Profile là template cấu hình áp dụng cho nhóm 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à gắn nhiều thiết bị vào đó.
Các tab cấu hình
Tab Details
- Tên profile, mô tả
- Default Rule Chain — rule chain xử lý telemetry mặc định
- Default Dashboard — dashboard hiển thị khi mở thiết bị
Tab Transport Configuration
Cấu hình giao thức kết nối (xem bên dưới).
Tab Alarm Rules
Định nghĩa điều kiện tự động tạo/xóa alarm (xem Cảnh báo).
Tab Firmware (OTA)
Cấu hình tự động cập nhật firmware qua Over-The-Air.
Transport Types (Giao thức kết nối)
Default Transport
Hỗ trợ tất cả giao thức (MQTT, HTTP, CoAP) với cài đặt mặc định. Phù hợp cho hầu hết thiết bị.
MQTT Transport
Cấu hình nâng cao cho thiết bị MQTT:
Custom topic filters:
Telemetry topic: factory/sensors/{deviceId}/data
Attributes topic: factory/sensors/{deviceId}/config
RPC request: factory/sensors/{deviceId}/commands
RPC response: factory/sensors/{deviceId}/commands/response
Payload format:
JSON— Mặc định, dễ debugProtobuf— Nhỏ hơn, nhanh hơn cho thiết bị hạn chế tài nguyên
Spark plug B compatibility: Hỗ trợ chuẩn MQTT Sparkplug B cho industrial IoT.
CoAP Transport
Giao thức UDP nhẹ, tối ưu cho thiết bị NB-IoT, LoRa:
Power Saving Modes:
- PSM (Power Saving Mode) — Ngủ sâu, tiết kiệm pin tối đa
- DRX (Discontinuous Reception) — Ngủ ngắn giữa các lần nhận
- eDRX (Extended DRX) — DRX với chu kỳ dài hơn
Payload format: JSON hoặc Efento NB-IoT.
LwM2M Transport
Chuẩn OMA LwM2M cho thiết bị IoT hạn chế tài nguyên (wearable, sensor NB-IoT):
- Object model chuẩn (IPSO objects)
- Bootstrap server support
- Firmware update chuẩn
- PSM/DRX support
SNMP Transport
Cho thiết bị mạng (switch, router, UPS):
- Polling interval cấu hình được
- Mapping OID → telemetry key
- SNMP v1/v2c/v3
Tạo Device Profile
Qua UI
- Vào Device Profiles → + Add device profile
- Nhập tên, chọn transport type
- Cấu hình rule chain và dashboard mặc định
- Thêm alarm rules
- Nhấn Add
Qua API
POST /api/deviceProfile
Authorization: Bearer {JWT}
Content-Type: application/json
{
"name": "Temperature Sensors",
"type": "DEFAULT",
"transportType": "MQTT",
"defaultRuleChainId": { "id": "rule-chain-uuid", "entityType": "RULE_CHAIN" },
"profileData": {
"configuration": { "type": "DEFAULT" },
"transportConfiguration": {
"type": "MQTT",
"deviceTelemetryTopic": "v1/devices/me/telemetry",
"deviceAttributesTopic": "v1/devices/me/attributes"
},
"alarms": [
{
"id": "alarm-rule-1",
"alarmType": "High Temperature",
"createRules": {
"CRITICAL": {
"condition": {
"condition": [
{ "key": { "type": "TIME_SERIES", "key": "temperature" },
"valueType": "NUMERIC", "value": 35,
"predicate": { "type": "NUMERIC", "operation": "GREATER" } }
],
"spec": { "type": "SIMPLE" }
}
}
},
"clearRule": {
"condition": {
"condition": [
{ "key": { "type": "TIME_SERIES", "key": "temperature" },
"valueType": "NUMERIC", "value": 30,
"predicate": { "type": "NUMERIC", "operation": "LESS_OR_EQUAL" } }
],
"spec": { "type": "SIMPLE" }
}
}
}
]
}
}Gắn thiết bị vào Profile
Khi tạo thiết bị, chọn profile:
POST /api/device
Authorization: Bearer {JWT}
{
"name": "Sensor-01",
"deviceProfileId": { "id": "profile-uuid", "entityType": "DEVICE_PROFILE" }
}Thay đổi profile sau khi tạo:
POST /api/device/{deviceId}/profileId
Authorization: Bearer {JWT}
{ "id": "new-profile-uuid", "entityType": "DEVICE_PROFILE" }