Bug in Parent Child Devices

Yes I did but these are 2 different things. This is taking about sharing the State/AtomicState variables - which isn’t what I’m trying to do.

I expect the State variable to be valid in the context of the Smartapp. I.e. I can access that variable anywhere in the SmartApp. In this case when the SmartApp is called the State variable always starts with null

If you have a child parent just try this, in your SmartApp method called by the child try this:
Device Handler (inside your refresh() command)

callAppMethod(this)

Also define this in your Device Handler to help see what’s going on

 def log(message) {
    log.trace message
}

SmartApp

def callAppMethod(child) {
    child.log "BEFORE State: $state.testVar"
    if (state.testVar == null) {
        child.log "EMTPTY!!"
        state.testVar = []
    }
    state.testVar << ["testing", "testing2"]
    child.log "AFTER State: $state.testVar"
}

Try it out and see what happens. Call it a few times and the state.testVar should keep increasing in size but you’ll see it’s ALWAYS empty.