SilverAzide wrote: ↑
January 7th, 2019, 12:18 pm
Arrgh, I don't recall exactly, sorry. I think PowerOnline
is true only when the machine is plugged in/charging. Active
I'm not sure about; I think I found it to be unreliable.
I just discovered something else today... my laptop docking station is acting like it has a battery (it doesn't). When querying with WMIC, the ID is ACPI\PNP0C0A\2_0
(if it matters). Active
is TRUE (always) and PowerOnline
is TRUE or FALSE depending on if the dock is plugged in or not (the dock will run unplugged, I assume pulling power from the laptop battery). Powershell and the Win32_Battery class (i.e., "gwmi Win32_Battery") shows only the one "real" battery and the Availability
attribute tells you all sorts of things (my values are "2" when plugged in and "3" when running on battery). The BatteryStatus
attribute is as expected ("2" is on-line, "1" is discharging, etc.).
The one trick I use to determine which battery is the active one (which I use in my plugin) is to look at the Voltage
attribute. Only one battery will have a value >0 if the system is running on battery, and that will be the active one. If all battery voltages are zero, you're on AC.
So, what you're saying is that you found no way of telling whether batteries are physically
in their "slot", but you use the Voltage
property to find out if a battery is the "active" (i.e. "in use") one - am I getting this right? Well, that changes a little bit things for me, but not too much - I could just replace the Active
property with the Voltage
one to display the "in use" message to the user, but... I don't know if you are entirely correct in your assumptions at the end of your reply:
The first screenshot is on AC power, the second is on battery (there were about 4 Win32_Battery
properties that didn't fit in the screenshots, but they were either "" or the default values, so the images are relevant as they are). At the top are my skins, with the battery one showing the tooltip with the active status and the charge/discharge rate (or the lack of it). As you can see, the Voltage
property is greater than 0 whether the laptop is on AC power (with the battery in the slot) or battery power. I don't know where this leads us, but I just thought you should know what happens in my case, maybe you'll find it useful.
Me, I could just leave things as they are now (nice WMIC data shown on demand, aka mouseover, refreshed every 20 seconds, which is about the frequency of charge/discharge rates anyway, in my case), or try to figure out with you what property we can use to get the "in use" status of a battery (if the Voltage
property will turn out to be a 'false prophet' on this, that is).
P.S. Oh, and one more thing: I'm not sure I can correlate the WMIC's BatteryStatus
instances with the Win32_Battery
ones, since they display different battery IDs (InstanceName
, and DeviceID
You do not have the required permissions to view the files attached to this post.