Teltonika Protocol Alarm Modification

souhail2 years ago

Hello,

I have tried to add (Jamming, Removing, Tow, Accident) to Teltonika Protocol

        register(246, null, (p, b) -> {
            p.set(Position.KEY_ALARM, Position.ALARM_TOW);
        });
        register(247, null, (p, b) -> {
            p.set(Position.KEY_ALARM, Position.ALARM_ACCIDENT);
        });
        register(249, null, (p, b) -> {
            p.set(Position.KEY_ALARM, Position.ALARM_JAMMING);
        });
        register(252, null, (p, b) -> {
            p.set(Position.KEY_ALARM, Position.ALARM_REMOVING);
        });

I have setup notifications for all these ALARMS.
Sometimes i'm receiving notification without issue. Sometimes i keep receiving repeating notifications and the position is stuck (In Traccar Web interface no new position sent, same in the log file, it keeps sending old positions).
Am i missing something in my code?

Cristian2 years ago

and why didn't you use calculated attributes?

Anton Tananaev2 years ago

Traccar won't send notifications without new data from devices.

souhail2 years ago

Hello Christian, It's more clean to change in the code to avoid too much configuration.

Hello Anton, thank you for your answer.
I have observed the behavior of the device. Correct me if I'm wrong, it looks like the server is not acknowledge receiving the positions so the alarm keep repeating again and again.
I can see that the device is connected, but the position is not updated.
When I roll back to the unmodified code, the new positions are sent correctly.

Anton Tananaev2 years ago

Have you compared logs?

souhail2 years ago

I will reproduce the Error and show you the log Anton
But basically, do you see any issue on the code i have added? or probably i need to modify another part in the code?

Anton Tananaev2 years ago

I don't see any problem with the code.