Tùy chỉnh Thiết bị

Cài đặt icon, dashboard chi tiết và dashboard alarm cho từng loại thiết bị trên mobile.

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

  1. Vào Device Profiles → click profile cần cấu hình
  2. Click Edit (bút chì)
  3. 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
  4. 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":

  1. Tạo dashboard mới: Device Detail
  2. Vào EditEntity aliases+ Add alias
  3. Đặt tên alias: device (hoặc tùy ý)
  4. Type: "Entity from dashboard state"
  5. Click Add
  6. Thêm widgets dùng alias này làm datasource

Gắn vào Device Profile

  1. Device Profiles → chọn profile → Edit
  2. Tab Details
  3. Field "Mobile dashboard" → chọn Device Detail
  4. 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:

  1. Device Profiles → chọn profile → Edit
  2. Tab Alarm rules → click vào alarm rule
  3. Field "Mobile dashboard" → chọn dashboard
  4. 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ự:

  1. Device-specific dashboard (nếu thiết bị có dashboard riêng)
  2. Profile dashboard (nếu device profile có mobile dashboard)
  3. 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" } }