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

homebridge-sonos-starter-track

v1.0.19

Published

Sonos plugin for homebridge: https://github.com/nfarina/homebridge that starts presets via https://github.com/jishi/node-sonos-http-api. This fork also looks to see what track is playing and reports as and when the playing track matches with the URI speci

Downloads

7

Readme

homebridge-sonos-starter-track

verified-by-homebridge

Homebridge Accessory to start presets via node-sonos-http-api.

Version 1.0.19 Update

We've been verified! How cool is that! - now have the right to display the verified-by-Homebridge badge! Oh, and for some stupid reason, I'd got my version numbers wrong in the ReadMe and ChangeLog (10. instead of 1.) - which has been corrected - Doh!

Previous versions listed in CHANGELOG.md

Use-case

Automate regular playback in Homekit e.g. start a favourite playlist or radio / streaming service in a specific room at a specific volume with Siri.

planetWayne - Track variation

This modified version takes the idea of using the TrackURI to see if the Sonos is actually playing a track that you have optionally defined in a preset. The idea being that if you have multiple of these devices set up, they all appear as switches, you want to know if a particular 'switch' is on / playing. For use when you are streaming radio channels and may have multiple set up.

What I was finding is if I had multiple 'presets' defined with different streaming channels, each time you switched to another preset you ended up with a row of 'on' switches and no way of knowing what was actually playing. Then if you turned one off, they would all go off. This version looks at the TrackURI setting and comparers that to your config, and only reporting as being 'on' if the track matched. It will also 'turn off' the other switches in Homekit.

To get the URI for your config, either to configure the preset in 'Node-Sonos-HTTP-API' and then to match in your Homebridge config.json, load up your desired streaming channel, get it playing, then use the /state URL with '..HTTP-API' and look for the section 'TrackUri' and copy its data. Paste that into your Config.json file.

NOTE: This is functionally the same as the original work done by Dirk Winkler and is pretty much a drop in replacement, the only thing to note is the accessory name needs to be changed to use this version. If you already have a comprehensive setup then you can keep that config and not worry about a value for the TrackURI for it to work in the same way, just update the accessory name.

At this point - there is no NPM - haven't figured that out yet!! Yes there is now!

Prerequisites

Homebridge and node-sonos-http-api are installed.

Installation

Install via Homebridge Config UI X

  1. Search for Sonos Starter Track on the Plug-ins tab of Homebridge Config UI.
  2. Install the Homebridge Sonos Starter Track plug-in and use the form to set up your configuration.

Manual Installation

Clone this repository, change into that folder and execute the following

npm install
npm link

Or directly from NPM

sudo npm -g install homebridge-sonos-starter-track

Configuration

Add accessory to ~/.homebridge/config.json of Homebridge like this:

...
"accessories": [
    ...
    {
        "accessory": "SonosStarterTrack",
        "name": "Kitchen BBC Radio 2",
        "apiBaseUrl": "http://localhost:5005",
        "preset": "Kitchen-Radio2"
        "trackURI": "x-sonosapi-stream:...{GetDetails from sonosapi/state}"
        "onPauseWhat": ["Kitchen","Bedroom","Lounge"]
    },
    ...

You can have multiple accessories with different presets, just duplicate the accessory section and change the name, preset, trackURI and onPauseWhat accordingly.

  • accessory needs to be SonosStarterTrack
  • name is the name that HomeKit will use
  • apiBaseUrl is the base URL where node-sonos-http-api lives
  • preset is the node-sonos-http-api - preset that should be started
  • trackURI Optional this is the 'trackUri' taken from the /stats page of node-sonos-http-api - this is used to see if a particular track or stream is playing. The idea being that you can have visualisation within HomeKit that the track you have in your 'preset' is indeed the track playing.
  • onPauseWhat Optional This is an array / list of Zones that you want to pause when a device gets turned 'off'. The idea being that now you can pause specific players / Zones instead of pausing your whole Sonos system. At present - ~~due to lack of understanding on may part, there is a bug where it doesnt work if there is more than one entry in the array, but instead of scrapping the whole thing, you can pause ONE zone or player.~~ Hopefully that bug is now fixed in v1.0.15 but I have no way to test it! - feedback Welcomed

Finally

Restart Homebridge and that's it. Original DW version Tested with node 6 on a ras-pi, this version also running with Homebridge on OSX