calculate device downtime

smsoousa 2 years ago

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

Anton Tananaev 2 years ago

Check status events and calculate the time difference?

smsoousa 2 years 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 Tananaev 2 years ago

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

smsoousa 2 years ago

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

Anton Tananaev 2 years ago

Then you can probably just use stops report.

smsoousa 2 years 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.