Git Product home page Git Product logo

felixbetz / esp8266motionsensor Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.96 MB

This project uses NodeMcu (ESP8266) to detect movement with 3 motion sensors (Hailege AM312 ). The state of the motion sensor is sent via MQTT. The project is ready for Homeassistant auto discovery.

License: MIT License

C 15.42% C++ 84.58%
autodiscovery esp8266 homeassistant wifi diy motion motion-sensor movement selfmade sensor movement-sensor

esp8266motionsensor's Introduction

Esp8266MotionSensor

This project uses NodeMcu (ESP8266) to detect movement with 3 motion sensors (Hailege AM312 ). The state of the motion sensor is sent via MQTT. The project is ready for Homeassistant auto discovery.

BOM (bill of materials)

Wiring

  • PowerSupply of the Motions Sensors: 3.3V
  • First Motion Sensor (Out Pin) is connceted to D0/GPIO16
  • Second Motion Sensor (Out Pin) is connceted to D1/GPIO5
  • Third Motion Sensor (Out Pin) is connceted to D2/GPIO4 wiring image

Developing Environment

  • VS Code is used as IDE
  • PlatformIO extension for building/uploading code
  • 2 building enviorments:
    • [env:nodemcuv2]: using COM port to flash software
    • [env:nodemcuv2_ota]: using ArduinoOTA to flash over the air via WiFi

Features

  • ArduinoOTA to flashing OTA
  • Home Assistant auto discovery
    • discovery topic: homeassistant/binary_sensor/motion_sensor_floor_01/config
      {
        "name": "Motion Sensor Floor",
        "unique_id": "motion_sensor_floor_01",
        "device_class": "motion",
        "state_topic": "homeassistant/binary_sensor/motion_sensor_floor_01/state",
        "expire_after": "60"
      }
  • send motion state via MQTT
    • state topic: homeassistant/binary_sensor/motion_sensor_floor_01/state (states: OFF or ON)

Getting Started

  1. install VS Code and PlatformIO extension

  2. enter secrets

    • rename secrets_dummy.h to secrets.h
    • enter your connection secrets
     // Wifi settings
     #define WIFI_SSID "";
     #define WIFI_PASSWORD ""
    
     // MQTT setting
     #define MQTT_SERVER ""
     #define MQTT_USER ""
     #define MQTT_PASSWORD ""
  3. select [env:nodemcuv2] enviroment

  4. build and upload

esp8266motionsensor's People

Contributors

felixbetz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.