I’m trying to create a SmartApp to act as a “Service Manager” for a LAN device. The device does not support SSDP, so I want to just allow the user to manually enter the IP:port for the device, then add the device using addChildDevice. Unfortunately, this doesn’t seem to work, but I could just be passing bad arguments to addChildDevice. I can’t find documentation on it anywhere. Below is a snippet of my code which will currently get this error:
groovy.lang.MissingMethodException: No signature of method: physicalgraph.device.HubService.get() is applicable for argument types: (physicalgraph.app.HubWrapper) values: [physicalgraph.app.HubWrapper@17d2a4b6]
Possible solutions: get(java.lang.String), grep(), getAt(java.lang.String), grep(java.lang.Object), wait(), any() @ line 57
Please let me know if you see anything wrong. Thanks!
definition(
name: "MacThing Setup",
namespace: "com.obycode",
author: "ObyCode",
description: "Use this app to connect your device to SmartThings",
category: "Fun & Social",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
preferences {
section("Setup my device with this IP:port (click the icon in the status bar to find this):") {
input "theAddr", "string", multiple: false, required: true
}
section("on this hub...") {
input "theHub", "hub", multiple: false, required: true
}
section("and give it this name...") {
input "theName", "string", multiple: false, required: true
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
log.debug "name is $theName, addr is $theAddr, hub is $theHub"
def parts = theAddr.split(":")
def iphex = convertIPtoHex(parts[0])
def porthex = convertPortToHex(parts[1])
def dni = "$iphex:$porthex"
d = addChildDevice("com.obycode", "myDevice", dni, theHub, [label:"$theName", name:"$theName", completedSetup: true])
log.trace "created ${d.displayName} with id $dni"
}
private String convertIPtoHex(ipAddress) {
String hex = ipAddress.tokenize( '.' ).collect { String.format( '%02x', it.toInteger() ) }.join()
log.debug "IP address entered is $ipAddress and the converted hex code is $hex"
return hex
}
private String convertPortToHex(port) {
String hexport = port.toString().format( '%04x', port.toInteger() )
log.debug hexport
return hexport
}