In a child app the following atomicState is set as follows
atomicState.field = ‘12345678’
Then in the parent at a later time I want to get the atomicState.field value, it shows the atomicState object but when I try using it, a null error is thrown.
.
def childapps=findAllChildAppsByName(‘SHM Delay Child’)
childapps.each
{
log.debug "$it.simkeypad $it?.atomicState.field
// def obj=it?.atomicState.field
// obj.properties.each { k,v -> log.debug “$k $v”}
}
This
log.debug “$it.simkeypad $it?.atomicState.field”
generates this in live logging
pckeypad physicalgraph.app.InstalledSmartAppWrapper@6b34869?.atomicState.field
log.debug “$it.simkeypad ${it?.atomicState.field}”
generates an error
error java.lang.NullPointerException: Cannot get property ‘field’ on null object @line -1 (doCall)
Anyone know how to get the value of the child’s atomicState.field in a parent app?
AFAIK that when a parent app calls a child device handler the return value cannot be relied upon as the ST design.
Jim does this hold true to parent/child apps also or can parent/child apps return values from methods reliably? If so is there is any restrictions on the return type?
The child app is a SmartApp, not a DTH, and it’s been reliably working as described in my earlier post. I have read about the restriction with atomicState in a DTH
@RBoy is right, when you call get childDevices or childApps it isn’t the SmartApp / Device Handler but instead a InstalledSmartApp / Device that has a subset of the functionality exposed.