I have a custom app. A preference is set for multiple devices. If several devices are selected they are put into an array. I know, or it appears so, that the device position in the array doesn't follow any particular order.
Question, will the array position always remain constant as long as I don't change any entries in the preference?
Also, can a state variable be an array? ie state.item[...].
While the above is certainly true (look who answered!), the fact that you're asking about order makes me nervous. Is there a reason you need to rely on that? If you need to match something for a device up with itself somehow, even if the collection changes, I'd use the device ID (or maybe something else that makes senses for your application).
I was monitoring some motion detectors to make sure they are seeing some activity, mainly cause some of them don't report battery correctly. I currently just create a separte routine to monitor each one. But everytime I add one I have to create a new routine. Was just trying to make it easier by storing a state, true or false, and then once every few days do a check. Thought it would be easier to iterate thru them rather than create a new routine every time.