Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

nodemcu-sensor-mqtt

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

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

Releases

No releases published

Packages

No packages published

Languages