Computed Attributes

Norm6 years ago

I need some help with computed attributes. I keep trying to figure it out on my own, but I'm not getting the results I am looking for.

I need an email triggered when "input" is equal to 0. My device has "input" mapped to the battery, so when "input" is 1 or 2, batteries are good. When input is 0, batteries needs replaced. I would like it to say in the message that "Low Battery". Here is what I tried.

Computed Attribute

Anton Tananaev6 years ago

Alarm attribute should return a string value. Your one returns boolean, as far as I can tell.

Norm6 years ago

I set the attribute as "Alarm", so when it triggered, it used the alarm notification (email).

I didn't see a way to create a custom notification for low battery.

Anton Tananaev6 years ago

Sounds like you just ignored what I said. The value of the attribute should be a string. More specifically it should be one of the following strings:

https://github.com/traccar/traccar/blob/master/src/org/traccar/model/Position.java#L102-L140

Norm6 years ago

Sorry, I was not trying to ignore what you stated. I just didn't understand it until you posted that link. Thank you for that!

I have replaced the expression with this, so I now see an alarm in the tracker state screen. But it is not sending notification emails or triggering web alarms. I have the device set to send alarm notifications, plus I have "Low Battery" alarms selected in the notifications screen. Any ideas on why it is not sending them?

input == "0" ? "lowBattery" : null   
Anton Tananaev6 years ago

I suspect there is some problem with notification settings.

Norm6 years ago

I have been over it a dozen times. Maybe you can see something I am missing? All other notifications work as planned. Geo, ignition,...

Device shows low battery alarm
Device had alarm selected
Account notifications

Anton Tananaev6 years ago

Not sure what the problem could be, but it seems to be configured correctly.

Norm6 years ago

I deleted the device and recreated it. Seems to be working now! Thanks for the help on getting the attributes working!

Norm6 years ago

Is there a way to alarm on "Last Update"? If a tracker has not sent any update in 12 hours, send alarm notification?