I know absolutely nothing about programming, so bear that in mind when considering using these, but I managed to add 2 more players. I had to change the Smart app and squeezeSwitch code:
First the squeezeSwitch:
/**
*/
//player mac adddresses, for each required player
preferences {
input(“confp1”, “string”, title:“Enter Player 1 MAC”,defaultValue:“00:00:00:00:00:00”, required:true, displayDuringSetup:true)
input(“confp2”, “string”, title:“Enter Player 2 MAC”,defaultValue:“00:00:00:00:00:00”, required:true, displayDuringSetup:true)
input(“confp3”, “string”, title:“Enter Player 3 MAC”,defaultValue:“00:00:00:00:00:00”, required:true, displayDuringSetup:true)
input(“confp4”, “string”, title:“Enter Player 4 MAC”,defaultValue:“00:00:00:00:00:00”, required:true, displayDuringSetup:true)
input(“confp5”, “string”, title:“Enter Player 5 MAC”,defaultValue:“00:00:00:00:00:00”, required:true, displayDuringSetup:true)
}
metadata {
definition (name: “squeezeSwitch”, namespace: “mmaxwell”, author: “Mike Maxwell”) {
capability “Switch”
//custom commands for multiple players
//use the standard (built in on/off) if you only have one player
command "p1On"
command "p1Off"
command "p2On"
command "p2Off"
command "p3On"
command "p3Off"
command "p4On"
command "p4Off"
command "p5On"
command “p5Off”
//enable and use to create the hex version of your squeeze servers CLI interface
//ip address and port, this will need to be assigned to the “Device Network Id” field
//after the device is added to your system
//command “getNid”
}
simulator {
// TODO: define status and reply messages here
}
tiles {
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
}
}
main "switch"
details(["switch"])
}
// parse events into attributes
def parse(String description) {
log.debug “Parsing ‘${description}’”
}
private String makeNetworkId(ipaddr, port) {
String hexIp = ipaddr.tokenize(’.’).collect {
String.format(’%02X’, it.toInteger())
}.join()
String hexPort = String.format(’%04X’, port())
return “${hexIp}:${hexPort}”
}
def getNID() {
log.debug makeNetworkId(“192.168.0.9”, 9090) //your squeeze server CLI interface ip address and port
}
// handle commands for multiple players
def p1On() {
//log.debug settings.confp1
def ha = new physicalgraph.device.HubAction("${settings.confp1} play\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p1Off() {
//log.debug settings.confp1
def ha = new physicalgraph.device.HubAction("${settings.confp1} power 0\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p2On() {
//log.debug settings.confp2
def ha = new physicalgraph.device.HubAction("${settings.confp2} play\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p2Off() {
//log.debug settings.confp2
def ha = new physicalgraph.device.HubAction("${settings.confp2} power 0\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p3On() {
//log.debug settings.confp3
def ha = new physicalgraph.device.HubAction("${settings.confp3} play\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p3Off() {
//log.debug settings.confp3
def ha = new physicalgraph.device.HubAction("${settings.confp3} power 0\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p4On() {
//log.debug settings.confp3
def ha = new physicalgraph.device.HubAction("${settings.confp4} play\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p4Off() {
//log.debug settings.confp3
def ha = new physicalgraph.device.HubAction("${settings.confp4} power 0\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p5On() {
//log.debug settings.confp3
def ha = new physicalgraph.device.HubAction("${settings.confp5} play\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def p5Off() {
//log.debug settings.confp3
def ha = new physicalgraph.device.HubAction("${settings.confp5} power 0\r\n\r\n",physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
// command for one player only
def on() {
//log.debug “Executing ‘on’“
def ha = new physicalgraph.device.HubAction(”${settings.confp1} play\r\n\r\n”,physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
def off() {
//log.debug “Executing ‘off’“
def ha = new physicalgraph.device.HubAction(”${settings.confp1} power 0\r\n\r\n”,physicalgraph.device.Protocol.LAN, “${device.deviceNetworkId}”)
return ha
}
And the app:
/**
*/
definition(
name: “squeezeController”,
namespace: “mmaxwell”,
author: “Mike Maxwell”,
description: “SqueezeBox virtual supervisor.”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)
/**
-
VirtualSwitchParent
-
-
Author: badgermanus@gmail.com
-
Date: 2014-03-26
*/
preferences {
section(“Connect these virtual switches to the squeeze players”) {
input “switch1”, title: “Study”, “capability.switch”, required: true
input “switch2”, title: “Kitchen”, “capability.switch”, required: true
input “switch3”, title: “Dining Area”, “capability.switch”, required: true
input “switch4”, title: “Master Bedroom”, “capability.switch”, required: true
input “switch5”, title: “Bar”, “capability.switch”, required: true
}
section(“Which squeeze server?”) {
input “squeeze”, “capability.switch”
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
subscribe()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
subscribe()
}
def subscribe() {
subscribe(switch1, “switch.on”, p1On)
subscribe(switch1, “switch.off”, p1Off)
subscribe(switch2, “switch.on”, p2On)
subscribe(switch2, “switch.off”, p2Off)
subscribe(switch3, “switch.on”, p3On)
subscribe(switch3, “switch.off”, p3Off)
subscribe(switch4, “switch.on”, p4On)
subscribe(switch4, “switch.off”, p4Off)
subscribe(switch5, “switch.on”, p5On)
subscribe(switch5, “switch.off”, p5Off)
}
def p1On(evt)
{
log.debug "switchOn1($evt.name: $evt.value: $evt.deviceId)"
squeeze.p1On()
}
def p1Off(evt)
{
log.debug "switchOff1($evt.name: $evt.value: $evt.deviceId)"
squeeze.p1Off()
}
def p2On(evt)
{
log.debug "switchOn2($evt.name: $evt.value: $evt.deviceId)"
squeeze.p2On()
}
def p2Off(evt)
{
log.debug "switchOff2($evt.name: $evt.value: $evt.deviceId)"
squeeze.p2Off()
}
def p3On(evt)
{
log.debug "switchOn3($evt.name: $evt.value: $evt.deviceId)"
squeeze.p3On()
}
def p3Off(evt)
{
log.debug "switchOff3($evt.name: $evt.value: $evt.deviceId)"
squeeze.p3Off()
}
def p4On(evt)
{
log.debug "switchOn4($evt.name: $evt.value: $evt.deviceId)"
squeeze.p4On()
}
def p4Off(evt)
{
log.debug "switchOff4($evt.name: $evt.value: $evt.deviceId)"
squeeze.p4Off()
}
def p5On(evt)
{
log.debug "switchOn4($evt.name: $evt.value: $evt.deviceId)"
squeeze.p5On()
}
def p5Off(evt)
{
log.debug "switchOff5($evt.name: $evt.value: $evt.deviceId)"
squeeze.p5Off()
}
Hmmm, can’t figure out how one is supposed to post code like this.