Computed attribute for Signal GSM

netluca17 years ago

Dear,

I am using the Teltonika protocol.
I tried to create this calculated attribute

Description: GSM signal
Attribute: RSSI
Expression:

rssi == "1"? "poor":
rssi == "2"? "bass" :
rssi == "3"? "normal":
rssi == "4"? "Good":
rssi == "5"? "Great" :
null

Type: Number

the problem lies in "TYPE" which is stuck on "Number" and you can not use "String"

Are there any other solutions?

Anton Tananaev7 years ago

Solution is to use any other name for the attribute. Also, why are you comparing number to a string in your expression?

netluca17 years ago

If i use Raw
Description: GSM signal
Attribute: Raw
Expression:

rssi == "1"? "poor":
rssi == "2"? "bass" :
rssi == "3"? "normal":
rssi == "4"? "Good":
rssi == "5"? "Great" :
null

Type: string

function correct but in the state panel is show "Raw" not "Gsm Signal"

Anton Tananaev7 years ago

Stop trying to reuse existing pre-defined attributes. Just type "Gsm Signal" in the "attribute" field.

netluca17 years ago

I'm sorry I did not understand that you could customize and then change type.

All solved
you can close it

Edwin H6 years ago

Is there a possibility to plot RSSI in more detail? (Exact readings)

João Cortes4 years ago

Hello good afternoon. All right?

I am also looking for this attribute for suntech, someone that attribute to give us?

Thanks.

CGonIT2 years ago

Hi!
I'm quite new with "Computed Attributes" in traccar, and I'm getting stuck with some of them.
For example:

Description: GSM Signal
Attribute: GSMSignal
Expression:

rssi == "1" ? "Mala Señal" :
rssi == "2" ? "Señal Regular" : 
rssi == "3" ? "Buena Señal" :
rssi == "4" ? "Muy Buena Señal" : 
rssi == "5" ? "Excelente" : null
Type: String

If I do click test selecting my FMB920 device, test is successfull with the next message: "Buena Señal", so RSSI level is "3".
But when I do clic into "save" button, i get this error message in red at the bottom: Column 'attribute' cannot be null - SQLIntegrityConstraintViolationException (... < QueryBuilder:473 < DatabaseStorage:108 < BaseObjectResource:98 < ...)

Are there any other solutions? What am I missing?
Same is happening with other customized "Computed Attributes".

Traccar version: 5.4, fresh-new installation from today.

Thank you in advanced.

Anton Tananaev2 years ago

My guess is that you typed the attribute name, but haven't actually selected it in the dropdown.

CGonIT2 years ago

But as you mentioned in the post number #4 (https://www.traccar.org/forums/topic/computed-attribute-for-signal-gsm/#post-27181), you told to not needed to use the "pre-definded" ones, i'm wrong? I thought you can create your own ones.

If I use the predefined one, "RSSI", the type changes to "number" (don´t know if this affects), and then the error is while doing click in "test" with my FMB920 device. You can save it, but even if you edit the device and under "Connections", you select the "Computed Attribute" recently created, nothing new appears in the detailed view of the device.

I read the documentation about Computed Attributes days ago but I didn't find too much info about how to use it with examples, or more extended explanation sorry.

Anton Tananaev2 years ago

You can type your own attribute, but you still need to click on it in the dropdown.

Anton Tananaev2 years ago

This is what I mean. You need to click that typed item in the dropdown.
screenshot

CGonIT2 years ago

Sure, thank you. I didnt understand what you meant, but now it's done :)

Once the computed attributes are created, should they appear in the device details after the connection is made in the device properties or it has a delay or traccar service needs to be rebooted?

I notice that not all Computed Attributes appears in the detailed view of the device, even if the "test" button show me works.
Thank you Anton for your help.

Anton Tananaev2 years ago

They appear only after a new position is received.

Don2 months ago

Hi,

can you please advise, I'm learning compute attribute and trying the above on Traccar 6.5, but it returns:

ERROR: null value in column "attribute" of relation "tc_attributes" violates not-null constraint Detail: Failing row contains (39, GSM Signal, string, null, rssi == 1 ? "Poor" : rssi == 2 ? "Bad" : rssi == 3 ? "Moderate" ..., 0). - PSQLException (... < QueryBuilder:469 < DatabaseStorage:95 < BaseObjectResource:73 < AttributeResource:77 < ...)

Description: GSM Signal
Attribute: GSM Signal

rssi == 1 ? "Poor" :
rssi == 2 ? "Bad" :
rssi == 3 ? "Moderate" :
rssi == 4 ? "Good" :
rssi == 5 ? "Best" : null

String