Possible bug in main branch github with computed attributes.

maclofin a year ago

I'm here again because I think I've discovered a bug, I'm not 100% sure. I have on one server the latest version of traccar (main branch from github) and on another server I have the stable version 6.2.

Github version: I create a calculated attribute with the admin user and assign it to a device and a user and the calculated attribute works on the end user. No problems.

Version 6.2 stable: I create a calculated attribute with the admin user and assign it to a device and a user but the calculated attribute does not work, however when I test the calculated attribute, the test does work.

This is in case you want to check it before version 6.3 release, I will be forced to downgrade to version 6.2 stable.

Anton Tananaev a year ago

You're saying that it works with a version from GitHub, but there's a bug in the GitHub version. Did you mix something up? What is the bug?

maclofin a year ago

Sorry, sorry! I mixed up.

Github version don't work as expected, this is the version that don't work.

Version 6.2 stable works well.

Anton Tananaev a year ago

Just tested and it seems to work correctly on master.

maclofin a year ago

I just attach a screenshot of the issue using master. Is the same for others computed attributes (for some reason only lowPower works.
Untitled.png

I have another question, if the computed attribute is created by an admin and assigned to a device, for example device 'Car01', every user that I assign 'Car01' if have the notification of overspeed would receive a notification when the attribute is triggered? I don't need to assign the attribute to the user too?, Just to confirm because I read in another post that the attributes is proccesed for each devices no matters if the non-admin user don't see that the attribute is assigned to the device (because don't have access to this computed attribute)

Anton Tananaev a year ago

Computed attributes are calculated no matter what users they are assigned.

maclofin a year ago

Ok, do you have any idea of my issue? I sent all the screenshot, I think I don't have nothing left to configure.

Anton Tananaev a year ago

You need to check whether the event is a string or a number.

maclofin a year ago

The event is likely most a number, in the startek documentation (that’s the brand of my devices), all are from 1 to 56 events represented as number.

Anton Tananaev a year ago

The question is about how it's decoded in Traccar.

maclofin a year ago

But how can I know that?

The decoder decode this automatically.

StartekProtocolDecoder.java
Question: If I add a case here, for example case 42 -> Position.ALARM_ACCIDENT; is enough to Traccar to assign automatically the alarm to the event 42?

    private String decodeAlarm(int value) {
        return switch (value) {
            case 1 -> Position.ALARM_SOS;
            case 5, 6 -> Position.ALARM_DOOR;
            case 17 -> Position.ALARM_LOW_POWER;
            case 18 -> Position.ALARM_POWER_CUT;
            case 19 -> Position.ALARM_POWER_RESTORED;
            case 39 -> Position.ALARM_ACCELERATION;
            case 40 -> Position.ALARM_BRAKING;
            case 41 -> Position.ALARM_CORNERING;
            default -> null;
        };
    }

and decode event as a number.

    private static final Pattern PATTERN_POSITION = new PatternBuilder()
            .number("(d+),")                     // event
Anton Tananaev a year ago

Yes.