atomicState between app and device

Hello, I seem to be having an issue trying to share a list string between a app and device code. Does atomicState when set in a app have the same data space as the device code to read it? If not what solution is hub wide I can pass a string list from app to device?

There are a few options depending on what you’re trying to accomplish and how the relationship between the device and app will be. Can you give us a little more information to those aspects?

So I am creating a app parent\child to maintain a list of devices to provision and query. I need to send the list to the device manager parent in device code space.

atomicState, however it comes up null in the device parent. Do I need to sync the atomicState? Is there some type of initiation I need to do before the device to use the atomicState variable? Or is this impossible to do.

Thanks

APP PARENT

def pollChildAppsAtomic() {
atomicState.grouppinglist = ""
log.info "GROUPPINGMANAGER: There are ${childApps.size()} child apps"
childApps.each {child ->
myDeviceName = "${child.label}"
myDeviceComment = "${child.DeviceComment}"
myDeviceIP = "${child.DeviceIP}"
myHealthSwitch = "${child.HealthSwitch}"
//log.info "GROUPPINGMANAGER: ${myDeviceName} is ${myDeviceIP} ${myHealthSwitch} ${myDeviceComment}"
atomicState.grouppinglist += "${myDeviceName},${myDeviceIP},${myHealthSwitch},${myDeviceComment}:"
}
atomicState.grouppinglist += "END"
log.info "GROUPPINGMANAGER: grouppinglist is ${atomicState.grouppinglist}"
}

DEVICE PARENT

def pollPing() {
log.info "GROUPPING grouppinglist is ${atomicState.grouppinglist}"
}

Devices only have state, not atomicState (apps can use either, but you should stick to only one in a particular app -- nevermind, that part was apparently only a SmartThings constraint, though you'd still need to be aware of how they are different). However, you also can't access state (or atomicState) outside of the particular app or driver in which it was declared, at least not directly (you could create a method to return whatever value you're looking for and call that from a parent/child app or device). It's not clear how your "app parent" and "device parent" code snippets above relate to each other, but it looks like one or both of these things might account for what you see.

If they have a parent-child relationship the child may be able to access the parent using parent.state.grouppingList likewise the parent may be able to access the child using child.state.grouppingList or using a handle to the device, i.e. deviceHandle.state.grouppingList or deviceHandle.currentValue(“attributeName”) where the handle is returned using getChildDevice or as the result of an input select .