This is a Node.js client library for remotely controlling a Raspberry Pi that is running 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.
Install it
npm install pi-control-client
GPIO client
The 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 in the GPIO service section.
Using the GPIO client
var GPIOClient = GPIOClient; // The RabbitMQ connection string (must match the one used when starting the service)var RABBIT_URL = "some_actual_connection_string"; // A unique string you make up to identify a single Raspberry Pi (must match the one used when starting the service)var DEVICE_KEY = "my_awesome_raspberry_pi"; var pinsClient = RABBIT_URL; # Get config for all pinspinsClient; # Get config for a single pinpinsClient; # Turn a pin onpinsClient; # Turn a pin offpinsClient; # Read a pin valuepinsClient;
Custom action client
The 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 in the Custom action service section.
Using the custom action client
var CustomActionClient = CustomActionClient; // The RabbitMQ connection string (must match the one used when starting the service)var RABBIT_URL = "some_actual_connection_string"; // A unique string you make up to identify a single Raspberry Pi (must match the one used when starting the service)var DEVICE_KEY = "my_awesome_raspberry_pi"; var actionsClient = RABBIT_URL ; # Call a custom actionactionsClient;