I am trying to add a child device using a SmartApp, but everytime I execute the line I get
12:49:09 PM:
error
org.springframework.security.access.AccessDeniedException: Access is denied @ line 67
Here’s the code from the SmartApp,
def initialize() {
// nothing needed here, since the child apps will handle preferences/subscriptions
// this just logs some messages for demo/information purposes
log.debug "there are ${childApps.size()} child smartapps"
childApps.each {child ->
// this is where we will create teh child devices
log.debug "child app: ${child.label}"
log.debug "zone: ${child.zoneNumber} / name: ${child.zoneName} / hub: ${child.wifiHub} / hubId: ${child.wifiHub.deviceNetworkId} / Hub: ${child.wifiHub.hub.name}"
// stopped here, come up with a standard device name..
def deviceName = "${child.wifiHub.deviceNetworkId}/${child.zoneName}"
log.debug(deviceName)
def d = getChildDevice(deviceName)
if(!d) {
log.debug "not d : ${d}"
d = addChildDevice("cloudsyjared", "MiLight Controller", deviceName, child.wifiHub.id, ["label":"${child.zoneName}", "name": "MiLight/${child.zoneName}"])
log.debug "after add child"
//subscribeAll() //helper method to update devices
}
}
}
What am I doing wrong here? The documentation says that the HubId can be null, but I find that when it is null, I get a string error.
groovy.lang.MissingPropertyException: No such property: data for class: java.lang.String @ line 90
If I set HubId to my hub
def hub = location.hubs[1]
log.debug “id: ${hub.id} / ${hub.name}”
I get:
d5bbb7af-c9a8-4942-add1-4ac853d32c09
1:09:47 PM:
error
groovy.lang.MissingMethodException: No signature of
method: physicalgraph.device.HubService.get() is applicable for argument
types: (physicalgraph.app.HubWrapper) values:
[physicalgraph.app.HubWrapper@1fa63828]