https://github.com/chrkhl/sphero-connector-http
A small CLI tool to connect and control Sphero toys via HTTP requests
https://github.com/chrkhl/sphero-connector-http
api cli connector express http sphero
Last synced: 2 months ago
JSON representation
A small CLI tool to connect and control Sphero toys via HTTP requests
- Host: GitHub
- URL: https://github.com/chrkhl/sphero-connector-http
- Owner: chrkhl
- License: mit
- Created: 2019-01-22T20:27:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T21:57:27.000Z (about 3 years ago)
- Last Synced: 2025-10-06T22:58:43.846Z (6 months ago)
- Topics: api, cli, connector, express, http, sphero
- Language: JavaScript
- Size: 1.49 MB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.org/package/sphero-connector-http)
[](https://david-dm.org/chrkhl/sphero-connector-http)
[](https://david-dm.org/chrkhl/sphero-connector-http#info=devDependencies)
[](https://travis-ci.org/chrkhl/sphero-connector-http)
[](https://coveralls.io/github/chrkhl/sphero-connector-http?branch=master)

# Sphero Connector HTTP
This is a small CLI tool to run an [express](https://github.com/expressjs/express) based HTTP server for connecting and controlling Sphero toys via HTTP requests. It uses [Sphero Connector Core](https://github.com/chrkhl/sphero-connector-core), a tiny wrapper around the [unofficial Sphero V2 API](https://github.com/igbopie/spherov2.js) for communicating with Sphero toys.
## Getting Started
Install Sphero-Connector-HTTP via [npm](https://docs.npmjs.com/cli/npm):
```bash
npm install --save sphero-connector-http
```
Add npm run script to your `package.json`:
```json
{
"scripts": {
"sphero-connector-http": "sphero-connector-http"
}
}
```
Add the following section to your `package.json`:
```json
{
"sphero-connector": {
"type": "http"
}
}
```
Finally, run `npm run sphero-connector-http` and sphero-connector-http will start its express server listening on port 3000.
## Configuration
### Port
By default, sphero-connector-http will listen on port 3000 for incoming HTTP requests.
You can change the port number (range from 3.000 to 40.000) in the `sphero-connector` section of your package.json as follows:
```json
{
"sphero-connector": {
"type": "http",
"port": 7331
}
}
```
### Connect with toy on startup
To auto-connect with a Sphero toy on start, you can specify the toy type and name in your package.json.
```json
{
"sphero-connector": {
"type": "http",
"connectOnStart": {
"toyType": "SpheroMini",
"toyName": "SM-0815"
}
}
}
```
Valid values for `toyType` are: `SpheroMini`, `LightningMcQueen`, `R2D2`, `R2Q5`, `BB9E`.
The `toyName` option is currently only supported for `toyType: "SpheroMini"`.
### API
* `POST /connect` (body: `{ type: 'SpheroMini' }, name: 'SM-0815' }`)
* `POST /wake`
* `POST /sleep`
* `POST /main-led-color/random`
* `POST /main-led-color/hex` (body: `{ color: '#ACADDB' }`)
## License
Please be aware of the licenses of the components used in this project.
Everything else that has been developed by the contributions to this project is under [MIT License](LICENSE).