You should be able to have multiple alarms, but it's not possible to add an attribute to events.
Thank you for your reply Anton
at my desk i have now a device with 2 BLE temperature sensors
i have a custom attribute per sensor (bleTemp1, bleTemp2), both out of range of the custom attribute settings
if i assing both of them as "Alarm" only one of them is recorded on events table (and in the attributes of the position record)
i can use "driverChanged" and "commandResult" to produce more events per position, but it is limiting and not "pretty"
You can have multiple alarms. Just do a comma separated values.
so, one custom attribute for multiple sensors with each expression separated with comma?
An example would be much appriciated
No, your alarm values should be separated by comma, not expressions.
Anton, i dont think i follow
I would make some tests later, but i dont really underestand your last reply
the device has bleTemp1, bleTemp2 configured and i need 2 lines in events table from the same position if both are out of desired range
can you give me an example?
What you want is to have a computed attribute for the "alarm" to report something like this:
temp1Alarm,temp2Alarm
With this, Traccar will generate two alarm events.
ok, i will test later today
the conditions / expression is different for each temperature
bleTemp1 normal bracket is 5c to 20c and bleTemp2 normal bracket is 2c to 7c
will this work?
That all depends on the expression you write. Why wouldn't it work?
my current expression for bleTemp1 is
(bleTemp1 < 7.01 || bleTemp1 > 20.00) ? "Cold Storage Temperature = " + (math:round((bleTemp1)*100.00)/100.00) + "c" : null
Hi Anton
i did a number of attempts, and i only get parser errors
as an example the following gives parser errors
(bleTemp1>20 && bleTemp2> 20.00) ? bleTemp1,bleTemp2 : null
Please, give me an example. Where and how i use the comma separeted values?
You have to return a string.
my last post is a simplified test
my actual expression is
(bleTemp2 < 1.01 || bleTemp2 > 20.00) ? "Fridge Temperature Alarm = " + (math:round((bleTemp2)*100.00)/100.00) + "c":
Type = string
After a lot of struggle, I finally understood what Anton meant by “comma separated alarm values”
I am putting here my findings to possibly help others that may seek a solution to a similar issue
The issue as I understand it, is that (at the current version v6.6) you can only have one “alarm “ computed attribute per position
If you have more than one computed alarm per position, they antagonize each other when the computed attributes are calculated and only one of them is recorded in the events table and also in the attributes column of the positions table
The trick is
Create one “Alarm” custom attribute for one device or group of devices
Make all the logical checks that raises an alarm inside this one computed attribute
Keep the alarm values or/and any manipulation of the data need to be done and FABRICATE the comma separated values
In my example on the above posts, I have two Bluetooth temperature sensors configured on one Teltonika tracker
If both are out of desired range then the expression is as follows
(bleTemp1 < 5.00 || bleTemp1 > 20.00) && (bleTemp2 < 1.00 || bleTemp2 > 7.00) ?
"Cold Storage Temperature Alarm = " + (math:round((bleTemp1)*100.00)/100.00) + "c" + “,” + "Fridge Temperature Alarm = " + (math:round((bleTemp2)*100.00)/100.00) + "c":
null
the above, creates one alarm addition on the attributes column of the position record AND 2 records in the events table
Dear Anton :
My understanding for a complicated installation (eg 4 temperature sensors and 3 analog inputs) is that all the logic for the alarms and alarm events creation must happen inside the expression of the alarm computed attribute
Is this correct?
Hi all
Running Traccar server V6.6
I use custom software that handles notifications (sms, email) based on records at events table – pre-alarms, alarms restores etc
I cannot find a solution to have multiple alarms per received position
As an example, lets consider a teltonika device that can be paired with 4 Dallas temperature sensors and 4 bluetooth temperature sensors for a total of 8 temperature sensors
In the scenario that all 8 sensors are out of desired range, is it possible using custom attributes to have a different entry to events table for each of the 8 sensors?
Ideally in the events table to have something like the following for each position received
Type Attributes
Alarm {“Temp1”,”xx.xx”}
Alarm {“Temp2”,”xx.xx”}
Alarm {“Temp3”,”xx.xx”}
…..
Appreciate your input