{"id":22418860,"url":"https://github.com/CBinet/brocoli-pi","last_synced_at":"2025-08-01T04:31:18.262Z","repository":{"id":57190457,"uuid":"87875417","full_name":"CBinet/brocoli-pi","owner":"CBinet","description":"Flask REST API for Raspberry PI","archived":false,"fork":false,"pushed_at":"2018-10-17T23:28:17.000Z","size":381,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-05T16:12:57.380Z","etag":null,"topics":["flask","flask-restful","gpio","rasberrypi","raspberry-pi","tutorial","web-server","webserver"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/brocoli-pi","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CBinet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-11T01:45:47.000Z","updated_at":"2018-10-17T23:28:18.000Z","dependencies_parsed_at":"2022-08-27T10:41:22.134Z","dependency_job_id":null,"html_url":"https://github.com/CBinet/brocoli-pi","commit_stats":null,"previous_names":["cbinet/webpi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CBinet%2Fbrocoli-pi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CBinet%2Fbrocoli-pi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CBinet%2Fbrocoli-pi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CBinet%2Fbrocoli-pi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CBinet","download_url":"https://codeload.github.com/CBinet/brocoli-pi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228330163,"owners_count":17903019,"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":["flask","flask-restful","gpio","rasberrypi","raspberry-pi","tutorial","web-server","webserver"],"created_at":"2024-12-05T16:13:01.473Z","updated_at":"2024-12-05T16:13:02.585Z","avatar_url":"https://github.com/CBinet.png","language":"Python","readme":"# Brocoli pi\r\n**Brocoli pi - Flask REST API for Raspberry pi**\r\n\r\n# Installation\r\n\r\n## Install with git\r\n\r\n### Clone the repository :\r\n```sh\r\ngit clone https://github.com/CBinet/Brocoli-pi.git\r\n```\r\n\r\n### Launch Brocoli pi\r\nLaunch the server :\r\n```sh\r\npython server.py\r\n```\r\nYour server will then be running locally at address http://0.0.0.0:5000. \u003cbr\u003e\r\nFrom other devices, the address will be your pi address. **Example** : http://192.168.2.51:5000. \u003cbr\u003e \r\n*You can get your raspberry pi IP address with the following command :*\r\n```sh\r\nhostname -I\r\n```\r\n\r\n## Install with npm\r\n\r\n### Install the package\r\n```sh\r\nnpm install brocoli-pi\r\n```\r\nNavigate inside the brocoli-pi folder then :\r\n### Launch Brocoli pi\r\n```sh\r\nnpm start\r\n```\r\n\r\n## **Extras** - Setup autorun on bootup\r\nIf you want to start the server automatically when\r\nyou boot up your raspberry, you can modify your **.profile** file\r\nlocated in your raspberry pi home folder :\r\n```sh\r\nsudo nano ~/.profile\r\n```\r\n\r\nAdd the following line at the end of the file :\r\n```sh\r\npython \u003cwhere-your-server.py-is-located\u003e/server.py\r\n```\r\nThen press **CTRL+X**, **Y** to save and quit the file editor. \u003cbr\u003e \u003cbr\u003e\r\n\r\n**Example** : Let's say your git repository is located in \r\nyour home folder. If you want to add a greeting message, \r\npull the latest version of *Brocoli-pi* and also start the server\r\nyou would do something like this :\r\n```sh\r\necho Greetings, human.\r\ncd ~/\r\ngit pull origin master\r\npython server.py\r\n```\r\n\r\n# Using Brocoli-pi\r\nTo run the server :\r\n```sh\r\npython server.py\r\n```\r\nOnce the server is started, you can test it by navigating to http://0.0.0.0:5000/outputs. \u003cbr\u003e \r\nYou should see a list of your outputs.\r\n\r\n# Modules\r\n\r\n## GPIOControls\r\n\r\n### **Classes** :\r\n- **Output** : *Single output pin*\r\n- **Group** : *Group of output pins*\r\n\r\n### **Usage** : \r\n```py\r\n# Instanciate an output at location '17'\r\n# with label \"Red Light\".\r\noutput = Output(17, \"Red Light\")\r\n\r\n# Toggles the voltage of 'output'\r\noutput.toggle()\r\n\r\n# ...\r\n\r\n# Instanciate a group controlling 'outputs' with\r\n# the label \"LED group\"\r\ngroup = Group(0, outputs, \"LED group\")\r\n\r\n# This will toggle the voltage of the outputs\r\n# of the group.\r\ngroup.toggle()\r\n```\r\n\r\n\r\n### **Routes** :\r\n- GET/ outputs : *Returns informations of current binded outputs*\r\n- GET/ outputs/:id : *Returns information of the output at 'id' location*\r\n- GET/ outputs/:id/toggle : *Toggle the voltage of the output at 'id' location*\r\n- GET/ groups : *Returns informations of current binded groups*\r\n- GET/ groups/:id : *Returns information of the group 'id'*\r\n- GET/ groups/:id/toggle : *Toggle the voltage of the output of group 'id'*\r\n\r\n### **Example responses** :\r\n\r\n*GET/ outputs* :\r\n```json\r\n{\r\n  \"results\": [\r\n    {\r\n      \"id\": 17,\r\n      \"info\": \"Red Light\",\r\n      \"state\": false\r\n    },\r\n    {\r\n      \"id\": 18,\r\n      \"info\": \"Green Light\",\r\n      \"state\": false\r\n    },\r\n    {\r\n      \"id\": 19,\r\n      \"info\": \"Yellow Light\",\r\n      \"state\": false\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n*GET/ outputs/17/toggle* :\r\n```json\r\n    {\r\n        \"id\": 17,\r\n        \"info\": \"Red Light\",\r\n        \"state\": true\r\n    }\r\n```\r\n\r\n*GET/ groups/0* :\r\n```json\r\n{\r\n    \"id\": 0,\r\n    \"info\": \"Basic 3 LED group\",\r\n    \"outputs\": [\r\n    {\r\n        \"id\": 17,\r\n        \"info\": \"Red Light\",\r\n        \"state\": false\r\n    },\r\n    {\r\n        \"id\": 18,\r\n        \"info\": \"Green Light\",\r\n        \"state\": false\r\n    },\r\n    {\r\n        \"id\": 19,\r\n        \"info\": \"Yellow Light\",\r\n        \"state\": false\r\n    }\r\n    ],\r\n    \"state\": false\r\n}\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCBinet%2Fbrocoli-pi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCBinet%2Fbrocoli-pi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCBinet%2Fbrocoli-pi/lists"}