calculate device downtime

smsoousa8 months ago

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

Anton Tananaev8 months ago

Check status events and calculate the time difference?

smsoousa8 months 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 Tananaev8 months ago

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

smsoousa8 months ago

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

Anton Tananaev8 months ago

Then you can probably just use stops report.

smsoousa8 months 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.