So I have been pouring over the sonos connect smart app as well as the hue connect app in hopes of creating a LIFX bulb device type and even a smart app that works the same as those two connect apps. I have a smart app started that talks to the lifx-http SDK found here (running on a local server) that finds my lights and tries to create new devices but they don’t create.
I then thought well maybe the device type needs to exist so I created a simple one for testing that would turn on or off my lights. however when I send the off command via this command in the device type code:
sendHubCommand(new physicalgraph.device.HubAction("""GET /lights/label:${encodedName}/off?_method=put HTTP/1.1\r\nHOST: $ip\r\n\r\n""", physicalgraph.device.Protocol.LAN, "${deviceNetworkId}"))
i get an error:
No signature of method: script13961045224712093808485.sendHubCommand() is applicable for argument types: (physicalgraph.device.HubAction) values: [GET /lights/label:Living%20Room%20Couch/off?_method=put HTTP/1.1 HOST: 10.0.1.161:56780
My assumption is that the hub action does not work in a device type which doesn’t make sense as sonos as far as I know can only be controlled when you are on the same wifi network. I would assume that ST is using similar code that they have in the connect and control apps but It appears that the sonos device type is some secret hidden device within smart things. as the code to create the sonos in its control appears to be this:
def addSonos() {
def players = getVerifiedSonosPlayer()
selectedSonos.each { dni ->
def d = getChildDevice(dni)
if(!d) {
def newPlayer = players.find { (it.value.ip + ":" + it.value.port) == dni }
log.debug "newPlayer = $newPlayer"
log.debug "dni = $dni"
d = addChildDevice("smartthings", "Sonos Player", dni, newPlayer?.value.hub, ["label":newPlayer?.value.name])
log.debug "created ${d.displayName} with id $dni"
d.setModel(newPlayer?.value.model)
log.debug "setModel to ${newPlayer?.value.model}"
subscribeAll() //run once to update devices
} else {
log.debug "found ${d.displayName} with id $dni already exists"
}
}
}
How does one control something over the local LAN from a device type? Is it possible?