Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pimatic-sonos with all npm packages installed. Try it out:

require("pimatic/package.json"); // pimatic is a peer dependency. var pimaticSonos = require("pimatic-sonos")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pimatic-sonos v0.1.1

Sonos Plugin for the pimatic home automation framework

npm version


##Important This plugin is still under development, please remain calm.. :sunglasses:

pimatic plugin for controlling the Sonos Music Player.

###device config example:

  "id": "sonos-player",
  "name": "Living room",
  "class": "SonosPlayer",
  "host": "",
  "port": 1400

###device rules examples:

Play music
if smartphone is present then play sonos-player

Pause music
if smartphone is absent then pause sonos-player

Change volume
if buttonVolumeLow is pressed then change volume of sonos-player to 5

Next song
if buttonNext is pressed then play next song Music

Previous song
if buttonPrev is pressed then play previous song Music

Currently no predicates for the sonos plugin. If you would like to do something when the state changes u could use the attribute predicate.
if $sonos-player.state equals "play" then switch speakers on
if $sonos-player.state equals "pause" then switch speakers off
if $sonos-player.currentArtist equals "rick astley" then switch speakers off
if $sonos-player.currentTitle equals "coco jambo" then change volume of sonos-player to 20

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free