Questions about the use of custom attributes

Luc Peulen6 years ago

Dear Anton,

I have a number of questions about using attributes.

Question 1: my gps103 based GPS trackers report the io1, io2 and io3 attribute. These show as either 0 or 1. What I would like to have is, per device (group), have a custom attribute with a logical name, which reports the assigned io1, io2 or io3 value. E.g.: I have a device group called "RFS 201" for which "io2" indicates whether some button is pushed or not. So I would like to have an attribute for all devices in the RFS 201 group called "Button" which report the io2 value. When I create a calculated attribute, I cannot select "io2" as the attribute assigned, but have to choose from a drop down list e.g. Contact, but in the calculation I can refer to io2 and read its value. But as a result, the calculated attribute shows as Contact, i.e. with the name from the drop down list. What steps do I need to do to get a new attribute called "Button" which shows the value of io2 in the status list with parameters?

Question 2: the filter.distance attribute requires a minimum displacement for the value to be recorded. Is there also a filter that does not record any excess movements, e.g. more than 1 km should be ignored? I'm refering to this list: https://www.traccar.org/configuration-file/

Question 3: I need to calculate distance when another attribute has a specific value. So, for example linked to question 1, I need a parameter activeDistance which accumulates distance traveled only when Contact = io2 = true / 1. Is there any reference on how to proceed?

Any help is greatly appreciated.

Thanks, best,
Luc

Anton Tananaev6 years ago
  1. You don't have to select one from the list. You can type your own.

  2. There is max speed one. Speed in this case calculated from distance and time.

  3. Possibly you can combine attribute copying and computed attributes, but not sure.

Luc Peulen6 years ago

Dear Anton.
Thank you.

Regarding 1) yes, I can type my own name, but it doesn't show up in the status list of a vehicle. How to add a created attribute to the status list?
Regarding 2) I see, thanks!
Regarding 3) Thanks, I will look into this more.

Anton Tananaev6 years ago

It will show in the status.

Luc Peulen6 years ago

Dear Anton,
I tried for 5 devices, but it doesn’t show. Could you explain where the attribute should be added?

Luc Peulen6 years ago

When I add an attribute to a vehicle (Edit > Attributes) the parameter isn’t available for selecting in the dropdown for creating calculated attributes either.

Anton Tananaev6 years ago
Luc Peulen6 years ago

It won’t show in the Status list. Is there an easy way to share the screenshots with you?

Anton Tananaev6 years ago

Upload it somewhere and share a link here.

Luc Peulen6 years ago

Dear Anton,

Testing with tracker "RFS 101001":

Calculated attribute in the general Settings pane:
http://www.dinnertrain.eu/tmp/Screen3.png

Enabling the calculate attribute at the tracker level:
http://www.dinnertrain.eu/tmp/Screen1.png

Status list as the tracker level:
http://www.dinnertrain.eu/tmp/Screen2.png

Anton Tananaev6 years ago

First of all, IO attribute is most likely a string, not a number. Secondly, why you have double-colon there. Where did you get the syntax from?

Luc Peulen6 years ago

Dear Anton,
It reports as either 0 or 1. That works. If I test the formula, it evaluates correctly to either true or false.
The syntax was copied from another example I found on the forum. Interestingly, when removing the second semicolon, now the attribute also shows in the status list!
The io1, io2 and io3 attributes also show directly in the status list. Is it possible to hide them without modifying the PHP files?

Anton Tananaev6 years ago

Which PHP files?

Luc Peulen6 years ago

Dear Anton. I'm not refering to a specific php file. My question was whether it is possible to hide such attributes through the UI instead of needing to modify any files.

Anton Tananaev6 years ago

Yes, you can hide it using user attributes.