Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

NodeMCU code to report home alarm sensor status to MQTT

License

Notifications You must be signed in to change notification settings

patrickeasters/nodemcu-sensor-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodemcu-sensor-mqtt

A project to report home alarm sensor status via MQTT using a NodeMCU development board.

Note: This is archived!

Heads up! I am no longer maintaining this project or really recommend anyone use it. The ecosystem has evolved enormously since 2017 and there are infinitely better solutions than this. I've since migrated to ESPHome, which is a fantastic way to use ESP8266 and ESP32 boards for home automation alongside an active community.

Hardware

This was a pretty simple build, using only a few components

  • NodeMCU Development Board (can easily be found on Amazon or AliExpress)

  • Door sensors (any kind of switch will do)

Firmware Requirements

This project runs using a customized NodeMCU firmware package from the Cloud Build Service. The following modules are needed:

  • file
  • gpio
  • mqtt
  • net
  • node
  • tmr
  • uart
  • wifi

Configuration

secrets.yaml contains the WiFi SSID/PSK and the MQTT broker credentials. Use the secrets.yaml.example file as a base.

config.yaml contains GPIO pin/device mappings as well as some basic MQTT topic/payload configuration.

Circuit Digram

The GPIO pins are configured with the weak internal pull-up resistor enabled. The switches are then connected to ground. When a switch is closed, the GPIO pin reads low.

Circuit Diagram

MQTT

This code publishes a payload of open or closed to an individual topic for each sensor. The topic prefix, topic names, and payload are defined in config.yaml.

Other Links

Blog post

My full Home Assistant Configuration

About

NodeMCU code to report home alarm sensor status to MQTT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages