Hard Braking Attribute

Haider 2 years ago

Hello Traccar Community,

I am currently trying to implement a custom attribute for detecting hard braking events in my Traccar system. I have defined the following expression for the 'alarm' attribute:

Attribute: alarm
Expression:

var speedThreshold = 20; // Define the speed threshold for hard braking in km/h
var timeThreshold = 5; // Define the time threshold in seconds

var isHardBraking = speed > speedThreshold && time > timeThreshold;
isHardBraking ? "Hard braking detected" : null;

Type: String

I would appreciate it if anyone could guide me on how this attribute works and if there are any specific considerations I need to keep in mind while using it. I want to ensure that the attribute accurately detects hard braking events based on the defined speed and time thresholds.

Your insights and suggestions on how to fine-tune this attribute would be highly valuable. Thank you in advance for your help.

Anton Tananaev2 years ago
  1. What is the time variable? Where are setting it?
  2. The alarm value doesn't match the standard key.
Haider 2 years ago

Ok so any idea how I can do this?

Anton Tananaev2 years ago

You can't do what you want just with computed attributes.

Haider 2 years ago

ok Thank you