Tùy chỉnh Thiết bị
VieLang Mobile cho phép tùy chỉnh giao diện thiết bị theo từng Device Profile — bao gồm icon, dashboard chi tiết và dashboard xem alarm.
Icon Thiết bị
Icon hiển thị trong danh sách thiết bị trên mobile.
Cấu hình
- Vào Device Profiles → click profile cần cấu hình
- Click Edit (bút chì)
- Field "Device profile image" → upload ảnh
- Kích thước: 256×256px (khuyến nghị)
- Định dạng: PNG với nền trong suốt
- Click Apply changes
Tất cả thiết bị thuộc profile này sẽ dùng icon mới.
Qua API
POST /api/deviceProfile
Authorization: Bearer {JWT}
Content-Type: application/json
{
"id": { "id": "profile-uuid", "entityType": "DEVICE_PROFILE" },
"name": "Temperature Sensor",
"image": "data:image/png;base64,iVBORw0KGg..."
}Dashboard Chi tiết Thiết bị
Khi người dùng click vào một thiết bị trong mobile, app sẽ mở dashboard chi tiết của thiết bị đó.
Yêu cầu dashboard
Dashboard chi tiết phải dùng alias "Entity from dashboard state":
- Tạo dashboard mới:
Device Detail - Vào Edit → Entity aliases → + Add alias
- Đặt tên alias:
device(hoặc tùy ý) - Type: "Entity from dashboard state"
- Click Add
- Thêm widgets dùng alias này làm datasource
Gắn vào Device Profile
- Device Profiles → chọn profile → Edit
- Tab Details
- Field "Mobile dashboard" → chọn
Device Detail - Click Apply changes
Ví dụ Dashboard Chi tiết
Cấu hình điển hình cho temperature sensor:
Dashboard: "Temperature Sensor Detail"
Alias: "device" (Entity from dashboard state)
Widgets:
├── Value Card — temperature (realtime)
├── Value Card — humidity (realtime)
├── Value Card — battery (từ attributes)
├── Time Series Chart — temperature (24h, AVG by 1h)
├── Alarms Table — alarm của thiết bị này
└── Attributes Table — client + shared attributes
Dashboard Chi tiết Alarm
Khi người dùng click vào một alarm, app mở dashboard để xem chi tiết.
Cấu hình
Cấu hình per Alarm Rule trong Device Profile:
- Device Profiles → chọn profile → Edit
- Tab Alarm rules → click vào alarm rule
- Field "Mobile dashboard" → chọn dashboard
- Click Apply changes
Quan trọng: Cấu hình này chỉ áp dụng cho alarm được tạo sau khi lưu. Alarm cũ không bị ảnh hưởng.
Yêu cầu
Dashboard alarm cũng phải dùng alias "Entity from dashboard state" trỏ đến thiết bị/asset gây ra alarm.
Ví dụ Dashboard Alarm
Dashboard: "High Temperature Alarm Detail"
Alias: "originator" (Entity from dashboard state)
Widgets:
├── Value Card — current temperature (nguyên nhân alarm)
├── Time Series Chart — temperature (từ 1h trước đến hiện tại)
├── Attribute Card — maxTemperatureThreshold (ngưỡng cảnh báo)
├── Map Widget — vị trí thiết bị
└── RPC Button — "Reset alarm" (gửi lệnh reset)
Thứ tự hiển thị
Mobile app ưu tiên theo thứ tự:
- Device-specific dashboard (nếu thiết bị có dashboard riêng)
- Profile dashboard (nếu device profile có mobile dashboard)
- Default dashboard (dashboard telemetry mặc định)
API Reference
# Cập nhật mobile dashboard cho device profile
POST /api/deviceProfile
Authorization: Bearer {JWT}
{
"id": {"id": "profile-uuid", "entityType": "DEVICE_PROFILE"},
"name": "Temperature Sensor",
"profileData": {
"configuration": { "type": "DEFAULT" },
"alarms": [
{
"id": "alarm-1",
"alarmType": "High Temperature",
"dashboardId": { "id": "alarm-dashboard-uuid", "entityType": "DASHBOARD" }
}
]
},
"defaultDashboardId": { "id": "device-dashboard-uuid", "entityType": "DASHBOARD" }
}