cjrpaterson / sonos-cron

Service for retrieving commands from an AWS SQS queue and passing them to an instance of the Sonos HTTP API (https://github.com/jishi/node-sonos-http-api)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sonos-cron

Service for retrieving commands from an AWS SQS queue and passing them to an instance of the Sonos HTTP API (https://github.com/jishi/node-sonos-http-api). Could be used, for example, to relay messages from your CI system (build passed/failed, production deploy triggered, etc.) to your office Sonos. Using an SQS queue to exchange messages means there's no need to open up your local network externally.

Usage

  1. Install dependencies with composer (composer install).
  2. Copy src/parameters.yml.dist to src/parameters.yml and add relevant values.
  3. Add a cron job to run php src/cron.php however frequently you would like messages to be processed.

Handlers

  • Handlers are registered in order to process specific API actions, e.g. say, next and volume.
  • The handler which should be called is defined by the attribute handler in the body of the SQS message.
  • Currently only the say handler is implemented.
  • Further handlers can be added by implementing the HandlerInterface, and tagging the service with name: sonos_cron.handler.

Say

The body of a message which should be handled as a say action is:

{
  "handler": "say",
  "payload": {
    "room": "Living Room",
    "message": "Hi, this will be read out by the Sonos",
    "language": "en-gb"
  }
}

About

Service for retrieving commands from an AWS SQS queue and passing them to an instance of the Sonos HTTP API (https://github.com/jishi/node-sonos-http-api)


Languages

Language:PHP 100.0%