{"id":20569790,"url":"https://github.com/nasa-gcn/systemd-gpio","last_synced_at":"2025-10-06T04:08:38.601Z","repository":{"id":214552204,"uuid":"736792186","full_name":"nasa-gcn/systemd-gpio","owner":"nasa-gcn","description":"Use systemd to configure commands to run when a GPIO button is pressed on a Raspberry Pi. Inspired by https://github.com/ali1234/systemd-gpio.","archived":false,"fork":false,"pushed_at":"2025-06-30T20:21:15.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-30T21:28:19.598Z","etag":null,"topics":["gpio","gpiozero","raspberry-pi","systemd"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nasa-gcn.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2023-12-28T22:22:33.000Z","updated_at":"2025-06-30T20:21:12.000Z","dependencies_parsed_at":"2025-06-16T20:30:53.909Z","dependency_job_id":"e4773cfa-ed2b-44b5-a35f-689a3f2e87f8","html_url":"https://github.com/nasa-gcn/systemd-gpio","commit_stats":null,"previous_names":["nasa-gcn/systemd-gpio"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nasa-gcn/systemd-gpio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasa-gcn%2Fsystemd-gpio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasa-gcn%2Fsystemd-gpio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasa-gcn%2Fsystemd-gpio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasa-gcn%2Fsystemd-gpio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nasa-gcn","download_url":"https://codeload.github.com/nasa-gcn/systemd-gpio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasa-gcn%2Fsystemd-gpio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264853110,"owners_count":23673564,"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":["gpio","gpiozero","raspberry-pi","systemd"],"created_at":"2024-11-16T05:09:33.859Z","updated_at":"2025-10-06T04:08:33.567Z","avatar_url":"https://github.com/nasa-gcn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"SYSTEMD-GPIO(5)\n===============\n\nNAME\n----\nsystemd-gpio - run commands when a button on a GPIO pin is pressed\n\nDESCRIPTION\n-----------\n\nUse systemd to configure commands to run when a button attached to a GPIO pin is pressed, released, or held.\n\nTo configure a GPIO pin, create a file called /etc/gpio/*N*, where *N* is an integer pin number following the `gpiozero pin numbering`_ convention. Once you have populated the configuration file, activate the button by running the following command, replacing *N* with the pin number::\n\n    sudo systemctl enable --now gpio@N.service\n\nENVIRONMENT\n-----------\n\n| GPIO_PULL_UP\n| GPIO_ACTIVE_STATE\n| GPIO_BOUNCE_TIME\n| GPIO_HOLD_TIME\n| GPIO_HOLD_REPEAT\n\n    Button behavior. See the documentation for the corresponding constructor arguments of `gpiozero.Button`_.\n\n| GPIO_WHEN_HELD\n| GPIO_WHEN_PRESSED\n| GPIO_WHEN_RELEASED\n\n    Commands to run when the button is held, pressed, or released, respectively.  See the documentation for the corresponding properties of `gpiozero.Button`_.\n\nFILES\n-----\n\n/etc/gpio/*N*\n\n    Configuration file for GPIO pin *N*, where *N* corresponds to the `gpiozero pin numbering`_. The file should be in the `systemd EnvironmentFile syntax`_ and may define any of the environment variables listed above.\n\nHISTORY\n-------\n\nThis project is inspired by https://github.com/ali1234/systemd-gpio. The main difference is that we are using gpiozero_ rather than WiringPi_, because WiringPi is no longer maintained.\n\nEXAMPLES\n--------\n\nThe following example configures GPIO 23 so that when it is pressed, it prints a message to all TTYs, and when held, shuts down the machine::\n\n    # /etc/gpio/23\n    GPIO_HOLD_TIME=5\n    GPIO_WHEN_PRESSED=\"wall 'Hold the power button for 5 seconds to power off.'\"\n    GPIO_WHEN_HELD=poweroff\n\nTo activate the pin, run the following command::\n\n    sudo systemctl enable --now gpio@23.service\n\n.. _gpiozero: https://github.com/gpiozero/gpiozero\n.. _WiringPi: https://web.archive.org/web/20220405225008/http://wiringpi.com/wiringpi-deprecated/\n.. _`gpiozero.Button`: https://gpiozero.readthedocs.io/en/latest/api_input.html#gpiozero.Button\n.. _`gpiozero pin numbering`: https://gpiozero.readthedocs.io/en/latest/recipes.html#pin-numbering\n.. _`systemd EnvironmentFile syntax`: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#EnvironmentFile=\n\nSEE ALSO\n--------\n\nsystemctl(1), systemd.exec(5)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasa-gcn%2Fsystemd-gpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnasa-gcn%2Fsystemd-gpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasa-gcn%2Fsystemd-gpio/lists"}