Skip to content

feat: add PIRMotionInput plugin for HC-SR501 motion sensor#2476

Open
Wanbogang wants to merge 3 commits intoOpenMind:mainfrom
Wanbogang:feature/pir-motion-sensor
Open

feat: add PIRMotionInput plugin for HC-SR501 motion sensor#2476
Wanbogang wants to merge 3 commits intoOpenMind:mainfrom
Wanbogang:feature/pir-motion-sensor

Conversation

@Wanbogang
Copy link
Collaborator

@Wanbogang Wanbogang commented Mar 14, 2026

Summary

Adds a new input plugin for the HC-SR501 Passive Infrared (PIR) motion sensor. The plugin converts hardware motion detection events into natural language context for the LLM. #365

Changes

  • src/inputs/plugins/pir_motion.py — main plugin with four hardware backends
  • config/pir_guard.json5 — ready-to-use security guard config
  • docs/robotics/pir_hc_sr501.md — hardware wiring and configuration guide
  • docs/developing/4_inputs.md — added PIR entry to input plugin examples
  • tests/inputs/plugins/test_pir_motion.py — 55 tests, 94% coverage

Hardware Backends

Connector Hardware Use case
serial Arduino / USB microcontroller Cross-platform, multi-sensor
gpio Raspberry Pi / Jetson Direct wiring, minimal hardware
zenoh Any Zenoh-capable device Distributed / multi-robot setups
mock No hardware Development and testing (default)

Notes

  • Default connector is mock — safe to run on any machine without hardware
  • cooldown parameter prevents LLM context flooding when sensor stays HIGH (HC-SR501 can hold HIGH up to ~200s)
  • All backends degrade gracefully if the required library is not installed
  • Follows existing OM1 plugin patterns (FuserInput, IOProvider, formatted_latest_buffer)

- Support four hardware backends: serial, gpio, zenoh, mock
- Serial connector for Arduino/USB microcontrollers
- GPIO connector for Raspberry Pi and Jetson (RPi.GPIO / Jetson.GPIO)
- Zenoh connector for network-distributed setups
- Mock connector as default for safe out-of-box experience
- Cooldown parameter to prevent LLM context flooding
- All backends degrade gracefully if library not installed
- Add pir_guard.json5 config with all required schema fields
- Add docs/robotics/pir_hc_sr501.md hardware documentation
- Update docs/developing/4_inputs.md with PIR entry
@Wanbogang Wanbogang requested review from a team as code owners March 14, 2026 05:16
@github-actions github-actions bot added documentation Improvements or additions to documentation robotics Robotics code changes python Python code tests Test files config Configuration files labels Mar 14, 2026
@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 93.63636% with 14 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/inputs/plugins/pir_motion.py 93.63% 14 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration files documentation Improvements or additions to documentation python Python code robotics Robotics code changes tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant