[help] Traccar server not sending device status

brenthmiras8 years ago

My nodejs web server has a dedicated route for creating a new device, separate from that of traccar rest api.
Now there are two issues:
(Note that I used an android device for testing)
1.) Created device under my created route does not show up on traccar web interface.
2.) Created device under my created route sends online,offline status to traccar server (proved by inspecting tracker.log) and traccar server stores an event (deviceOnline, deviceOffline, etc...) in events table, But traccar web socket server does not send device status updates.

What is that thing that traccar server rest api does when creating a device that I missed?
What tables do traccar write into when creating a device such that it is shown in traccar web ui? and sent status notifications about?

brenthmiras8 years ago

More info about my route:
My route for creating device extends that of the traccar api that it requires more fields and of course, the devices table has been modified to contain those extra fields.

My goal is just to add a device via my created route and have devices created under that, send status updates via web socket.

Anton Tananaev8 years ago

You should use Traccar API to create devices because there is an internal cache in the server.

sathish7 years ago

Hi Anton,
I have used traccar api for inserting devices into server.
And it appears in web as well but the status is empty(as for other device it shows as online,offline,unknown.) So devices added with api how to make it enable?
Any api i need to use it?

Also after device insterted from api i want the device id to be returned back. Is there anything i can get?

Thanks,
Sathish

Anton Tananaev7 years ago

Status updates come through WebSocket API. You can't edit it.

API for adding new device returns full model back, including id.

sathish7 years ago

Hi Anton,

Thanks for the reply and yes now i can see the detailed responses after device added.

And is that any api for getting notification on , whenever a device is entered inside and outside of geofencing?

Thanks,
Sathish

Anton Tananaev7 years ago

Notifications come through WebSocket as well.

sathish7 years ago

Hi Anton,

Thanks for the reply.
I saw this api for :

GET /positions

Summary: Fetches a list of Positions

So here its for only one deviceid i can get the positions.
Is there any api where i can pass multiple deviceids and get latest positions of each devices in single response.?

Thanks,
Sathish

Anton Tananaev7 years ago

Where does it say that you can pass only one deviceId? You can have multiple.

sathish7 years ago

Which api supports this feature.
Please let me know.

Anton Tananaev7 years ago

Sorry, looks like only "devices" resource support multiple ids, not "positions". Positions API supports multiple "positionId" parameters though.

sathish7 years ago

Hi Anton,
Api : /api/reports/events

Returning only "deviceMoving","deviceStopped" type events only. Actually for the device already "geofenceEnter" and "geofenceOut" data exists in Datatabse table "events". But why its available when i use it in Api : /api/reports/events ?

Thanks,
Sathish

Anton Tananaev7 years ago

Is it available if you request the report through Traccar web app? It uses same API.

abyss7 years ago

Also want to remark that geofence events are filtered out if user requesting report do not have access to them.