Hi,
I have a Traccar server running where I have encountered a problem. Changes to the device connections are not saved e.g. the linking with geo fences. My user have admin permissions.
In the log I see the following events:
2022-12-15 11:27:42 INFO: user: 2, action: link, owner: device, id: 1, property: geofence, id: 2
2022-12-15 11:27:43 INFO: user: 2, action: edit, object: device, id: 1
2022-12-15 11:28:00 INFO: user: 2, action: edit, object: device, id: 1
However, the changes do not arrive in the database:
mysql> select * from tc_devices where id=1\G;
*************************** 1. row ***************************
id: 1
name: iPhone
uniqueid: 12345678
lastupdate: 2022-12-14 21:27:18
positionid: 696
groupid: NULL
attributes: {}
phone: NULL
model: NULL
contact: NULL
category: NULL
disabled: 0x00
status: offline
geofenceids: NULL
expirationtime: NULL
motionstate: 0x00
motiontime: NULL
motiondistance: 0
overspeedstate: 0x00
overspeedtime: NULL
overspeedgeofenceid: 0
1 row in set (0,01 sec)
mysql> select * from tc_geofences where id=2\G;
*************************** 1. row ***************************
id: 2
name: TestZone
description: NULL
area: POLYGON ((51.07726335905008 13.753570691341679, 51.07366189080696 13.75387521009256, 51.073605615641355 13.76353024575593, 51.078940197056056 13.763691461565287, 51.07851255286806 13.753803558621826, 51.07726335905008 13.753570691341679))
attributes: {}
calendarid: NULL
1 row in set (0,01 sec)
Interestingly, I have the same problem on the website https://demo.traccar.org.
Do you have any idea what this could be? Or am I doing something wrong?
best regards
Tristan
I think your confusing linking geofences to devices and current geofences that the device is in. The latter is shown in the device API, not the former.
Mhh ok, I want to define a geofence and be alerted when the device leaves it.
For this I created a geofence and a notification of the "type: Geofence exited" for all devices.
Then I tried to assign the geofence to the device via the connections parameter.
Is that not correct?
If you're trying to set geofenceids
for that, that's not how you do it. You need to use permissions API instead. I would recommend checking what the official app does.
Sorry, perhaps I have expressed myself incomprehensibly. I currently only use the web interface and would like to configure the geofence there for a device. I checked the database only for error analysis.
Geofence:
Notification:
When I configure the device I can select the geofence.
But when I press the Save button, the changes are apparently not saved. Because when I open the device properties again the configured geofence is gone.
In that case you were using the wrong places to check errors. Connections are stored in linking tables, not in the device or geofence table.
Anyway, it is expected that the connection field is empty until you click on it. We want to avoid preloading all the data to avoid excessive number of API calls.
Ah ok, thanks for the explanation! I just tested it, the mapping between device and geofence is saved correctly.
Hi,
I have a Traccar server running where I have encountered a problem. Changes to the device connections are not saved e.g. the linking with geo fences. My user have admin permissions.
In the log I see the following events:
However, the changes do not arrive in the database:
Interestingly, I have the same problem on the website https://demo.traccar.org.
Do you have any idea what this could be? Or am I doing something wrong?
best regards
Tristan