Traccar never sets it to null, so I don't see how it could be happening. You can only get null for newly created device that hasn't received any data yet.
I'm only updating uniqueid and name through my app but I never update positionid. I'm sure it's not traccar's intention to set it to null but possibly a bug?
Do you set it to null? If you don't send it, it probably means that you are setting it to null. You have to send full model.
I can't agree with you because I'm almost never updating those attributes (name and uniqueid) or any of them (for devices) but unexpectedly setting positionid to null happens a lot of time during day.
What do your REST requests look like?
What do you exactly mean with that?
How do you update uniqueid and name?
With Laravel (5.3).
$device = Device::findOrFail($id);
if(($response = $this->validateDeviceData($request, $id)) !== true) return response()->json($response);
$device->uniqueid = $request->get('imei');
$device->name = $request->get('name');
$device->type = $request->get('type');
$device->save();```
`type` is automatically converted to json and put into `attributes` field.
I'm assuming that you are using API. What is the JSON in the request?
I'm not using traccar's API.
On success JSON returns this:
return response()->json([
'success' => true,
'data' => [
'name' => $device->name,
'type' => $device->type
]
]);
If the first if
fails it just returns message what's wrong (uniqueid is not number, name is required, etc.)
What are you using then? I'm very confused.
Laravel is framework for PHP. As you can see there is no queries written by me. $device->save()
method saves new data to database.
Once again, modifying uniqueid and name is not a common task, therefore update in database is almost never executed.
I'm using traccar as backend only, working on my own frontend and I use traccar web ui just for some testing. Anyway, I have 4 Teltonika devices right now (will be 8), FM1100 (x2) and FMA110 (x2). The problem is that random devices in random time (only one of 4) get positionid attribute set to null. Checked the logs, the only strange thing is that sometimes I get hex message which says (decoded) SSL2.0-libSSL. I know I can check if positionid is null, then if it is fetch last position for that device but I'm curios why is that happening?
Also, in the logs I found about 10 positions (about 45 minutes difference) for one of the devices but they were never pushed to mysql db. Possible symptoms?