Import multiple devices

GPS-911a year ago

Is there a working example such as mysqlfump for importing multiple devices from Excel file? Excel file would have Id and name. Traccar API looks complicated.

Track-tracea year ago

It looks more logical to use Auto register.

database.registerUnknown config
Automatically register unknown devices in the database.

database.registerUnknown.defaultCategory config
Default category for auto-registered devices.

database.registerUnknown.defaultGroupId config
The group id assigned to auto-registered devices.

https://www.traccar.org/configuration-file/

GPS-911a year ago

Never thought about it. It's working

Thanks

dima-simfer7 months ago

It looks more logical to use Auto register.

This useful, when your devices will send something to server. I want to make marks on map, that don't have any device, but have name and coordinates. So, is it possible to import some list?

Anton Tananaev7 months ago

It's not possible to show markers without having devices, but it's possible to auto-register devices, as discussed above.

dima-simfer7 months ago

I'm using self-hosted server and exploring the base. As i can see, i need to create a device and only one event with coordinates to mark anything somewhere.
If there is no tool to export, i can just prepare two files where tc_devices.id=tc_positions.deviceid and feed them to SQL-manager. This won't work?

Anton Tananaev7 months ago

I would not recommend changing the database directly.

dima-simfer7 months ago

OK. I'll save it for a last resort. I'm not good at programming at all. Can you recommend some tool to add goup of devices via API?

Anton Tananaev7 months ago

ChatGPT?

dima-simfer7 months ago

Just watching API. It won't help because there is no command to add coordinates, am I right? Only to get coordinates from server.

So, I tried to add a device. It was a little tricky. I had to make a device in tc_devices, then add an event to tc_positions with the same id of device, get id of that event and write it to tc_devices.positionid. And i forgot about users, need to add new device to tc_user_device. And restart the server. Well, it works.

dima-simfer7 months ago

I think, i should stop Traccar server to prevent creating new events, when i will add multiple devices.

GPS-9117 months ago

Did you try this? Change lat and Lang manually

http://yourserver:5055/?id=12345&lat=47.99822&lon=-85.679868
dima-simfer7 months ago

@GPS-911, No, I didnt.
It works, new devices added. But don't allowed to user. Is it set in "database.registerUnknown.defaultCategory"? Is it possible to send a name too via http-request?

dima-simfer7 months ago

@GPS-911, or you mean, that i can make devices via datadbase and then send coordinates in such way? Thank you! I think, that will helps.