Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Home Automation & Smart Devices

MQTT Dashboard for Smart Home: HiveMQ and Grafana Setup

MQTT Dashboard for Smart Home: HiveMQ and Grafana Setup

March 11, 2026 /Posted byJayesh Jain / 0

An MQTT dashboard for smart home using HiveMQ and Grafana transforms raw sensor data into beautiful real-time visualisations. Whether you are monitoring room temperatures across your Bengaluru apartment or tracking energy consumption in your Delhi bungalow, this tutorial walks you through building a professional IoT monitoring stack entirely free using open-source tools and Indian-available hardware.

Table of Contents

  • What is MQTT and Why Use It?
  • Setting Up HiveMQ Cloud Broker (Free Tier)
  • ESP8266/ESP32 Firmware for MQTT Publishing
  • Telegraf and InfluxDB for Data Storage
  • Building Your Grafana Dashboard
  • Panels, Alerts, and Notifications
  • India-Specific Tips
  • Frequently Asked Questions

What is MQTT and Why Use It?

MQTT (Message Queuing Telemetry Transport) is a lightweight publish-subscribe protocol designed for constrained IoT devices. For Indian homes with intermittent power and occasional WiFi drops, MQTT’s QoS levels and retained messages ensure data is never permanently lost. Key advantages: low bandwidth (a temperature reading costs ~50 bytes, negligible on Jio), persistent sessions, fan-out to 50 subscribers, and native support in Home Assistant, Node-RED, Tasmota, and ESPHome.

Recommended: UNO WiFi R3 (ATmega328P + ESP8266)

The UNO WiFi R3 combines ATmega328P with ESP8266 in one board, perfect for publishing MQTT sensor data over WiFi without separate shields. Ideal for first-time MQTT projects.

View Product →

Setting Up HiveMQ Cloud Broker (Free Tier)

HiveMQ Cloud offers a free tier supporting up to 100 connected devices and 10 GB monthly data. Register at console.hivemq.cloud, create a cluster in AWS ap-south-1 (Mumbai) for lowest latency from India, and note your Cluster URL. Add credentials under Access Management.

# Test from Linux
mosquitto_sub -h YOUR_CLUSTER.s1.eu.hivemq.cloud -p 8883 
  --capath /etc/ssl/certs/ -u zbotic_home -P yourpassword 
  -t "home/#"

mosquitto_pub -h YOUR_CLUSTER.s1.eu.hivemq.cloud -p 8883 
  --capath /etc/ssl/certs/ -u zbotic_home -P yourpassword 
  -t "home/bedroom/temperature" -m "28.5"

ESP8266/ESP32 Firmware for MQTT Publishing

Install PubSubClient library in Arduino IDE. Use WiFiClientSecure for TLS connections to HiveMQ.

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
#include <DHT.h>

const char* mqttHost = "YOUR_CLUSTER.s1.eu.hivemq.cloud";
const int   mqttPort = 8883;
DHT dht(D4, DHT22);
WiFiClientSecure espClient;
PubSubClient client(espClient);

void loop() {
  if (!client.connected()) reconnect();
  client.loop();
  static unsigned long lastMsg = 0;
  if (millis() - lastMsg > 30000) {
    lastMsg = millis();
    float t = dht.readTemperature();
    char buf[8]; dtostrf(t, 4, 1, buf);
    client.publish("home/bedroom/temperature", buf, true);
  }
}

Recommended: Mega WiFi R3 (ATmega2560 + ESP8266)

The Mega WiFi R3 with 54 I/O pins handles complex homes with many sensors. Publish temperature, humidity, PIR, and power data simultaneously over MQTT.

View Product →

Telegraf and InfluxDB for Data Storage

Grafana visualises data but does not store it. Use InfluxDB 2.x with Telegraf’s MQTT consumer plugin:

sudo apt update && sudo apt install influxdb2 telegraf
sudo systemctl enable --now influxdb

Telegraf config (/etc/telegraf/telegraf.conf):

