How to create a formula in the visualization of a variable with an AND condition?
I have a widget where I need to display the occupancy of a "parking" slot
The sensor send me a
distance variable in the payload.
The problem is that the sensor sends 0 if the object is completely out of range (ultrasound).
I want that if the
distance is > 1000 or =0 the widged must show "Free".
If
distance is >0 and <1000 must show "Occupied".
I have tried to put the AND condition in the formula but the widget treats it as simple text and displays the formula instead of "Free" / "Occupied".
If I simplify the conditions and use only one ad the time such as distance < 1000 it works perfectly:
$value$ < 1000 ? "Occupied" : "Free" This works as you can see in the left.
but if I try to put the complex AND condition it doesn't work anymore and tago displays it as text in the widget (widget on the right)
These are the formula I tried
1.
($value$ < 1000 && $value$
!== 0) ? "Occupied" : "Free"
2.
$value$ > 0
&& $value$ < 1000 ? "Occupied" : "Free"
3.
$value$ > 1000 || $value$ === 0
? "Free" : "Occupied"
4.
$value$ > 1000 && $value$
!== 0 ? "Free" : "Occupied"
Can u please help?