Closed guidosch closed 2 years ago
It does not bother me if we leave the function like it is. Its just a personal preference that it would be nice to have the health data decoupled and with an accurate time stamp because if someone looks at the temperature graph in a low frequent interval (6h) the temperature at 24h would be the one from ~20h and the temperature from ~6 o'clock would be the one from midnight (depending on the month).
There is a second issue with the current methode. If there was no movement (count=0) the time array is also empty. I think in this case the health data will not be displayed. I think that was the main confusion I had when I setup the counter. The initial uplink comes with an empty time array and then I was not able to see the data in the graph.
But as I wrote in the beginning I'm also perfectly fine with the current function. :)
But for the second issue I metiond (count=0) I could change the device code so that it sends the current time stamp instead of an empty time array
I thought again about the synchronization problem #48 and I think to solve this in an elegant way the device should send its current time stamp within every data package. This time stamp could then also be used to display the health data. This approach would only require a minimal change on the server side. (timeArray[0] -> deviceTransmissionTime)
Great idea and already implemented.
At the moment the timestamp for the health data is taken from the first counter hit in the timestamp array.
This makes it easy to code the loop and every database entry can be used to sum up couter hits.
On the oder hand the timestamps on the health graph look strange, as the timestamps are not in a periodical order. Can we leave this or should we change it? https://console.cloud.google.com/functions/details/europe-west6/storeBikeCounterPro?env=gen1&project=bikecounter