Notification mail when power is below 10 Volts

Alf-DK3 years ago

Hi there

I am trying to make so I get an email when there is less than 10 volts on the battery in the car, but can not make it work.

Anyone know how to set it up in Traccar ???

Anton Tananaev3 years ago

You can create a computed attribute that would set alarm attribute based on the power value.

Alf-DK3 years ago

Yes, I thought so too, but that's where it goes wrong.
I'm trying to learn to make those attributes, but I did not quite succeed yet ...

Anton Tananaev3 years ago

We have documentation for it and there are some forum examples. If it still doesn't work, post details on what you've tried.

Alf-DK3 years ago

Have studied the documentation and have tried to make a text string based on it

power? power <10: null

I then get an error message:

class java.lang.Boolean cannot be cast to class java.lang.Number (java.lang.Boolean and java.lang.Number are in module java.base of loader 'bootstrap') - ClassCastException (AttributeResource:61 < ...)
Anton Tananaev3 years ago

And what is the type?

Anton Tananaev3 years ago

Where is the alarm and alarm type in your attempt?

Alf-DK3 years ago

Have tried with power and then I get the error when I test it on a device.

Have now tried with the type Alarm and there I do not get an error message. Will it work?

Anton Tananaev3 years ago

You probably need professional help with this. Looks like you don't understand what computed attributes are and how they work. And it doesn't seem like you are interested in putting any effort to research it yourself.

Alf-DK3 years ago

yes i need help therefore i am writing here. that's right.

However, I am very interested in learning it!
I just need to find someone who has the skills to teach me that and it does not look like you have or want to.

Anton Tananaev3 years ago

Yeah, that's a bit out of scope for what I help with on this forum. I help people who did their research and just need a small hint to point them in the right direction.

Anyway, hopefully there's someone who can and willing to teach you here.

visiondrive3 years ago

Create Computed Attribute - add any description - I made my Attribute selection as Alarm

Expression is as below where power is an attribute actively reported by the device to traccar

power <10 ? true : null

Type is String

Click on test with a device - change the voltage setting to force expected output and to not - save and add to the device.

Alarm will be ACTIVE when power is <10 and not active when power >10

Anton Tananaev3 years ago

Looks like you are returning boolean value for a string type. It should be something like this:

power < 10 ? "lowPower" : null
visiondrive3 years ago

True but works - see what I did there...hopefully Alf gets the hint - he was very close.

Alf-DK3 years ago

Hi visiondrive
Thanks for the example you have made now I have something to work with. yes also thanks to you Anton. I want to see if I can make it work otherwise I will return. Thanks