fetching "last seen" data

Chris2 years ago

Hi!

How can I fetch the last seen text listed in device list as a computed attribute?

Regards
Chris

Anton Tananaev2 years ago

Last update date/time should be available from computed attributes.

Chris2 years ago

Do you know the variable name?

Anton Tananaev2 years ago

Actually looks like we only allow access to device attributes, not properties. So not possible currently.

Chris2 years ago

OK, thank you!!!

ScaredyCat2 years ago

Wouldn't "Device Time" from attributes give you the effective last seen time? (assuming device reported that)

Anton Tananaev2 years ago

It's not an attribute. It's a property. That's exactly why I clarified it.

ScaredyCat2 years ago

It is listed under attributes though and it displays like the other ones. So I'm confused. ( see image attached to feature request, 2nd line from bottom https://github.com/traccar/traccar-web/issues/1010 )

Anton Tananaev2 years ago

Yeah, because it doesn't make sense to have two separate lists in the UI, but under the hood they are different. You can check API documentation.

Chris2 years ago

deviceTime will not be updated any time....

out of log file:

2022-08-10 19:47:19  INFO: [T27758dfb] id: 7301005348, time: 2022-08-09 17:14:08, lat: 46.70101, lon: 14.31611, course: 0.0
2022-08-10 19:50:20  INFO: [T27758dfb] id: 7301005348, time: 2022-08-09 17:14:08, lat: 46.70101, lon: 14.31611, course: 0.0
2022-08-10 19:53:20  INFO: [T27758dfb] id: 7301005348, time: 2022-08-09 17:14:08, lat: 46.70101, lon: 14.31611, course: 0.0
2022-08-10 19:56:20  INFO: [T27758dfb] id: 7301005348, time: 2022-08-09 17:14:08, lat: 46.70101, lon: 14.31611, course: 0.0
2022-08-10 19:59:20  INFO: [T27758dfb] id: 7301005348, time: 2022-08-09 17:14:08, lat: 46.70101, lon: 14.31611, course: 0.0

but:

serverTime	Server Time	2022-08-10 15:41:34
deviceTime	Device Time	2022-08-10 15:41:34
fixTime	Fix Time	2022-08-10 15:41:34

Device is online....

ScaredyCat2 years ago

Will do. Thanks.

Anton Tananaev2 years ago

We're not talking about the device time. We are talking about the lastUpdate time in the device model.

Chris2 years ago

Right. LastUpdate is a field in tc_devices table...
But as you said: I've to wait to get it in future

ScaredyCat2 years ago

Chris, isn't the time in your records above just the time that the device reports for the data - ie lat/lon/course data was created at this time? For example the Teltonika FMT100 buffers records if they can't be sent (no data connection at that time) then burst sends the data when it can, so some records would have 'old' timestamps but would be accurate for the time they were recorded.