Dashboard
Dashboard là giao diện giám sát trực quan, cho phép hiển thị dữ liệu telemetry, quản lý thiết bị và tương tác với hệ thống IoT theo thời gian thực.
Tính năng
- Widgets phong phú — Biểu đồ, bảng, đồng hồ đo, bản đồ, điều khiển
- Dữ liệu real-time — Cập nhật qua WebSocket
- Time window — Lựa chọn khoảng thời gian linh hoạt
- Aggregation — Tổng hợp dữ liệu theo khoảng thời gian
- Entity aliases — Tham chiếu linh hoạt đến thiết bị/tài sản
- Filters — Lọc entity theo attributes hoặc telemetry
- Đa trạng thái — Dashboard nhiều "trang" (states)
- Chia sẻ — Public link, giao cho customer, nhúng vào website
- Version control — Lưu lịch sử thay đổi
Tạo Dashboard
Qua UI
- Vào Dashboards → + Add dashboard
- Nhập tên và optional description
- Nhấn Add → mở dashboard ở chế độ xem
- Nhấn Edit (nút bút chì góc phải) để thêm widget
Qua API
POST /api/dashboard
Authorization: Bearer {JWT}
Content-Type: application/json
{
"title": "Factory Floor Monitor",
"configuration": {}
}Widgets
Loại widget
| Danh mục | Widgets |
|---|---|
| Charts | Time series chart, Bar chart, Pie chart, Polar chart |
| Gauges | Analog gauge, Digital gauge, Level card, Compass |
| Maps | OpenStreet Map, Google Maps, Image map, Route map |
| Tables | Entities table, Timeseries table, Alarms table |
| Cards | Value card, Entity info, Label card, HTML card |
| Controls | Round switch, Slider, LED indicator, Knob control |
| Input | Text input, Select, Date range picker |
| Alarm | Alarm count, Active alarms |
Thêm widget
- Nhấn Edit → + Add widget
- Chọn loại widget
- Cấu hình Datasource:
- Chọn Entity alias hoặc device trực tiếp
- Chọn keys (telemetry keys)
- Tùy chỉnh màu sắc, label, đơn vị
- Nhấn Add
Entity Aliases
Aliases giúp dashboard linh hoạt — thay vì hard-code device cụ thể, bạn dùng alias có thể filter động.
Single Entity
Alias tham chiếu một entity cụ thể.
Entity List
Danh sách cố định nhiều entity.
Entity Group
Tất cả entity trong một nhóm.
Entity from dashboard state
Entity được chọn từ state cha của dashboard.
Filter-based aliases
Loại entity: DEVICE
Bộ lọc:
- device type = "Temperature Sensor"
- server attribute: building = "HCM Factory"
Time Window (Cửa sổ thời gian)
Real-time Mode
Hiển thị dữ liệu trong khoảng thời gian cuối cùng N phút/giờ, tự động cập nhật.
Last: 1 hour → Dữ liệu 1 giờ vừa qua
Last: 24 hours → Dữ liệu 24 giờ vừa qua
History Mode
Xem dữ liệu trong khoảng cố định.
From: 2026-01-01 00:00
To: 2026-01-01 23:59
Aggregation
Gộp nhiều điểm dữ liệu trong một bucket thời gian:
| Hàm | Ý nghĩa |
|---|---|
NONE | Raw data, không tổng hợp |
AVG | Trung bình |
MIN | Nhỏ nhất |
MAX | Lớn nhất |
SUM | Tổng |
COUNT | Đếm điểm |
Ví dụ: Xem nhiệt độ trung bình mỗi 1 giờ trong 7 ngày qua → interval=3600000, agg=AVG.
Grouping Interval
Tự động chọn bucket size phù hợp với khoảng thời gian, hoặc đặt thủ công.
Dashboard States
Cho phép tạo nhiều "trang" trong một dashboard:
State 1: Overview (tất cả nhà máy)
↓ Click vào nhà máy
State 2: Factory Detail (thiết bị trong nhà máy)
↓ Click vào thiết bị
State 3: Device Detail (telemetry chi tiết)
Chia sẻ Dashboard
Public link
Tạo link công khai (không cần đăng nhập) — phù hợp để nhúng vào website:
Dashboard → ... → Make public → Copy public link
Giao cho Customer
POST /api/customer/{customerId}/dashboard/{dashboardId}
Authorization: Bearer {JWT}Giao cho Customer Group
POST /api/dashboard/{dashboardId}/customers/add
Authorization: Bearer {JWT}
Content-Type: application/json
{ "customerIds": ["customer-uuid-1", "customer-uuid-2"] }Import / Export
# Export
GET /api/dashboard/{dashboardId}
Authorization: Bearer {JWT}
# → Lưu response JSON
# Import
POST /api/dashboard
Authorization: Bearer {JWT}
Content-Type: application/json
# Body = JSON đã export (xóa field "id" trước khi import)