Alarm/Event based on computed atributes

Pablo Castro7 years ago

Hello, I have a Syrus GPS for testing purposes and it has worked fine with Traccar so far. I tried to create a notification when a certain event occurs, but have failed to do so. This is what I have so far:

  1. Syrus GPS sends a signal to Traccar server with attribute Event=5, which means that the sensor triggered the signal.
  2. The signal is correctly received by Traccar server
  3. A computed attribute takes the event value and transforms it into an alarm, with the following code:
Alarm
event == "5" ? "tow" : null
String

When testing the computed attribute, it correctly shows "tow" as the value assigned when the signal arrives with event=5

The problem is I can't trigger a notification for the alarm, I have set an "Alarms" type of notification assigned to all devices, but no event is registered an no notification is sent.

Am I doing something wrong? I have searched through the forums and google and seems that I'm not missing anything.

Any help is appreciated.

Anton Tananaev7 years ago

Event is likely a number, not a string.

Pablo Castro7 years ago

The computed attribute works regardless of using 5 or "5". I've tested this by sending a signal with event=5 and using the "Check Computed Attribute" tool. It correctly displays "tow" as the value. The problem is I can't get a notification for this alarm, even though I have it set up to notify me for all devices.

Anton Tananaev7 years ago

Are you sure that notifications for alarms are enabled? Are other alarms working?

Pablo Castro7 years ago

Yes, they are enabled and the notifications for "Device is offline" or "Device status is unknown" are working. I have tested alarm values with computed attributes such as "sos" and they do not work. Is there any other way that I can test alarms? My GPS does not send an "alarm" field, that's why I'm using computed attributes.

Here is an image album of the configurations.

Link

Thank you for your help.

Anton Tananaev7 years ago

You can test with Traccar Client for Android. It can send SOS alarm.

Pablo Castro7 years ago

Ok, the SOS alarm and notification works when sent from an Android client.

Anton Tananaev7 years ago

Then there must be some issue with your computed attribute.

Pablo Castro7 years ago

My computed attributes are working correctly as shown in the imgur album, the "Check Computer Attribute" shows that it is assigning the correct value to the "Alarm" attribute. I have set up the same scenario in a demo server and my GPS is constantly sending a signal that triggers the computed attribute, but the alarms still won't work. Let me know if you want to check it out, I'll keep searching for a solution.

Anton Tananaev7 years ago

Do you see alarm in the state panel for your device? If not, it means that it's not working.

mohammed shafeeq6 years ago

we can use only the attributes in the stat panel in computed attributes ? that is if event is not showing in the state panel can't we use event in computed attributes ?

could you show me any code snippet that triggering an event in computed attributes ?

i am using traccar client android, and when it will send an "sos" alarm ?