Execute custom scripts with hc-sr501 motion sensor

Usage no npm install needed!

<script type="module">
  import homebridgeHcsr501SensorScript from 'https://cdn.skypack.dev/homebridge-hcsr501-sensor-script';



Homebridge pluging for execute custom scripts when hc-sr501 motion sensor on a Raspberry Pi is trigger.

alt text


Run the following command

npm install -g --unsafe-perm homebridge-hcsr501-sensor-script

Note: depending on your platform you might need to run npm install -g with root privileges.

See the Homebridge documentation for more information.


Update your Homebridge config.json file. See config-sample.json for a complete example.

"accessories" : [
        "accessory": "HCSR501-script",
        "name": "Motion Sensor",
        "pinId": 24,
        "start": "~/start.sh",
        "stop": "~/stop.sh"
Name Value Required Notes
accessory HCSR501-script yes Must be set to "HCSR501-script"
name (custom) yes Name of accessory that will appear in HomeKit app
pinId (custom) yes The pin you connected the motion sensor
start (custom) yes Location of script to execute the start action
stop (custom) yes Location of script to execute the stop action
manufacturer (custom) optional The text of manufacturer
model (custom) optional The text of model
serial (custom) optional The text of serial