Current code served its purpose to get software off the ground but it is time for a refactor.
Considerations
code is difficult to understand
saving entire state every 10 minutes is not memory efficient -- just save deltas -- can generate timeseries data in view function for charts
abstraction to average all sensor variables of same type is overly simplistic -- should be more explicit about location and sensor type
Expansion on point 3
by location: e.g. air temperature top != air temperature bottom -- should there be coordinates?
when will we ever have multiple air temperature sensors at the same location outside of a test environment? (no -- hack for testing 2 sensors at same position can be just to set them at diff locations)
will likely want a coordinate system when we get to tracking individual cultivars (e.g. cultivar sites)
how to structure coordinate system (center is at center of the light? bottom left corner of cultivation area? what about a reservoir?)
this breaks down quickly.....maybe orient around volumes?....sensor at a specific point but sensing a volume? how does this work for air, light, water reservoir, or soil?
what if doing SWC and the raft is moving up and down?
what if light can move up and down?
is there a simple / flexible framework for speaking intelligently and accurately about this?
Current code served its purpose to get software off the ground but it is time for a refactor.
Considerations
Expansion on point 3