Map event to driver

RDET10 months ago

Hi there clever people.
I have a Teltonika device, which needs to scan a bluetooth unit and report on the unique ID.
I have managed to get this going on the hardware but it reports it as an event and not an io/attribute.
Below is the full string it reports. I have searched computed attributed but have not found anything that helps me map this beacon1Namespace to a driver. Please help.

priority=0  sat=9  event=385  beacon1Namespace=11886f832c8455aabc32  beacon1Instance=1a2ed72e0055  beacon1Rssi=-52  distance=99.22  totalDistance=986190.41  motion=true  hours=442239201
Anton Tananaev10 months ago

What's the problem with mapping it to a driver id using computed attributes?

RDET10 months ago

Wow, your responses are so quick. Thank you for that.
Well, I suppose I have no idea how to do that then. I managed to map io's to rpm/throttle and so on, but this one is above my pay grade.
Any ideas would be appreciated. Also happy to make a donation for your time.

Anton Tananaev10 months ago

Create a computed attribute "driver id" (or whatever it's called) and put beacon1Namespace as the expression.

RDET10 months ago

That works like a bomb, thank you. My problem is mapping this back to trip report. I have the built in driverUniqueId in computed attributes which maps to beacon1Namspace and a test returns the ID. Under trip report through, driver remains empty.
Driver has been added with an identifier that matches this string returned. Seems it does not just map automatically and I still need to do something.

Anton Tananaev10 months ago

You need to make sure you have driver value in every position. Computed attributes also don't apply retroactively.

RDET10 months ago

Do you mean, it must report it with every record or that there must be a driver for every reported value?
Currently there is only one tag reporting, and one driver until I can make this work, so it will indeed only be one value.
This tag only sends its ID every 30 seconds. There is no way to have it send with every location update. It works like an event, such as harsh braking and is occasional. Went back to test the computed attribute and got this instead of the ID, where it worked previously

org.traccar.handler.ComputedAttributesHandler.computeAttribute:124@1:1 variable 'beacon1Namespace' is undefined - Variable (ComputedAttributesHandler:125 < AttributeResource:63 < ... < OverrideFilter:49 < ...)
Anton Tananaev10 months ago

If it doesn't report it with every location, you should use attribute copying to copy it. Otherwise reports won't work properly.

RDET10 months ago
<entry key = 'processing.copyAttributes.enable'> true </entry>
<entry key = 'processing.copyAttributes'> driver unique id </entry>

also changed expression to: beacon1Namespace ? beacon1Namespace : null to prevent previous error in testing.
Returns value when you keep testing and the 30 seconds passed.

Vehicle stopped now, will need to wait and hope it works.
Thank you Anton.

Anton Tananaev10 months ago

It should be "driverUniqueId" instead of "driver unique id".

RDET9 months ago

Hi Anton.
Thanks a mil.
I did that, but still nothing, so I changed beacon1Namespace ? beacon1Namespace : null to just beacon1Namespace assuming the copy attribute actually looks for empty reports and that worked.
So for anyone else with this requirement, there you go.
Much appreciate your quick replies and help. Awesome product.