Skip to content
Firmware to propangate a smoke-alarm through MQTT using ESP8266
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
esp8266_smokedetector
include
Makefile
Makefile-user.mk
makeconfig_example.py
readme.md
spiffsconfig.py

readme.md

Smoke Detector Alert via MQTT / Wifi

It's firmware for an ESP8266 written in C++ using the Sming Framework. It is meant to be powered up by a smoke-detector once smoke is detected (thus not drawing any power from the smoke-detector battery otherwise). It will then connect to WIFI and an MQTT broker and send an MQTT message containing the room name and the current battery voltage.

The battery voltage assumes a voltage divider of 180K Ohms to 100K Ohms supplied by the 9V battery and connected to Wemos A0.

You can find the schematic in esp8266_smokedetector/esp8266_smokedetector.pdf

Configuration

Copy and modify the makeconfig_example.py and run it. This will write the configuration files which will then be written to flash. If you run a different makeconfig-* file later to flash another device, make sure to run make spiff_update before running make flash

Building

  • The firmware is built using Sming 3.5.2. Get it from github.com/SmingHub/Sming and follow the instruction there.
  • set environment variables ESP_HOME and SMING_HOME
  • ./makeconfig_myroom.py
  • make
  • make flash

MQTT Messages sent

The message format is JSON

LastWill and online msg

  • Topic: e.g.: sensors/smokedetector1/online
  • Payload: e.g.: {"ip":"192.168.1.11","online":true}

Alert msg

  • Topic: e.g.: sensors/smokedetector1/smokealarm
  • Payload: e.g.: {"room":"livingroom","voltage":9.35}
You can’t perform that action at this time.