{"id":22468503,"url":"https://github.com/projectweekend/pi-control-client-js","last_synced_at":"2025-03-27T15:44:36.428Z","repository":{"id":26543131,"uuid":"29996572","full_name":"projectweekend/Pi-Control-Client-JS","owner":"projectweekend","description":"A Node.js client for remotely controlling a Raspberry Pi running Pi-Control-Service (https://github.com/projectweekend/Pi-Control-Service)","archived":false,"fork":false,"pushed_at":"2015-02-04T11:46:41.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T21:30:48.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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-01-29T01:01:03.000Z","updated_at":"2015-02-04T11:46:41.000Z","dependencies_parsed_at":"2022-07-25T15:32:11.554Z","dependency_job_id":null,"html_url":"https://github.com/projectweekend/Pi-Control-Client-JS","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-Control-Client-JS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Control-Client-JS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Control-Client-JS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FPi-Control-Client-JS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectweekend","download_url":"https://codeload.github.com/projectweekend/Pi-Control-Client-JS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245874193,"owners_count":20686724,"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:00.186Z","updated_at":"2025-03-27T15:44:36.390Z","avatar_url":"https://github.com/projectweekend.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a Node.js client library for remotely controlling a Raspberry Pi that is running [Pi-Control-Service](https://github.com/projectweekend/Pi-Control-Service). After following the instructions for setting up the service, you will need to reuse the same RabbitMQ connection string and device key values to start a client.\n\n\n## Install it\n\n```\nnpm install pi-control-client\n```\n\n## GPIO client\n\nThe GPIO client (`pi-control-client.GPIOClient`) is used to control a Raspberry Pi running the GPIO service. More information about the service can be found [here](https://github.com/projectweekend/Pi-Control-Service) in the **GPIO service** section.\n\n\n### Using the GPIO client\n\n```javascript\nvar GPIOClient = require( \"pi-control-client\" ).GPIOClient;\n\n// The RabbitMQ connection string (must match the one used when starting the service)\nvar RABBIT_URL = \"some_actual_connection_string\";\n\n// A unique string you make up to identify a single Raspberry Pi (must match the one used when starting the service)\nvar DEVICE_KEY = \"my_awesome_raspberry_pi\";\n\nvar pinsClient = new GPIOClient(RABBIT_URL);\n\n# Get config for all pins\npinsClient.readConfig( DEVICE_KEY, function ( err, result ) {\n    if ( err ) {\n        // do something with error\n    }\n    // do something with result\n    console.log( result );\n} );\n\n# Get config for a single pin\npinsClient.readConfig( DEVICE_KEY, 18, function ( err, result ) {\n    if ( err ) {\n        // do something with error\n    }\n    // do something with result\n    console.log( result );\n} );\n\n# Turn a pin on\npinsClient.on( DEVICE_KEY, 18, function ( err, result ) {\n    if ( err ) {\n        // do something with error\n    }\n    // do something with result\n    console.log( result );\n} );\n\n# Turn a pin off\npinsClient.off( DEVICE_KEY, 18, function ( err, result ) {\n    if ( err ) {\n        // do something with error\n    }\n    // do something with result\n    console.log( result );\n} );\n\n# Read a pin value\npinsClient.readValue( DEVICE_KEY, 18, function ( err, result ) {\n    if ( err ) {\n        // do something with error\n    }\n    // do something with result\n    console.log( result );\n} );\n```\n\n\n## Custom action client\n\nThe custom action service (`pi-control-service.CustomActionService`) is used to control a Raspberry Pi running the custom action service. More information about the service can be found [here](https://github.com/projectweekend/Pi-Control-Service) in the **Custom action service** section.\n\n\n### Using the custom action client\n\n```javascript\nvar CustomActionClient = require( \"pi-control-client\" ).CustomActionClient;\n\n// The RabbitMQ connection string (must match the one used when starting the service)\nvar RABBIT_URL = \"some_actual_connection_string\";\n\n// A unique string you make up to identify a single Raspberry Pi (must match the one used when starting the service)\nvar DEVICE_KEY = \"my_awesome_raspberry_pi\";\n\nvar actionsClient = new CustomActionClient( RABBIT_URL );\n\n# Call a custom action\nactionsClient.call( DEVICE_KEY, \"name_of_action_method\", function ( err, result ) {\n    if ( err ) {\n        // do something with error\n    }\n    // do something with result\n    console.log( result );\n} );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-control-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectweekend%2Fpi-control-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fpi-control-client-js/lists"}