Help with alarm and computed attribute

genletal 8 years ago

Hi,
Need to obtain an alarm when the attribute Io3 get the 100.00% value. Device uses gps103 protocol. I'm confused on how to do that. Actually I configured this parameters.

Description: Level Up
Attribute: Alarm
Expression: Io3 == "100.00%" ? false : true
Type: String

I will appreciate any help.

Anton Tananaev 8 years ago

You need to return alarm key. Something like this:

io3 == "100.00%" ? "someAlarm" : null

Note that all attributes always start with low case letter.

genletal 8 years ago

Thank you very much friend!

anshuljain 8 years ago

Hi Anton

I have a similar question. I want to trigger alarm/event in events table when I get a particular attribute condition.
For example I want to trigger ignitionOn when I receive ot1 == true;

I tried using:
Attribute: Event/Alarm
Expression: ot1 == false ? "ignitionOn" : null

When I do the testing using ? button, it shows ignitionOn. But there is no insert in events table nor in attributes in position table.
I tried restarting the server also. Can you tell me what I am doing wrong here.

Thanks for your support.

Anton Tananaev 8 years ago

Where does it show "ignitionOn"? You should be using Alarm, not Event.

anshuljain 8 years ago

I tried with Alarm also.
It shows ignition on from the test option (?) while creating the computed attribute.

Anton Tananaev 8 years ago

Then it should work the same way for actual positions. Probably you haven't received any new ones.

anshuljain 8 years ago

I am getting data every one min. I have not put any duplicate filter so every one min a new row is inserted.
I tested with below condition also as ignition is coming in each row in position table.

ignition == false ? "ignitionOn" : null

Logs:

2017-11-09 10:21:17 DEBUG: [0FFDD69C: 5023 < 106.222.7.234] HEX: 78780a13040604000201d7d0b10d0a
2017-11-09 10:21:17 DEBUG: [0FFDD69C: 5023 > 106.222.7.234] HEX: 78780513003a66a10d0a
2017-11-09 10:21:17  INFO: [0FFDD69C] id: 359857080213739, time: 2017-11-09 16:02:30, lat: 28.64633, lon: 77.13088, speed: 0.0, course: 77.0
2017-11-09 10:22:17 DEBUG: [0FFDD69C: 5023 < 106.222.7.234] HEX: 78780a13040604000201d828460d0a
2017-11-09 10:22:17 DEBUG: [0FFDD69C: 5023 > 106.222.7.234] HEX: 78780513003b77280d0a
Anton Tananaev 8 years ago

Silly question. Have you linked your computed attribute to the device?

anshuljain 8 years ago

yes of-course :)

anshuljain 8 years ago

Do you want me to share credentials with you to frontend over an email?

Anton Tananaev 8 years ago

Sure, I can have a quick look.

anshuljain 8 years ago

Sent you details on support@traccar.org.

Anton Tananaev 8 years ago

I can see that your device has time in the future and doesn't update location. Can you please next time check everything more carefully.

anshuljain 8 years ago

Thanks Anton. Let me check it out why its showing wrong data. From socket its showing correct time as per utc.

{"devices":[{"id":1909,"attributes":{},"name":"Harsh Gt06F","uniqueId":"359857080213739","status":"online","lastUpdate":"2017-11-09T11:03:26.927+0000","positionId":5806021,"groupId":0,"geofenceIds":[],"phone":"","model":"","contact":"","category":null}]} 1510225406.9616485

I will check and let you know once I am able to fix it.