Traccar Velocity template - add speedLimit

Mambusa month ago

I tried to modify the deviceOverspeed.vm file like this to include the speedLimit in the notification popup but it does not work, it prints the variable name "$speedLimitString" instead of the speedLimit calculated value. the test that i did suggest that the $position.speedLimit is empty. what I am doing wrong? Thanks fellows

#if($speedUnit == 'kmh')
#set($speedValue = $position.speed * 1.852)
#set($speedString = $numberTool.format("0.0 km/h", $speedValue))
#set($speedLimitValue = $position.speedLimit * 1.852)
#set($speedLimitString = $numberTool.format("0.0 km/h", $speedLimitValue))
#elseif($speedUnit == 'mph')
#set($speedValue = $position.speed * 1.15078)
#set($speedString = $numberTool.format("0.0 mph", $speedValue))
#set($speedLimitValue = $position.speedLimit * 1.15078)
#set($speedLimitString = $numberTool.format("0.0 mph", $speedLimitValue))
#else
#set($speedString = $numberTool.format("0.0 kn", $position.speed))
#set($speedLimitString = $numberTool.format("0.0 kn", $position.speedLimit))
#end
$device.name exceeds the speed $speedString $speedLimitString #{if}($geofence) in $geofence.name#{else}#{end} at $dateTool.format("yyyy-MM-dd HH:mm:ss", $event.eventTime, $local>
Anton Tananaeva month ago

The problem is that position.speedLimit doesn't exist.

Mambusa month ago

can you suggest a alternative for my goal?

Anton Tananaeva month ago

Try position.getDouble("speedLimit").

Mambusa month ago

it works, thanks for taking the time !!!

Mambusa month ago

any tip for showing the same thing ( actual speed and speed limit ) in the right event drawer for the overspeed event? I tried to play with the formatter.js but is seems the overspeed event has the attributes field empty