I know not to mix these in the same app but can I have an app using state and a child app using atomicState ?
As a bit of background I have a device driver that discovers devices over the network, this discovery takes a while (maybe a minute) and devices are returned individually. I'm trying to build an array that I can present to the user to select devices to add. But from experience it seems I will have to use atomicState otherwise my array is incomplete, but device drivers don't support atomicState so I am passing each device back using events to my app.
I then tried using atomic state in my app but it appears then I cant add an atomicState array variable for options to the 'enum' in an input.
input "MQTTSwitches", "enum", multiple: true, title: "Discovered MQTT switches", options: atomicState.MQTTSwitchDevices Cannot get property 'MQTTSwitchDevices' on null object on line 23
It errors during compile/save. So my only workaround seems to be build the array in a child app using atomicState and then pass the complete array back to the main app using state to then use as the options in an enum input ?
Or am I just approaching this all wrong ?
Is there another example device driver that does this anywhere I can look at ?
I'm new to Groovy/HE coding and the lack of scoped vars is weird.