Web manager: meaning of "charging" icons

ildar2 years ago

Hello!
Using Traccar with a few devices (Android, iOS) & demo3 server.
In a Web interface for each device a battery icon is displayed.
Some of these icons are with a "charging" mark - like these devices are charging now.
But for some devices which are really charging now - this "charging" mark is not displayed.
Some time ago I registered a Github issue about adding a "battery charging" attribute (https://github.com/traccar/traccar-client-ios/issues/73), but I do not think it is implemented.
Could you explain a meaning of this "charging" mark?

Anton Tananaev2 years ago

Charging should mean that the internal battery is charging.

ildar2 years ago

Does it mean the this flag (https://github.com/traccar/traccar-client-ios/issues/73) is added?
Then why for some devices which are charging IRL this flag is not set?

Anton Tananaev2 years ago

Are you comparing same platforms? Same versions? And both are charging?

ildar2 years ago

Probably I am not getting your answer about "platform".

I am using web interface as manager.
All devices are connected to demo3.

One hour ago 2 devices were marked as "charging" - and they were charging IRL:
-- iPhone 12 (the latest iOS)
-- iPhone 6S+ (iOS 12.5.x)
At the same time also 4 devices were charging IRL:
-- iPhone 5S (iOS 12.5.x) - 2 similar devices
-- iPad Air (iOS 15.x)
-- old Samsung P6800 tablet (Android 4.x - so great that your client works there!!!!)

Currently 2 devices are marked as "charging" - and they were charging IRL:
-- iPhone 6S+ (iOS 12.5.x) (80%)
-- iPad Air (iOS 15.x) (38%)
At the same time also 1 device is charging IRL:
-- iPhone 5S (iOS 12.5.x) (90%)

I switched on/off traccar client on devices which are not marked as "charging", refreshed web interface by F5 (Chrome) - no changes.
Can the "charging" flag depend on a value of battery_level?

Anton Tananaev2 years ago
ildar2 years ago

Looking at this code:

charging: device.batteryState == .charging || device.batteryState == .full

Currently for iPhone 5S (which is charging IRL) it is displayed "97%" in web interface, no "charging" mark is displayed.
I guess that the "device.batteryState" is reported by iOS; is it possible that iOS does not report it properly?

Anton Tananaev2 years ago

Those values are reported directly by iOS.

ildar2 years ago

Is there any way to intercept these "charging" flag reported by iOS?
Right now I connected to a charger another iPhone 5S (76%), and again there is no "charging" mark in web-interface.

Started iOS Traccar manager, same - no "charging" mark.
Could be an issue in iOS; but same iOS 12.5.x is on iPhone 6S+ - and there the "charging" mark was displayed in web.

Btw, Life360 is reporting "charging" properly on these old iPhones, also in that old Samsung P6800 (Android 4; 2 years ago Life360 stopped working on that Android version but all battery data were reported properly when it was working).
It is absolutely not to offend you, I am just trying to find out a reason of my glitches.

Anton Tananaev2 years ago

What do you mean by intercepting? We're already using the flag.

ildar2 years ago

By "intercepting" I mean "track this flag by me and check if it really reported by iOS to Traccar client".
I am not an expert in iOS, but from my own experience with other systems - if Traccar client gets a wrong status from iOS, 2 reasons are possible:
-- iOS reports it not correct;
-- iOS reports it in several places (or by different ways), and in some places it is reported wrong, in some places it is reported right.
I think that the 2nd situation is possible since other applications like Life360, Home Assistant companion app report "charging" properly, almost in a real time.
Again, not blaming Traccar at all, most probably there is some confusion inside iOS.

Anton Tananaev2 years ago

If you find a better way of getting this information let us know and we'll update the app.

ildar2 years ago

Seems you understood me in a wrong way.

Anton Tananaev2 years ago

Why?

ildar2 years ago

Since the only thing you could say is "if you know how to do it bettr - tell us".
No need to brush people off if they are in a rather polite manner trying to find out reasons of failure & make your product better if possible.
I was asking for a help since you are an expert in iOS, I myself (as a dev since 1997 but never dealt with mobile platforms) may only politely propose possible methods to investigate.
As I already said - probably there is some issues with iOS reporting the "charging" data since sometimes it is reported properly, sometimes not; and some other apps reporting properly too. For instance, same iOS 12.5.x probably behaves differently with batteries on different phones - so we get a proper readings from iPhone 6S+ & wrong readings from two iPhone 5S.