Hello,
I am trying to implement a custom protocol in traccar and I am stuck at this problem:
- my implementation require that I can set device attributes :
device.set("nextTemp",nextTemp);
The problem is that the device attributes are not updated in database. The attributes field in the DB remain {} even if the device.getAttributes().toString() return all the attributes added in the java code.
Please help to save or force save the attributes to DB for devices.
Thank you !
I think I found the answer myself :
Context.getDeviceManager().updateItem(device);
Please someone with more experience confirm/infirm this .
Thank you !
How can we do this in the latest code base? There is no global like "Context" which can be accessed from decoder. This is where we want to update some property of device and store it in database. How can we do it now?
We use injection instead of global context now.
Hello,
I am trying to implement a custom protocol in traccar and I am stuck at this problem:
device.set("nextTemp",nextTemp);
The problem is that the device attributes are not updated in database. The attributes field in the DB remain {} even if the device.getAttributes().toString() return all the attributes added in the java code.
Please help to save or force save the attributes to DB for devices.
Thank you !