Need help modifying alarm e-mail template; my listed changes cause the template to stop working.

Paul5 years ago

When I'm sending alarms, I want the alarm title to be in the e-mail subject.
Since these are power-cut or low battery alarms, I also want the voltage to be in the body of the message.

In the course of making the subject and voltage modifications indicated below, the alarm just stopped working. Does anyone see my syntax error? Is there a debug/test mode for processing these? I can't find anything failing in the log files.

#set($subject = "$device.name: alarm! $position.getString("alarm")")
<!DOCTYPE html>
<html>
<body>
Device: $device.name
Line Voltage: $position.getString("power")
GPS Voltage: $position.getString("battery")
Alarm: $position.getString("alarm")
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
</body> </html> root@pc-host:/opt/traccar/templates/full#
Ernesto Vallejo5 years ago

Check tracker-server.log for error responses. Log also tells you exactly where the error is.

Ernesto Vallejo5 years ago

Looking at the original file at https://github.com/traccar/traccar/blob/master/templates/full/alarm.vm I can see that you are adding a degree character at each position variable.

Maybe this file can help you find in case of a misspelling ...

I think that, instead of
$position.latitude°, $position.longitude°

You should write it as
$position.latitude, $position.longitude