Battery Computed Attributes help

MrAlphaXCV3 years ago

Hi all. I've a bit of an odd request but I need some advice if this is even possible.
I have a Traccar UI that shows batteryLevel alongside all my trackers, but some of these trackers don't send a batteryLevel or any battery information.
I want it that of the batteryLevel status is Unknown, that it shows 100% instead, can this be done through Computed Attributes and of so, how would this be achieved?

Anton Tananaev3 years ago

Yes, should be possible.

GS3 years ago

Not sure if it's exactly what you expect but try this simple expression: batteryLevel ? batteryLevel : 100

MrAlphaXCV3 years ago

GS - That worked perfectly! Thank you, and thank you Anton :)

Antonio Junior9 hours ago

Greetings!
Could anyone help me please? I would like to know if it is possible to generate an event/notification and have it go to the drawer and event report, if the device has a certain battery level. EX.: batteryLevel <= 40 ? event.lowBattery: null I didn't get to test this expression. Thank you in advance.