It is currently December 3rd, 2021, 7:12 am

Bluetooth Battery Level Meter? Skin/Plugin

Report bugs with the Rainmeter application and suggest features.
LUCASLUCASLUCAS
Posts: 1
Joined: December 8th, 2020, 1:29 pm

Bluetooth Battery Level Meter? Skin/Plugin

Post by LUCASLUCASLUCAS »

Hello everyone. I've had a long hard look around the Internet and forums and I haven't seen anything about Bluetooth Device Battery Level Monitoring in Rainmeter.

Now that Windows 10 has support to read battery levels for Bluetooth devices (Settings > Devices)
I was wondering if anyone has or is thinking about creating a plugin/skin that can monitor this data.
This would be a super handy tool now that wireless technology is more popular than ever.
It would be great to track Headphones, Mouse, Game controllers, Keyboards, Speakers, etc.
User avatar
Yincognito
Rainmeter Sage
Posts: 4108
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Bluetooth Battery Level Meter? Skin/Plugin

Post by Yincognito »

LUCASLUCASLUCAS wrote: December 8th, 2020, 1:38 pm Hello everyone. I've had a long hard look around the Internet and forums and I haven't seen anything about Bluetooth Device Battery Level Monitoring in Rainmeter.

Now that Windows 10 has support to read battery levels for Bluetooth devices (Settings > Devices)
I was wondering if anyone has or is thinking about creating a plugin/skin that can monitor this data.
This would be a super handy tool now that wireless technology is more popular than ever.
It would be great to track Headphones, Mouse, Game controllers, Keyboards, Speakers, etc.
A bit late with the reply, but if Windows supports it, you should investigate if WMIC or PowerShell's GWMI can output those battery levels. If they do, you don't need a plugin for it, as both the Command Prompt's WMIC and the Powershell's GWMI can be executed via the RunCommand plugin in Rainmeter (check the WMIC example at the bottom of the RunCommand plugin's page for a hint on how to use it). The rest is simply about looking for the WMI class that provides the desired data (assuming that it does, of course).

An example of a RunCommand measure getting the output of PowerShell's GWMI would look like this:

Code: Select all

[MS_RunCommand_BatteriesInfo]
Measure=Plugin
Plugin=RunCommand
Program=powershell
Parameter=-command gwmi -namespace 'root/wmi' -class BatteryStatus -filter \"InstanceName like '%PNP0C0A%'\" | select Active,@{n='ChargeRate';e={[string][math]::round($_.ChargeRate/1,2)}},@{n='DischargeRate';e={[string][math]::round($_.DischargeRate/1,2)}},InstanceName | sort InstanceName | format-list
State=Hide
OutputType=ANSI
Timeout=5000
DynamicVariables=1
This is, of course, for a laptop battery, but if the command supports other kind of batteries, the approach would be similar (except the class, obviously).