calculate device downtime

smsoousaa year ago

Hello everyone, I would like to know if it is possible to somehow calculate the downtime of devices.

Anton Tananaeva year ago

Check status events and calculate the time difference?

smsoousaa year ago

Thank you, this would be specifically in the tc_events table correct? Checking using the deviceid, in the "deviceStopped" event type. Then I would subtract the "eventtime" from the current date, would it be something like this?

Anton Tananaeva year ago

What exactly do you mean downtime? It sounds to me like you want to calculate stop time, not downtime.

smsoousaa year ago

Sorry for my English, that's exactly it. Stop time. Not downtime.

Anton Tananaeva year ago

Then you can probably just use stops report.

smsoousaa year ago

I know there is a stop report, but I'm trying a small function in PHP, using the API. Where I have a line called Status, when the vehicle is moving, the text is "In Motion" and when the device stops, I would like to show a time, which would count the time that the device is stopped, understand? Between one position and another. Once the device moves again and stops, the counter is recalculated again.