{"id":15161005,"url":"https://github.com/felixbetz/esp8266motionsensor","last_synced_at":"2026-01-21T15:32:53.800Z","repository":{"id":198877867,"uuid":"701728212","full_name":"FelixBetz/Esp8266MotionSensor","owner":"FelixBetz","description":"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.","archived":false,"fork":false,"pushed_at":"2024-03-30T09:17:16.000Z","size":2005,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T22:49:47.895Z","etag":null,"topics":["autodiscovery","diy","esp8266","homeassistant","motion","motion-sensor","movement","movement-sensor","selfmade","sensor","wifi"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FelixBetz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-07T11:47:57.000Z","updated_at":"2024-03-30T10:09:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5268a98-bafb-4c44-9d21-e1a63a0dad16","html_url":"https://github.com/FelixBetz/Esp8266MotionSensor","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.375,"last_synced_commit":"9c96025d281f95a392c03031aa0d53b2ce4db9de"},"previous_names":["felixbetz/esp8266motionsensor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixBetz%2FEsp8266MotionSensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixBetz%2FEsp8266MotionSensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixBetz%2FEsp8266MotionSensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FelixBetz%2FEsp8266MotionSensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FelixBetz","download_url":"https://codeload.github.com/FelixBetz/Esp8266MotionSensor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247730987,"owners_count":20986571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autodiscovery","diy","esp8266","homeassistant","motion","motion-sensor","movement","movement-sensor","selfmade","sensor","wifi"],"created_at":"2024-09-26T23:43:54.342Z","updated_at":"2026-01-21T15:32:53.794Z","avatar_url":"https://github.com/FelixBetz.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Esp8266MotionSensor\n\nThis 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.\n\n## BOM (bill of materials)\n\n- [NodeMCU ESP8266 WiFi Module](https://www.az-delivery.de/en/products/nodemcu-lolin-v3-modul-mit-esp8266)\n- [2x Hailege AM312](https://www.amazon.de/Hailege-Pyroelectric-Sensor-Infrared-Detector/dp/B08C5572W4/ref=sr_1_5?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91\u0026keywords=motion+sensor+infrared\u0026sr=8-5)\n\n## Wiring\n- PowerSupply of the Motions Sensors: `3.3V`\n- First Motion Sensor (Out Pin) is connceted  to `D0/GPIO16`\n- Second Motion Sensor (Out Pin) is connceted  to `D1/GPIO5`\n- Third Motion Sensor (Out Pin) is connceted  to `D2/GPIO4`\n![wiring image](doc/wiring.drawio.png) \n## Developing Environment\n\n- [VS Code](https://code.visualstudio.com/) is used as IDE\n- [PlatformIO](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide) extension for building/uploading code\n- 2 building enviorments:\n  - `[env:nodemcuv2]`: using COM port to flash software\n  - `[env:nodemcuv2_ota]`: using [ArduinoOTA](https://github.com/JAndrassy/ArduinoOTA) to flash over the air via WiFi\n\n## Features\n\n- [ArduinoOTA](https://github.com/JAndrassy/ArduinoOTA) to flashing OTA\n- [Home Assistant auto discovery](https://www.home-assistant.io/integrations/mqtt/)\n  - discovery topic: `homeassistant/binary_sensor/motion_sensor_floor_01/config`\n    ```json\n    {\n      \"name\": \"Motion Sensor Floor\",\n      \"unique_id\": \"motion_sensor_floor_01\",\n      \"device_class\": \"motion\",\n      \"state_topic\": \"homeassistant/binary_sensor/motion_sensor_floor_01/state\",\n      \"expire_after\": \"60\"\n    }\n    ```\n- send motion state via MQTT\n  - state topic: `homeassistant/binary_sensor/motion_sensor_floor_01/state` (states: `OFF` or `ON`)\n\n## Getting Started\n\n1. install [VS Code](https://code.visualstudio.com/) and [PlatformIO](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide) extension\n2. enter secrets\n\n   - rename `secrets_dummy.h` to `secrets.h`\n   - enter your connection secrets\n\n   ```c++\n    // Wifi settings\n    #define WIFI_SSID \"\";\n    #define WIFI_PASSWORD \"\"\n\n    // MQTT setting\n    #define MQTT_SERVER \"\"\n    #define MQTT_USER \"\"\n    #define MQTT_PASSWORD \"\"\n   ```\n\n3. select `[env:nodemcuv2]` enviroment\n4. `build` and `upload`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixbetz%2Fesp8266motionsensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelixbetz%2Fesp8266motionsensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelixbetz%2Fesp8266motionsensor/lists"}