Teltonika Power Cut/Restored Solution

bluelaser 9 months ago

Fantastic software thank you to the devs. Posting this here in case it helps someone as I saw quite a few solutions that didn't quite get there. I wanted to:

  1. Generate an Alarm Event on loss of power to Teltonika devices.
  2. Keep that Alarm active and visible on the web app GUI as long as the power was cut.
  3. Generate an Alarm Event on power restore.
  4. Have the restore alarm clear and not appear on the web app GUI after the restore Alarm Event.

Steps:

A. Set the Teltonika device to report Unplug Detection with 'Eventual Records' Disabled. This ensures the state is sent with each record.
B. Enable processing.computedAttributes.lastAttributes in the traccar.xml config file with this line:

<entry key='processing.computedAttributes.lastAttributes'>true</entry>

C. Restart the server (I don't know if this is necessary.)
D. Create a Computed Attribute with the following:

Attribute:
Alarm

Expression:

io252 == 1 && lastIo252 == 0 ? "powerCut" :
io252 == 1 && lastIo252 == 1 ? "powerCut" :
io252 == 0 && lastIo252 == 1 ? "powerRestored" :
io252 == 0 && lastIo252 == 0 ? null : null

E. Finally, link the Computed Attribute to a Device or Group.

Byron 8 months ago

i will try it thank you

Fin 18 hours ago

This is really helpful, can I ask some questions or ask for peoples help or support? Which may help others.

Issue 1. I've done all the steps including adding the new data to the server, added computed attributes, and assigned both the commuted attribute to the device but also the notifications for "power cut" and "power restored" when the power is lost it works perfectly, when its restored the alarm clears after a minute or so but no notification or push etc.

I've tested it with a FMB965.

Issue 2. when I test this with a FMT100 (latest software) it never triggers, when I'm in the Teltonika configurator, I disconnect the power and it go different each time however across the course of say 5 seconds it goes 12v, 9.6v, 6.1v, 3v, then 0, it must report this to Traccar and the pop up window shows randomly one of the values, eg 6.1V and never changes, however never the 0v, each time i try its a little bit different with different voltages recorded.

In Teltonika I've the "Eventual records" turned off, and on the voltage in the IO menu, set this to high, any ideas?