[[inputs.mqtt_consumer]]
  servers = ["ssl://YOUR_CLUSTER.s1.eu.hivemq.cloud:8883"]
  topics  = ["home/#"]
  username = "zbotic_home"
  password = "yourpassword"
  data_format = "value"
  data_type = "float"

[[outputs.influxdb_v2]]
  urls   = ["http://localhost:8086"]
  token  = "YOUR_INFLUXDB_TOKEN"
  org    = "zbotic"
  bucket = "smarthome"

Building Your Grafana Dashboard

sudo apt install grafana
sudo systemctl enable --now grafana-server

Access at http://localhost:3000. Add InfluxDB as a data source (Flux query language). Create panels with Flux queries:

from(bucket: "smarthome")
  |> range(start: -24h)
  |> filter(fn: (r) => r.topic == "home/bedroom/temperature")
  |> aggregateWindow(every: 5m, fn: mean)

Panels, Alerts, and Notifications

Recommended panels for an Indian home:

  • Gauge: Current room temperature (alert if >35 degrees C during Indian summer)
  • Time series: 24h humidity trend for monsoon season (June-September)
  • Stat panel: Uptime of each ESP node
  • Bar gauge: Daily energy consumption in kWh (from PZEM-004T power meter)

Set up Telegram or Email alerts when a sensor goes offline or temperature spikes.

Recommended: 12V 1-Channel Relay Module (RS485/Modbus)

Integrate this RS485/Modbus relay module with your MQTT setup to control appliances based on Grafana thresholds, such as auto-switching on a cooler when temperature exceeds 35 degrees C.

View Product →

India-Specific Tips

  • Power cuts: Use QoS 1 on all MQTT publishes so messages are re-sent after reconnect.
  • IST timezone: Set Grafana timezone to Asia/Kolkata under Dashboard Settings.
  • Starter kit cost (2025): ESP8266 NodeMCU Rs 180, DHT22 Rs 120, Raspberry Pi 4 2GB Rs 4,500 – total under Rs 5,000.
  • Cloudflare Tunnel: Use for secure remote Grafana access without port-forwarding your home router.

Frequently Asked Questions

Can I use a local Mosquitto broker instead of HiveMQ Cloud?
Yes. Install Mosquitto on your Raspberry Pi with sudo apt install mosquitto and point your ESP firmware to the Pi’s local IP. Works offline without internet.
Is HiveMQ free tier enough for a full home?
For most Indian homes (5-10 sensors, 1-minute intervals), yes. A single ESP8266 publishing 4 topics every 30 seconds uses roughly 5MB/month, well within the 10GB free limit.
How do I secure my MQTT broker?
Always use TLS (port 8883), strong passwords, and per-device credentials. Never expose MQTT port 1883 (plaintext) to the internet.
Can I trigger relays based on Grafana alerts?
Not directly. Use Node-RED as the automation bridge: subscribe to MQTT, evaluate sensor conditions, and publish relay commands back to the ESP.
What database is best for long-term storage?
InfluxDB for time-series data (sensor readings). For event logs (door open/close history), use SQLite or PostgreSQL alongside InfluxDB.

Shop Home Automation at Zbotic →

Tags: ESP32, esp8266, Grafana, HiveMQ, home automation, India, IoT Dashboard, MQTT, smart home
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
Solar Powered Farm Sensor Node...
blog solar powered farm sensor node off grid iot design 599289
blog soldering for beginners step by step guide for students 599301
Soldering for Beginners: Step ...

Related posts

Blog Mqtt For Home Automation Esp32 Mosquitto Home Assistant 612684 Medium
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Blog Curtain And Blind Automation Stepper Motor Controller 612665 Medium
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Blog Smart Doorbell With Camera Esp32 Cam Video Intercom 612651 Medium
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Blog Blynk Iot Platform Control Arduino And Esp32 From Mobile 612631 Medium
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Blog Pir Sensor Automatic Light Save Electricity With Motion Detection 612603 Medium
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now