Resolve SIM-547 "Merge refactored subarray"
Closes SIM-547
I was planning to add an extra layer so that the structure would be device -> workflows -> database. However I am now starting to doubt the value of doing so, especially if a workflows library is on the way. There is probably benefit in merging asap for the real-time reporting. The subarray class still seems too big and further refactoring could be revisited later.