New Custom Attribute from batteryRaplace from Globalstar protocol

yuzz_pola year ago

Hi! Trying to create an alarm from the state of a data "batteryReplace" I am using the following code, which I took from the example on the web.

Alarm
batteryRaplace ? batteryRaplace == 1 : false
Boolean

I get the following error.

@2:1 ambiguous statement error near '... batteryRaplace ? batteryRaplace == 1 : fal ...' - Ambiguous (ComputedAttributesHandler:119 < AttributeResource:63 < ... < OverrideFilter:50 < ...)

Any idea where to point?
Thank you so much!

Anton Tananaeva year ago

Try adding brackets around the inner expression.

yuzz_pola year ago

Excelent! THX!!!

yuzz_pola year ago

After some test, using this code

[batteryReplace ? true : false]

using de EXPRESSION TEST button the result is this, whitout show any error

[Z@352d8eee
[Example] (https://prnt.sc/1r5lKiYssXwg)

For test porpuse only i use divices with globalstar protocol and other and always shows the same output
The attribute is in the dB

{"in1":true,"in2":true,"charge":true,"batteryReplace":false,"distance":21.72,"totalDistance":11032.49,"motion":true}

Anton Tananaeva year ago

Why are you using square brackets? Can you please point to the documentation where you found that syntax.

yuzz_pola year ago

JAJAJAJAJAJAJAJA SORRY!!!! Me mistake ... i didn't see .. now work like a charm. I
Thx!!!