{"id":22468544,"url":"https://github.com/projectweekend/pi-celery-gpio","last_synced_at":"2025-09-11T02:08:56.525Z","repository":{"id":76097574,"uuid":"38207578","full_name":"projectweekend/Pi-Celery-GPIO","owner":"projectweekend","description":"Examples combining Celery (http://www.celeryproject.org/) and Raspberry Pi GPIO","archived":false,"fork":false,"pushed_at":"2015-07-18T14:44:37.000Z","size":168,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T19:29:52.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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":"2015-06-28T17:28:13.000Z","updated_at":"2023-06-19T06:59:18.000Z","dependencies_parsed_at":"2023-02-27T00:48:46.520Z","dependency_job_id":null,"html_url":"https://github.com/projectweekend/Pi-Celery-GPIO","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-Celery-GPIO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Celery-GPIO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Celery-GPIO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Celery-GPIO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectweekend","download_url":"https://codeload.github.com/projectweekend/Pi-Celery-GPIO/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245874215,"owners_count":20686727,"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:25.542Z","updated_at":"2025-03-27T15:44:44.276Z","avatar_url":"https://github.com/projectweekend.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pi-Celery-GPIO\nAn example combining Celery (http://www.celeryproject.org/) and [Raspberry Pi GPIO](https://www.raspberrypi.org/documentation/usage/gpio/)\n\n\n\n## Service\n\n* This directory (`/service`) contains a Celery worker meant to run on a Raspberry Pi.\n* The `/service/requirements.txt` file tracks all the Python dependencies for the examples in this directory. To manually install: `sudo pip install -r requirements.txt`.\n* The `/service/control` directory contains a Celery worker that receives tasks to control the Raspberry Pi's GPIO pins.\n* Automated install with [Fabric](http://www.fabfile.org/): `fab install_celery_control`\n* Automated update with [Fabric](http://www.fabfile.org/): `fab install_celery_update`\n\n\n### Controlling GPIO\n\nExport the following environment variables before starting the worker:\n* `CONTROL_RABBIT_URL`: The [RabbitMQ](https://www.rabbitmq.com/) connection URL for the [Celery broker](http://celery.readthedocs.org/en/latest/getting-started/brokers/rabbitmq.html).\n* `CONTROL_PIN_CONFIG`: The path to a [config file](https://github.com/projectweekend/Pi-Pin-Manager#configure-it) that defines the pins available to be controlled. **Note:** This worker only receives messages to flip or read GPIO pins so the config `mode` should always be set to `OUT`.\n* `C_FORCE_ROOT`: Set this to `True` because the Raspberry Pi GPIO access requires root access.\n\nStart the `control` Celery worker by running this command inside the `/service` directory:\n```\nsudo -E celery -A control worker\n```\n\n### Using the GPIO Client\n\nIn the `/client` package there is a class to use for interacting with the Raspberry Pi that is running the `control` Celery worker. You can run this from anywhere that can connect to the same RabbitMQ instance referenced in `CONTROL_RABBIT_URL`.\n\n**Example:**\n```python\nfrom client.gpio import GPIOClient\n\n# Set this to the same connection URL used in CONTROL_RABBIT_URL\nCONTROL_RABBIT_URL = ''\n\n# Create an instance of the class\nclient = GPIOClient(CONTROL_RABBIT_URL)\n\n# Turn pin on (result will be 1)\nresult = client.on(18)\n\n# Turn pin off (result will be 0)\nresult = client.off(18)\n\n# Read pin state (result will be 0 or 1)\nresult = client.read(18)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-celery-gpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectweekend%2Fpi-celery-gpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-celery-gpio/lists"}