npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

forked-daapd-homebridge-middleware

v1.2.4

Published

A middleware for provisioning common use cases of forked-daapd's HTTP API to homebridge

Downloads

41

Readme

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%"

Hallway Kitchen Volume control

Overview

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.

Prerequisites

  • 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

Installation and execution

Option 1: Installing as npm dependency

$ 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.

Configuration

See configuration.

Run as npm dependency

$ cd forked-daapd-homebridge-middleware
$ npx forked-daapd-homebridge-middleware

Option 2: Installing as separate project

$ git clone https://github.com/moecre/forked-daapd-homebridge-middleware.git
$ cd forked-daapd-homebridge-middleware
$ npm install

Configuration

See configuration.

Run as separate project

$ cd forked-daapd-homebridge-middleware
$ npm start

Running with PM2

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.

PM2 status

By the way, that's a good solution for your Homebridge process, too.

Configuration

Create forked-daapd-homebridge-middleware configuration file

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 |

Adding your accessories to Homebridge

Please take a look at the provided config.json for examples. In general your Homebridge configuration file is located in ~/.homebridge/config.json.

Radio station

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.

Speaker (output device)

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"
  }
}

How to create playlists in your forked-daapd server

Please have a look here.