Smart Sensor Hub is a real-time IoT monitoring platform built with ASP.NET Core, MQTT, SignalR, Entity Framework Core, SQLite, and Python.
It ingests sensor telemetry asynchronously, persists readings, evaluates threshold-based alerts, and streams live updates to a reactive command-center dashboard โ without page refreshes or polling.
IoT Device
โ
โ MQTT
โผ
MQTT Broker
โ
โผ
ASP.NET Core
โ
โโโ Process
โโโ Validate
โโโ Persist
โโโ Evaluate Alerts
โ
โผ
SignalR / WebSocket
โ
โผ
Live Dashboard
- ๐ก Real-time MQTT ingestion
- โ๏ธ Asynchronous background processing
- ๐ Automatic sensor discovery
- ๐ Live telemetry charts & sparklines
- ๐จ Normal / Warning / Critical alerts
- ๐๏ธ Bidirectional device ON/OFF control
- ๐พ Historical telemetry persistence
- ๐ CSV data export
- โก SignalR-powered live updates
- ๐ Responsive dark command-center UI
โโโโโโโโโโโโโโโโโโโโโโโโ
โ Python Simulator โ
โ paho-mqtt โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โ MQTT Publish
โผ
โโโโโโโโโโโโโโโโโโโโโโโโ
โ HiveMQ Broker โ
โ smarthub/sensors/# โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โ MQTT Subscribe
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ASP.NET Core โ
โ โ
โ MqttListenerService โ
โ โ โ
โ โโโ JSON Processing โ
โ โโโ Threshold Engine โ
โ โโโ EF Core โ
โ โ โ
โ โผ โ
โ SQLite โ
โ โ
โ SignalR โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ
โ WebSocket
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Web Dashboard โ
โ โ
โ KPI Cards โ Charts โ
โ Sparklines โ Alerts โ
โ History โ Device Control โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The simulator publishes sensor telemetry through MQTT:
{
"sensorId": "Machine-A1",
"temp": 72.5
}MqttListenerService runs as an ASP.NET Core BackgroundService and subscribes to:
smarthub/sensors/#
The backend:
- Parses incoming JSON
- Detects sensors dynamically
- Calculates sensor status
- Persists telemetry
- Broadcasts updates
SignalR pushes the processed telemetry directly to connected browsers.
The frontend instantly updates:
KPI โ Sparkline โ Chart โ Status โ Alert
No polling. No refresh.
Sensor health is determined from configurable temperature thresholds.
const WARN_TEMP = 75;
const CRIT_TEMP = 85;| Temperature | Status |
|---|---|
< 75ยฐC |
๐ข Normal |
75ยฐC โ 84.9ยฐC |
๐ก Warning |
โฅ 85ยฐC |
๐ด Critical |
Critical events are reflected immediately across the dashboard and global alert ticker.
Smart Sensor Hub supports both telemetry ingestion and device commands.
Dashboard
โ
โ ON / OFF
โผ
ASP.NET Core
โ
โ MQTT Publish
โผ
MQTT Broker
โ
โผ
IoT Device
Example command:
{
"sensorId": "Machine-A1",
"command": "ON"
}The command-center interface provides:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MACHINE-A1 โ
โ โ
โ ๐ก 72.5ยฐC ๐ข NORMAL โ
โ โ
โ โโโโโ
โโโโโ โ
โ โ
โ Power [ ON ] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Live sensor KPI cards
- Temperature trends
- Animated values
- Real-time Chart.js graphs
- Sensor status indicators
- Global alert ticker
- Device power controls
- Historical data modal
- CSV export
- ASP.NET Core MVC
- .NET 8
- Entity Framework Core
- SQLite
- SignalR
- MQTTnet
- BackgroundService
- HTML5
- CSS3
- Vanilla JavaScript
- Chart.js
- SignalR JavaScript Client
- JetBrains Mono
- IBM Plex Sans
- Python 3
- paho-mqtt
Smart-Sensor-Hub/
โ
โโโ Controllers/
โ โโโ SensorApiController.cs
โ
โโโ Services/
โ โโโ MqttListenerService.cs
โ
โโโ Models/
โ โโโ SensorReading.cs
โ
โโโ Data/
โ โโโ ApplicationDbContext.cs
โ
โโโ Hubs/
โ โโโ SensorHub.cs
โ
โโโ Views/
โ
โโโ wwwroot/
โ โโโ css/
โ โโโ js/
โ
โโโ SensorSimulator/
โ โโโ sensor.py
โ
โโโ Program.cs
โโโ appsettings.json
โโโ README.md
git clone https://github.com/MSSOhan/Smart-Sensor-Hub.git
cd Smart-Sensor-Hubdotnet restore
dotnet runOpen the URL shown in the terminal, typically:
http://localhost:5010
The SQLite database is created automatically on first run.
Open another terminal:
pip install paho-mqtt
python fake_sensor.pyThe simulator will begin publishing telemetry to the MQTT broker.
http://localhost:5010
Sensors should appear automatically as telemetry arrives.
Default broker:
broker.hivemq.com
MQTT configuration is located in:
Services/MqttListenerService.cs
Controllers/SensorApiController.cs
Configure alert levels in the frontend JavaScript:
const WARN_TEMP = 75;
const CRIT_TEMP = 85;The project currently uses a public MQTT broker for demonstration purposes.
For production deployments, use:
- MQTT over TLS
- Authenticated/private MQTT broker
- Secure application secrets
- Role-based access control
- Production database
- Centralized logging
- Monitoring & metrics
- Network isolation
โ ๏ธ Do not send sensitive or production telemetry through a public MQTT broker.
- ๐ Authentication & RBAC
- ๐ก MQTT TLS & authentication
- ๐ Advanced analytics
- ๐ค Predictive maintenance
- ๐ Email / push notifications
- ๐บ๏ธ Device location mapping
- ๐ณ Docker support
- โ๏ธ Cloud deployment
- ๐ Prometheus / Grafana integration
- ๐๏ธ PostgreSQL / SQL Server support
Contributions, issues, and feature requests are welcome.
git checkout -b feature/my-feature
git commit -m "Add my feature"
git push origin feature/my-featureThen open a Pull Request.
This project is licensed under the MIT License.