Skip to content

Commit

Permalink
First commit of the HomeySqueezebox app. Alpha state but the function…
Browse files Browse the repository at this point in the history
…ality that is present should work!
  • Loading branch information
Mark Tudor committed Aug 25, 2016
1 parent 809c037 commit 57a556a
Show file tree
Hide file tree
Showing 538 changed files with 70,847 additions and 1 deletion.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,43 @@
# HomeySqueezebox
#HomeySqueezebox
Control your Logitech Squeezebox server and devices with your Athom Homey!

##Getting Started

###Configure the App
Install the app and then add the correct server address and port in `Settings > Squeezebox`. Usually, leaving the
Server Port at the default 9000 is fine. The Server Address should be specified as the address of the Logitech Media
Server, including the "http://" part. A name or ip address can be used:

```
Server Address: http://squeezebox.mydomain.co.uk
Server Address: http://squeezebox
Server Address: http://192.168.0.1
```

**WARNING**: If you do not specify a server address, the app will always fail when searching for Squeezeboxes with the
message "There were no new devices found!". If you specify the wrong server address, or if the server is not reachable,
the app will search for new Squeezeboxes forever, finding nothing!

###Add your Squeezeboxes
As with all devices in Homey, you should add your Squeezeboxes on the **Zones and Devices** page. Just click the **+** in the
appropriate room and choose *Squeezebox* from the device type window. You can then pick any of the Squeezeboxes that are
registered with your Logitech Media Server.

##App Status
This is an **alpha** release. A lot of people are waiting on the app but unfortunately I do not have time to implement
everything just yet due to personal commitments. I want people to get benefit as early as possible, so here it is in an
early form. There is a _lot_ more that I would like to add. Once I have more time (post 19th September) I will aim to do this.

##Feature Requests
If there is anything you would really like to have sooner rather than later then please raise an issue in the GitHub
repository so that we can track it and others can *+1* their favourites. I will add a few features myself in the next
few weeks so that you can see what I have in mind.

##App Store Ratings
I'd ask you to either rate the app based on the features that are present (not what is missing) or withhold your ratings
until we're out of alpha. Bad ratings now probably won't help when the app does eventually come out of alpha! Having
said that, hopefully you won't find anything to rate badly as what's there should work reasonably well.

##Help
If you need any assistance then please feel free to drop me a message on Slack (in the athom community) or via Twitter
@marktudor. I'll be happy to help!
99 changes: 99 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"use strict";

module.exports.init = function () {
Homey.manager('flow').on('action.play', function (callback, args) {
Homey.manager('drivers').getDriver('squeezebox').capabilities.play.set(
args.device,
true,
function (err, success) {
// Notify Homey of success of failure, respectively.
if (typeof callback == 'function') {
callback(null, !err && success);
};
}
);
});

Homey.manager('flow').on('action.pause', function (callback, args) {
Homey.manager('drivers').getDriver('squeezebox').capabilities.pause.set(
args.device,
true,
function (err, success) {
// Notify Homey of success of failure, respectively.
if (typeof callback == 'function') {
callback(null, !err && success);
};
}
);
});

Homey.manager('flow').on('action.volume', function (callback, args) {
Homey.manager('drivers').getDriver('squeezebox').capabilities.volume.set(
args.device,
args.volume,
function (err, success) {
// Notify Homey of success of failure, respectively.
if (typeof callback == 'function') {
callback(null, !err && success);
};
}
);
});

Homey.manager('flow').on('action.playPlaylist', function (callback, args) {
var SqueezeServer = require('squeezenode');
var mySqueezeServer = new SqueezeServer(
Homey.manager('settings').get('serverAddress'),
Homey.manager('settings').get('serverPort')
);

mySqueezeServer.on('register', function () {
mySqueezeServer.request(
args.device.id,
["playlistcontrol", "cmd:load", "playlist_id:" + args.playlist.id],
function (reply) {
// TODO: Detect failures.
if (typeof callback == 'function') {
callback(null, true);
}
}
);
});
});

Homey.manager('flow').on('action.playPlaylist.playlist.autocomplete', function (callback, args) {
var SqueezeServer = require('squeezenode');
var mySqueezeServer = new SqueezeServer(
Homey.manager('settings').get('serverAddress'),
Homey.manager('settings').get('serverPort')
);

mySqueezeServer.on('register', function () {
var searchParams = ["playlists", 0, 10];
if (args.query != '') {
searchParams.push('search:' + args.query);
}

mySqueezeServer.request(
args.device.id,
searchParams,
function (reply) {
var playlists = [];

if (reply.result.count > 0) {
playlists = reply.result.playlists_loop.map(function (item) {
return {
id: item.id,
name: item.playlist
};
});
}
// TODO: Detect failures.
if (typeof callback == 'function') {
callback(null, playlists);
}
}
);
});
});
};
140 changes: 140 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"id": "uk.co.icefusion.squeezebox",
"name": {
"en": "Squeezebox"
},
"description": {
"en": "Allows control of Squeezeboxes connected to a Logitech Media Server."
},
"author": {
"name": "Mark Tudor",
"email": "[email protected]"
},
"category": "music",
"images": {
"large": "./assets/images/large.jpg",
"small": "./assets/images/small.jpg"
},
"version": "0.0.1",
"compatibility": ">=0.9.2",
"permissions": [],
"dependencies": {
"squeezenode": "*"
},
"drivers": [
{
"id": "squeezebox",
"name": {
"en": "Squeezebox"
},
"images": {
"large": "./drivers/squeezebox/assets/images/large.jpg",
"small": "./drivers/squeezebox/assets/images/small.jpg"
},
"class": "other",
"capabilities": [
"onoff",
"volume_set"
],
"pair": [
{
"id": "list_my_devices",
"template": "list_devices",
"navigation": {
"next": "add_my_devices"
}
},
{
"id": "add_my_devices",
"template": "add_devices"
}
]
}
],
"flow": {
"triggers": [
],
"actions": [
{
"id": "volume",
"title": {
"en": "Volume"
},
"args": [
{
"name": "device",
"type": "device",
"placeholder": {
"en": "Which Squeezebox?"
},
"filter": "driver_uri=homey:app:uk.co.icefusion.squeezebox&driver_id=squeezebox"
}, {
"name": "volume",
"type": "range",
"min": 0,
"max": 100,
"step": 1,
"label": "%",
"placeholder": {
"en": "0 - 100%"
}
}
]
},
{
"id": "play",
"title": {
"en": "Play"
},
"args": [
{
"name": "device",
"type": "device",
"placeholder": {
"en": "Which Squeezebox?"
},
"filter": "driver_uri=homey:app:uk.co.icefusion.squeezebox&driver_id=squeezebox"
}
]
},
{
"id": "playPlaylist",
"title": {
"en": "Play Playlist"
},
"args": [
{
"name": "device",
"type": "device",
"placeholder": {
"en": "Which Squeezebox?"
},
"filter": "driver_uri=homey:app:uk.co.icefusion.squeezebox&driver_id=squeezebox"
}, {
"name": "playlist",
"type": "autocomplete",
"placeholder": {
"en": "Which playlist?"
}
}
]
},
{
"id": "pause",
"title": {
"en": "Pause"
},
"args": [
{
"name": "device",
"type": "device",
"placeholder": {
"en": "Which Squeezebox?"
},
"filter": "driver_uri=homey:app:uk.co.icefusion.squeezebox&driver_id=squeezebox"
}
]
}
]
}
}
Loading

0 comments on commit 57a556a

Please sign in to comment.