OK, here is what you asked for. For testing purposes I created a device handler named Test Child DH which does nothing but call the parent,childon(dni) method. I put in lots of debugging statements so that you can see what is happening. Then I created both a device handler named Test Parent DH and a device named TestParent which uses this device handler. The device does nothing more than create the child and provide some debug messages. In particular, the parent method childon(dni) throws a trace message that it has been reached. These were published to me and showed up in the Smartthings phone app.
I set the IDE to Live Logging, and triggered the TestChild on the phone app. Tthe debug statements verified that the parent was indeed the TestParent, that the dni was correct and the parent.childon(dni) was called. However, the Live Debugging also revealed that the TestParent’s childon(dni) method was NOT invoked. This is the failure I have been describing.
Hopefully I simply missed a step. The two device handlers are listed below as you had requested.
Parent device handler:
/**
*/
metadata {
definition (name: “Test Parent DH”, namespace: “rlmillerx”, author: “RALPH MILLER”) {
capability "Switch"
capability "Sensor"
capability “Actuator”
}
}
preferences {
command "childon", ["string"]
command "childoff", ["string"]
}
simulator {
}
tiles (scale: 2) {
standardTile("thermPresence", "device.switch", inactiveLabel: false, width: 3, height: 3) { //, decoration: "flat"
state "on", label:'Home', action:'off', backgroundColor: "#44b621", icon: "st.Home.home2", nextState:"Updating"
state "off", label:'Away', action:'on', backgroundColor: "#ADD8E6", icon: "st.Home.home2", nextState:"Updating"
state "Updating", label:"Updating", backgroundColor: "#ffffff", icon: "st.secondary.secondary" //, defaultState: true
}
}
def installed() {
initialize()
}
def updated() {
initialize()
}
def initialize() {
// create child switch
// first check if child device is already installed
def childDevices = getChildDevices()
log.debug "${childDevices}"
log.debug "${childDevices.size()}"
if (childDevices.size() == 0) {
log.trace "Creating Child"
try {
addChildDevice(“Test Child DH”,“testchild”,null, [completedSetup: true, label: “TestChild”, isCompenent: false, componentLabel: “TestChild”])
} catch(Exception e) {
log.debug “${e}”}
log.trace “Child created”
}
}
// handle commands
def parse(String description) {
log.debug “parse: description = ${description}”
}
def on() {
log.trace "on command received"
sendEvent(name: “switch”, value: “on”)
}
def off() {
log.trace "off command received"
sendEvent(name: “switch”, value: “off”)
}
// Test child integration
void childon(x){
log.debug “On command from ${x}”
}
void childoff(x){
log.debug “Off command from ${x}”
}
Child device handler:
/**
*/
metadata {
definition (name: “Test Child DH”, namespace: “rlmillerx”, author: “Ralph Miller”) {
capability "Switch"
capability "Actuator"
capability "Sensor"
capability “Refresh”
}
tiles {
standardTile("controller", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff", nextState:"on"
state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00A0DC", nextState:"off"
}
}
}
void on() {
log.trace "Child was turned on"
try {
log.debug " Parent is ${parent.name}"
log.debug "Device ID is ${device.deviceNetworkId}"
parent.childOn(device.deviceNetworkId)
log.debug “parent.childOn was just called”
} catch(Exception ex) {
log.debug “Exception ${ex}”
}
}
void off() {
log.trace "Child was turned off"
try {
log.debug "Parent is ${parent.name}"
log.debug "Device ID is ${device.deviceNetworkId}"
parent.childOn(device.deviceNetworkId)
log.debug “parent.childOn was just called”
} catch(Exception ex) {
log.debug “Exception ${ex}”
}
}