IoT Integration
IoT Integration
MQTT Topic Structure
hmpiot/{orgId}/{deviceId}/telemetry # Sensor data (publish)
hmpiot/{orgId}/{deviceId}/status # Device status (publish)
hmpiot/{orgId}/{deviceId}/command # Control commands (subscribe)
hmpiot/{orgId}/{deviceId}/config # Device configuration (subscribe)
MQTT QoS Levels
| Level | Description | Use Case |
|---|---|---|
| QoS 0 | At most once | High-frequency telemetry |
| QoS 1 | At least once | Important alerts |
| QoS 2 | Exactly once | Command acknowledgments |
Telemetry Flow
IoT Device ──MQTT──▶ EMQX ──▶ NestJS MQTT Module ──▶ Database
│
└──▶ WebSocket ──▶ Frontend (real-time)
Device Types
| Type | Description | Examples |
|---|---|---|
| Sensor | Environmental sensors | pH, DO, temperature, salinity |
| Gateway | Data concentrator | 4-IO Gateway |
| Controller | Device control | Feeder, pump, aerator |
Device Provisioning
- Register device in system via API
- Assign device to organization
- Configure MQTT credentials
- Device connects with client ID matching device ID
Alert System
- Automatic offline detection (5-minute cron job)
- Alert configuration with threshold values
- User notifications for active alerts
- Alert types: LOW_BATTERY, OFFLINE, THRESHOLD_EXCEEDED
Last updated: March 2026