Hard Braking Attribute

Haider a year 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 Tananaeva year ago
  1. What is the time variable? Where are setting it?
  2. The alarm value doesn't match the standard key.
Haider a year ago

Ok so any idea how I can do this?

Anton Tananaeva year ago

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

Haider a year ago

ok Thank you