Kman Sonoff

Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt

Internet of Things (IoT)C++MIT

Abstract

Kman Sonoff is an open-source Internet of Things (IoT) project. Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt. KmanSonoff is the updated version of KmanOz/Sonoff-HomeAssistant which is alternative firmware for the brilliant & cheap range of ESP-8266 based WiFi controlled power switches. This updated firmware simplifies setup of the switch even more so than the original, yet keeps the firmware and memory footprint basic and lightweight just like it's predecessor. It is built using C++, MQTT. The complete source code is publicly available on GitHub under the MIT License, making it a useful reference for students building an Internet of Things (IoT) mini project or final-year project.

1. Introduction

KmanSonoff is the updated version of KmanOz/Sonoff-HomeAssistant which is alternative firmware for the brilliant & cheap range of ESP-8266 based WiFi controlled power switches. This updated firmware simplifies setup of the switch even more so than the original, yet keeps the firmware and memory footprint basic and lightweight just like it's predecessor. Initial setup is now done in one file "config_sc.h" for the single channel firmware or "config_mc.h" for the multichannel firmware located in the same directory as the sketch. Both versions are OTA upgradable and all naming (mqtt client name & mDNS for OTA) is automatic based on the MAC address of the ESP Wifi radio.

I realize there are many other mqtt based firmware(s) that have been written for the Sonoff switches, but I found most of them overly complex for my liking. This firmware is basic in operation but extremely stable and just gets the job done.

You'll need the Arduino IDE and has been tested on 1.8.5 but should be backwards & forwards compatible with other versions.

2. Objective

Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt

This project demonstrates how C++, MQTT can be applied to a real-world Internet of Things (IoT) problem.

4. Technology Stack

C++MQTT

5. System Requirements

General requirements for this technology stack — check the README for exact versions.

  • Arduino IDE / PlatformIO or a C++ compiler (g++)
  • Target board (e.g. Arduino, ESP32) where applicable
  • Git (to clone the repository)

6. Installation & Setup

git clone https://github.com/KmanOz/KmanSonoff.git
cd KmanSonoff

Full setup instructions are in the project README.

7. Future Enhancements

Suggested extensions you can add to make this your own project.

  • Add a mobile dashboard using Blynk or Firebase
  • Store readings in a cloud database for history charts
  • Add alerts via SMS / Telegram when thresholds are crossed

8. Viva / Review Questions

Common questions examiners ask for projects in this domain.

  1. Which microcontroller / board and sensors are used and why?
  2. How does the device send data (Wi-Fi, MQTT, HTTP, Bluetooth)?
  3. Where is the sensor data stored and visualised?
  4. How is power consumption managed?
  5. How would you secure the device and its communication?

9. Source Code & License

This project is developed by KmanOz and published on GitHub under the MIT License. Please follow the license terms and credit the original author when you use or modify this code.

Want to build this as your internship project?

Work on an Internet of Things (IoT) project like this with mentor guidance, weekly reviews and an internship certificate from Training Trains, Erode — online or offline.

Apply for Internet of Things (IoT) Internship