{"id":22468528,"url":"https://github.com/projectweekend/pi-magic-button","last_synced_at":"2025-03-27T15:44:42.017Z","repository":{"id":18868896,"uuid":"22085852","full_name":"projectweekend/Pi-Magic-Button","owner":"projectweekend","description":"Physical button + API end point","archived":false,"fork":false,"pushed_at":"2015-04-24T11:49:00.000Z","size":301,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T19:29:50.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/projectweekend.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}},"created_at":"2014-07-22T01:03:16.000Z","updated_at":"2020-10-16T01:57:24.000Z","dependencies_parsed_at":"2022-09-25T03:00:31.604Z","dependency_job_id":null,"html_url":"https://github.com/projectweekend/Pi-Magic-Button","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Magic-Button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Magic-Button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Magic-Button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Magic-Button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectweekend","download_url":"https://codeload.github.com/projectweekend/Pi-Magic-Button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245874204,"owners_count":20686726,"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":[],"created_at":"2024-12-06T11:17:17.351Z","updated_at":"2025-03-27T15:44:41.975Z","avatar_url":"https://github.com/projectweekend.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This program makes it easy to map physical buttons, connected to the Raspberry Pi's GPIO pins, to API end points. Details for each button are managed in a configuration file. All you really need to do is wire things up, then edit the file.\n\n------------------------------------------------------------------------------\n### Installation\n------------------------------------------------------------------------------\n\n#### Step 1: Clone this repo\n\n```\ngit clone https://github.com/projectweekend/Pi-Magic-Button.git\n```\n\n#### Step 2: Run install script\n\nFrom the project directory `Pi-Magic-Button/`, run the following command:\n\n```\n./install.sh\n```\n\n**NOTE:** This step will probably take several minutes to complete. When the script begins to install [Upstart](http://upstart.ubuntu.com/), you will receive a warning. It will prompt you to type the following message to confirm the installation: `Yes, do as I say!`. You must type it exactly.\n\n#### Step 3: Reboot\n\n```\nsudo reboot\n```\n\n------------------------------------------------------------------------------\n### Configuration\n------------------------------------------------------------------------------\n\nThe actions for each button need to be defined in a file named: `config.yml`. The install script will create an empty one in the root of `/Pi-Magic-Button`. Here is a complete example file:\n\n~~~yaml\nsuccess_pin: 17\nfailure_pin: 22\nactions:\n    - button_pin: 4\n      api_url: https://www.something.com/api/blah\n      api_method: POST\n      api_data:\n        some_field: 122345\n        some_other_field: some string data\n    - button_pin: 18\n      api_url: https://www.something.com/api/test\n      api_method: POST\n      api_data:\n        a_different_field: 77777\n        another_different_field: some string data\n~~~\n\n#### Main Properties\n\n* `success_pin`: This pin can be connected to an LED that will light up if the button's action successfully contacted the API end point.\n* `failure_pin`: This pin can be connected to an LED that will light up if the button's action did not successfully contact the API end point.\n* `actions`: This is an array of configurations for each button that has been wired up to the Raspberry Pi.\n\n#### Button Properties\n\nEach button item in the configuration file's `actions` array has 4 properties.\n\n* `button_pin`: This is the pin connected to the button. Under the hood each button pin is initialized using a software-defined pull up resistor. When wiring up the button connect it to ground so that it will pull the pin low when pressed.\n* `api_url`: This is the URL that the button will make a request to when pressed\n* `api_method`: This is the HTTP request method to use with the URL: `GET`, `POST`, `PUT`, `DELETE`\n* `api_data`: Each property defined in this object will be passed to the `api_url` in the body of a `POST` or `PUT` request. `GET` and `DELETE` requests will ignore this.\n\n------------------------------------------------------------------------------\n### Upstart\n------------------------------------------------------------------------------\n\n[Upstart](http://upstart.ubuntu.com/) is used to run this program in the background on the Raspberry Pi. It will automatically start on boot as well. Every time you edit the `config.yml` you will need to restart the `magic-button` service so that it can load the new configurations. Use this command:\n\n```\nsudo service magic-button restart\n```\n\nTo stop the service use this command:\n\n```\nsudo service magic-button stop\n```\n\nTo start it back up again, use this command:\n\n```\nsudo service magic-button start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-magic-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectweekend%2Fpi-magic-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-magic-button/lists"}