For use in conjunction with
to play your favourite radio stations with just a voice command and control multiple output devices.
Examples:
- "Hey Siri, start ROCK ANTENNE"
- "Hey Siri, start [YOUR_FAVOURITE_RADIO_STATION]"
- "Hey Siri, turn on Speaker in Hallway"
- "Hey Siri, turn off [SPEAKER_NAME] in [ROOM_NAME]"
- You can use the brightness setting to control the output volume: "Hey Siri, set brightness of [SPEAKER_NAME] in [ROOM_NAME] to 70%"
This package acts like a standalone proxy server which endpoints get to be called by the homebridge-better-http-rgb plugin. The plugin is responsible for then advertising the various accessories to homebridge (see config.json). The middleware is using the amazing forked-daapd JSON API to control the various accessories and redirect their actions to forked-daapd. Therefore it is possible to advertise almost any forked-daapd action to HomeKit.
- Node.js >= v10.15.1 with npm >= v6.4.1
- forked-daapd >= v26.4 available in your local network
- homebridge >= v0.4.46 with homebridge-better-http-rgb >= v2.0.0 plugin available in your local network
- At least one output device (AirPlay, Chromecast, etc) in your local network which can be controlled by forked-daapd
- At least one playlist with an internet radio stream url in it, available in your forked-daapd library
$ mkdir forked-daapd-homebridge-middleware
$ npm init
$ npm install --save forked-daapd-homebridge-middleware
For the npm init
command answer all questions with [ENTER] key.
See configuration.
$ cd forked-daapd-homebridge-middleware
$ npx forked-daapd-homebridge-middleware
$ git clone https://github.com/moecre/forked-daapd-homebridge-middleware.git
$ cd forked-daapd-homebridge-middleware
$ npm install
See configuration.
$ cd forked-daapd-homebridge-middleware
$ npm start
In production I strongly advise you to use a process manager like PM2 to run forked-daapd-homebridge-middleware. In case anything unexpected happens the middleware is going to be restarted automatically by PM2.
By the way, that's a good solution for your Homebridge process, too.
Copy the distributed index.dist.json to index.json in the same directory and change the file according to your setup and needs.
Param | Description |
---|---|
baseUrl | URL to your forked-daapd JSON API |
Please take a look at the provided config.json for examples. In general your Homebridge
configuration file is located in ~/.homebridge/config.json
.
Please replace placeholders, eg. {NAME YOUR RADIO STATION}
for ROCK ANTENNE
. Keep in mind that the name must
be unique over all your accessories (UUID in Homebridge).
{
"accessory": "HTTP-RGB",
"name": "{NAME YOUR RADIO STATION}",
"service": "Light",
"switch": {
"status": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/playlists/{URL ENCODED NAME OF THE PLAYLIST IN FORKED-DAAPD}",
"powerOn": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/playlists/{URL ENCODED NAME OF THE PLAYLIST IN FORKED-DAAPD}/play[?shuffle=true]",
"powerOff": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/player/stop"
}
}
The /playlists/:playlist/play
endpoint has an optional parameter shuffle
. If applied all the playlist items get added to the queue shuffled.
Please replace placeholders, eg. {NAME YOUR SPEAKER}
for Hallway speaker
. Keep in mind that the name must be
unique over all your accessories (UUID in Homebridge).
{
"accessory": "HTTP-RGB",
"name": "{NAME YOUR SPEAKER}",
"service": "Light",
"switch": {
"status": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/outputs/{URL ENCODED NAME OF OUTPUT DEVICE IN FORKED-DAAPD}",
"powerOn": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/outputs/{URL ENCODED NAME OF OUTPUT DEVICE IN FORKED-DAAPD}/state/on",
"powerOff": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/outputs/{URL ENCODED NAME OF OUTPUT DEVICE IN FORKED-DAAPD}/state/off"
},
"brightness": {
"status": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/outputs/{URL ENCODED NAME OF OUTPUT DEVICE IN FORKED-DAAPD}/volume",
"url": "http://{HOSTNAME ON WHICH FORKED-DAAPD-HOMEBRIDGE-MIDDLEWARE IS RUNNING}:3000/outputs/{URL ENCODED NAME OF OUTPUT DEVICE IN FORKED-DAAPD}/volume/%s"
}
}
Please have a look here.