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.
- Install dependencies with composer (
composer install
). - Copy
src/parameters.yml.dist
tosrc/parameters.yml
and add relevant values. - Add a cron job to run
php src/cron.php
however frequently you would like messages to be processed.
- Handlers are registered in order to process specific API actions, e.g.
say
,next
andvolume
. - 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 withname: sonos_cron.handler
.
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"
}
}
language
should be made up of an ISO 639-1 language code and ISO 3166-1 alpha-2 country code, concatenated with a hyphen. E.g.en-gb
,fr-fr
,zh-cn
.room
is the name of the Sonos device you wish to target, as it is named in the Sonos controller app.