It is currently March 19th, 2024, 10:34 am

UsageMonitor in battery skin

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 6949
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

UsageMonitor in battery skin

Post by Yincognito »

I'm going to post this here, because I want it to have more visibility and I noticed that other questions/issues with UsageMonitor don't seem to get proper attention (example: here or here - interestingly, the latter signalling pretty much same same near 0% instances issue I was talking about here with jsmorley, but...5 months ago!). Enough with the off-topic stuff, it's partially the effect of annoyance caused by the (re/appearance of the) issue below.

Test skin:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

---Measures UsageMonitor---

[MS_UsageMonitor_BatteryDischargeRate]
Group=BatteryRateGroup
Measure=Plugin
Plugin=UsageMonitor
Category=BatteryStatus
Counter=DischargeRate
Name=ACPI\PNP0C0A\1_0

[MS_UsageMonitor_BatteryChargeRate]
Group=BatteryRateGroup
Measure=Plugin
Plugin=UsageMonitor
Category=BatteryStatus
Counter=ChargeRate
Name=ACPI\PNP0C0A\1_0

[MT_Battery]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text="Battery Discharge Rate = [MS_UsageMonitor_BatteryDischargeRate:]#CRLF#Battery    Charge Rate = [MS_UsageMonitor_BatteryChargeRate:]"
DynamicVariables=1
This displays the battery's charge/discharge rates only when one of the following circumstances happen:
- Rainmeter is installed and ran right after installation
- Rainmeter is executed as administrator
Otherwise, it only displays 0 on both charge and discharge rates.

I thought I got away from this issue with the newest betas, but I was apparently wrong - probably because I only checked if the values are displayed right after installing+running immediately afterwards, otherwise disregarding things as I keep my laptop on AC power anyway and I was busy with tweaking other skins in the meantime.

Do you have any solution to this? Of course, if you are able to replicate it. Just replace ACPI\PNP0C0A\1_0 with the name of your battery instance in Permon.msc (if you have a battery, that is). I'm using the latest Rainmeter beta on Windows 10 Enterprise v1803, on a UAC disabled administrator account - I already specified this on another topic, but just in case you need the specs, there you have them.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2579
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: UsageMonitor in battery skin

Post by SilverAzide »

I can't get UsageMonitor OR PerfMon to return anything but zeroes for all Battery Status counters.... O.O
I tried it both with and without spaces (your example does not have spaces that are used in the names).
User avatar
Yincognito
Rainmeter Sage
Posts: 6949
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: UsageMonitor in battery skin

Post by Yincognito »

SilverAzide wrote: January 4th, 2019, 11:28 pmI can't get UsageMonitor OR PerfMon to return anything but zeroes for all Battery Status counters.... O.O
Irrespective of running as administrator or not? Hmm...now that's intriguing. Should I feel 'lucky' that it works for me when running Rainmeter as administrator?! By PerfMon you mean the .msc/.exe or the Rainmeter plugin with the same name (the deprecated one)?
SilverAzide wrote: January 4th, 2019, 11:28 pmI tried it both with and without spaces (your example does not have spaces that are used in the names).
Now that's really interesting. I only know of no spaces in Category, Counter and Name options for the batterry. Could you please tell me which option requires spaces in your case? So that I can add this case in my battery skin (assuming it will eventually work for those rates), in order to be fully compatible with the different environments...

I say the latter because in terms of compatibility, I tried to "cover all the bases" in my actual skin (not the simplified sample posted above) - even for some pre-Win NT cases 8-) , however futile those cases might look like now:

Code: Select all

[Variables]
@IncludeVariables=#ROOTCONFIGPATH#Settings\Variables.inc
BatteryInstancePrefix=ACPI\PNP0C0A\
BatteryInstanceRegKeyPrefixPreWindowsNT=Enum\ACPI\*PNP0C0A\
BatteryInstanceRegKeyPrefixPostWindowsNT=SYSTEM\CurrentControlSet\Enum\ACPI\PNP0C0A\

[Rainmeter]
@IncludeRainmeter=#ROOTCONFIGPATH#Settings\Rainmeter.inc

[Styles]
@IncludeStyles=#ROOTCONFIGPATH#Settings\Styles.inc

[Metadata]
Name=Battery
Description=Shows various battery details like status, percent, lifetime and charge/discharge rate. It changes colour according to the % of lifetime left and its AC connection. Does not require any monitoring software to be installed and running.
Instructions=Hovering on the title shows additional information. Left clicking on the title launches Power Options.
Version=1.3.0
Author=Yincognito
License=Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

---Measures Rainmeter---

[MS_Rainmeter_ResetBatteryInstance]
Measure=Calc
Formula=1
UpdateDivider=#DetectionUpdateDivider#
IfCondition=1
IfTrueAction=[!SetOptionGroup BatteryRateGroup Name ""]
IfConditionMode=1

---Measures Registry---

[MS_Registry_BatteryInstance00000000ServicePreWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPreWindowsNT#00000000
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#0_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance00000001ServicePreWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPreWindowsNT#00000001
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#1_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance00000002ServicePreWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPreWindowsNT#00000002
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#2_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance0ServicePreWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPreWindowsNT#0
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#0_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance1ServicePreWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPreWindowsNT#1
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#1_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance2ServicePreWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPreWindowsNT#2
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#2_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance00000000ServicePostWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPostWindowsNT#00000000
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#0_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance00000001ServicePostWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPostWindowsNT#00000001
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#1_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance00000002ServicePostWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPostWindowsNT#00000002
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#2_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance0ServicePostWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPostWindowsNT#0
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#0_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance1ServicePostWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPostWindowsNT#1
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#1_0"]
IfMatchMode=1

[MS_Registry_BatteryInstance2ServicePostWindowsNT]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=#BatteryInstanceRegKeyPrefixPostWindowsNT#2
RegValue=Service
UpdateDivider=#DetectionUpdateDivider#
IfMatch=(?i)CmBatt
IfMatchAction=[!SetOptionGroup BatteryRateGroup Name "#BatteryInstancePrefix#2_0"]
IfMatchMode=1

---Measures UsageMonitor---

[MS_UsageMonitor_BatteryDischargeRate]
Group=BatteryRateGroup
Measure=Plugin
Plugin=UsageMonitor
Category=BatteryStatus
Counter=DischargeRate
Name=ACPI\PNP0C0A\1_0

[MS_UsageMonitor_BatteryChargeRate]
Group=BatteryRateGroup
Measure=Plugin
Plugin=UsageMonitor
Category=BatteryStatus
Counter=ChargeRate
Name=ACPI\PNP0C0A\1_0

---Measures Power---

[MS_Power_BatteryACLine]
Measure=Plugin
Plugin=PowerPlugin
PowerState=ACLine

[MS_Power_BatteryStatus]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Status

[MS_Power_BatteryLifetime]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Lifetime
Format=%H:%M
RegExpSubstitute=1
Substitute="^Unknown$":"Indef."

[MS_Power_BatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent

---Measures Rainmeter---

[MS_Rainmeter_BatteryLifetime]
Measure=String
String=[MS_Power_BatteryLifetime]
RegExpSubstitute=1
Substitute="^(\d{2}):(\d{2})$":" \1 h \2 m","^Indef.$":" Indefinite"
DynamicVariables=1

[MS_Rainmeter_BatteryDischargeRate]
Measure=Calc
Formula=(MS_UsageMonitor_BatteryDischargeRate/1000)
RegExpSubstitute=1
Substitute="^(.*)$":"      \1","^.*(.{6})$":"\1"," ":"  "

[MS_Rainmeter_BatteryChargeRate]
Measure=Calc
Formula=(MS_UsageMonitor_BatteryChargeRate/1000)
RegExpSubstitute=1
Substitute="^(.*)$":"      \1","^.*(.{6})$":"\1"," ":"  "

[MS_Rainmeter_BatteryPercent]
Measure=Calc
Formula=MS_Power_BatteryPercent
RegExpSubstitute=1
Substitute="^(.*)$":"  \1","^.*(.{3})$":"\1"," ":"  "
IfCondition=(MS_Power_BatteryPercent<15) && (MS_Power_BatteryACLine=0)
IfTrueAction=[!SetOptionGroup BatteryGroup FontColor #WarningTextColor#]
IfCondition2=(MS_Power_BatteryPercent<15) && (MS_Power_BatteryACLine=1)
IfTrueAction2=[!SetOptionGroup BatteryGroup FontColor #NoticeTextColor#]
IfCondition3=(MS_Power_BatteryPercent>=15) && (MS_Power_BatteryACLine=0)
IfTrueAction3=[!SetOptionGroup BatteryGroup FontColor #DisabledTextColor#]
IfCondition4=(MS_Power_BatteryPercent>=15) && (MS_Power_BatteryACLine=1)
IfTrueAction4=[!SetOptionGroup BatteryGroup FontColor #EnabledTextColor#]
IfCondition5=(MS_Power_BatteryStatus=0)
IfTrueAction5=[!SetOption MT_Power_BatteryRate Text "Absent"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: Absent"]
IfCondition6=(MS_Power_BatteryStatus=1)
IfTrueAction6=[!SetOption MT_Power_BatteryRate Text "Charging"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: Charging"]
IfCondition7=(MS_Power_BatteryStatus=2)
IfTrueAction7=[!SetOption MT_Power_BatteryRate Text "Critical"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: Critical"]
IfCondition8=(MS_Power_BatteryStatus=3)
IfTrueAction8=[!SetOption MT_Power_BatteryRate Text "Low"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: Low"]
IfCondition9=(MS_Power_BatteryStatus=4)
IfTrueAction9=[!SetOption MT_Power_BatteryRate Text "High"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: High"]
IfCondition10=(MS_UsageMonitor_BatteryDischargeRate>0)
IfTrueAction10=[!SetOption MT_Power_BatteryRate Text "-[MS_Rainmeter_BatteryDischargeRate:3] W"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: [MS_Rainmeter_BatteryDischargeRate:3] W Discharge Rate"]
IfCondition11=(MS_UsageMonitor_BatteryChargeRate>0)
IfTrueAction11=[!SetOption MT_Power_BatteryRate Text "[MS_Rainmeter_BatteryChargeRate:3] W"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: [MS_Rainmeter_BatteryChargeRate:3] W Charge Rate"]
IfCondition12=(MS_UsageMonitor_BatteryDischargeRate>2000000000) || (MS_UsageMonitor_BatteryChargeRate>2000000000)
IfTrueAction12=[!SetOption MT_Power_BatteryRate Text "Indefinite"][!SetOption MT_Rainmeter_Battery ToolTipTitle "Battery: Indefinite charge rate"]
IfConditionMode=1
DynamicVariables=1

---Meters---

@IncludeBackground=#ROOTCONFIGPATH#Settings\Background.inc

[MT_Rainmeter_Battery]
Meter=STRING
MeterStyle=STitleColText
Text="BATT"
ToolTipTitle=
ToolTipText="Lifetime    [MS_Rainmeter_BatteryLifetime]   ★   Charged          [MS_Rainmeter_BatteryPercent] %"
LeftMouseUpAction=[control powercfg.cpl]
DynamicVariables=1

[MT_Power_BatteryPercent]
Meter=STRING
MeterStyle=SPrimaryColText
MeasureName=MS_Power_BatteryPercent
NumOfDecimals=2
Text="%1 %"

[MT_Power_BatteryLifetime]
Group=BatteryGroup
Meter=STRING
MeterStyle=SSecondaryColText
MeasureName=MS_Power_BatteryLifetime
Text="%1"

[MT_Power_BatteryRate]
Group=BatteryGroup
Meter=STRING
MeterStyle=STertiaryColText
Text="Steady"
User avatar
SilverAzide
Rainmeter Sage
Posts: 2579
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: UsageMonitor in battery skin

Post by SilverAzide »

Yincognito wrote: January 4th, 2019, 11:52 pm Irrespective of running as administrator or not? Hmm...now that's intriguing. Should I feel 'lucky' that it works for me when running Rainmeter as administrator?! By PerfMon you mean the .msc/.exe or the Rainmeter plugin with the same name (the deprecated one)?
I guess you should feel lucky, LOL! :lol: By PerfMon, I did mean the deprecated plugin. The Performance Monitor app shows the values properly.
Yincognito wrote: January 4th, 2019, 11:52 pm Now that's really interesting. I only know of no spaces in Category, Counter and Name options for the batterry. Could you please tell me which option requires spaces in your case?
Sorry for the confusion! What I meant about the spaces was this, as seen in the screenshots... the names used in Performance Monitor have spaces, so I assumed that the PerfMon plugin (and UsageMonitor) needed to match. But as I said, I got the same results either way (just zeroes)...
Image1.jpg
Image2.jpg
For my own battery skin, I wrote my own plugin (which just uses WMI) to get the charge/discharge rate... so I cheated. ;-)
(The WMI management objects and etc. don't have spaces, as you mentioned.)
User avatar
Yincognito
Rainmeter Sage
Posts: 6949
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: UsageMonitor in battery skin

Post by Yincognito »

SilverAzide wrote: January 5th, 2019, 12:37 amI guess you should feel lucky, LOL! :lol: By PerfMon, I did mean the deprecated plugin. The Performance Monitor app shows the values properly.
Well, then I want to feel lucky all the way - to have it working by running the 'normal' way as well, not just as an administrator. :D
SilverAzide wrote: January 5th, 2019, 12:37 amSorry for the confusion! What I meant about the spaces was this, as seen in the screenshots... the names used in Performance Monitor have spaces, so I assumed that the PerfMon plugin (and UsageMonitor) needed to match. But as I said, I got the same results either way (just zeroes)...

For my own battery skin, I wrote my own plugin (which just uses WMI) to get the charge/discharge rate... so I cheated. ;-)
Thanks for the screenshot, it helps. But I can't really understand why you have them with spaces - I mean you're on Windows 10 as well, are you not? It doesn't seem 'normal' for one Windows to have them with spaces and another without, it goes against every ounce of similar standards, compatibility, and so on - imagine you would like to query the workstations in a network environment for this, it doesn't feel alright to have such differences between (presumably) the same OS on different computers...

Why did you write your own plugin for this? WMI is quite accessible through RunCommand plugin. It might need admin rights (not sure about this though), but you can already get data from it without another plugin to do what is already possible. Maybe I'm missing something here?!

I'm using WMI through RunCommand just for the things I can't get any other way: physical RAM, pagefile files, physical disk data. I don't like to depend too much on it, as some regular users could have (potential, I'm just guessing here) issues running the WMI services...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2579
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: UsageMonitor in battery skin

Post by SilverAzide »

Yincognito wrote: January 5th, 2019, 12:56 am Thanks for the screenshot, it helps. But I can't really understand why you have them with spaces - I mean you're on Windows 10 as well, are you not? It doesn't seem 'normal' for one Windows to have them with spaces and another without, it goes against every ounce of similar standards, compatibility, and so on - imagine you would like to query the workstations in a network environment for this, it doesn't feel alright to have such differences between (presumably) the same OS on different computers...
Yep, I'm on Win 10 as well. The WMI objects don't have spaces, but the Performance Monitor seems to use them. :confused:

By the way, in case it matters I tried escaping the battery instance name (i.e., "ACPI\\PNP0C0A\\1_0")... it doesn't help.
Yincognito wrote: January 5th, 2019, 12:56 am Why did you write your own plugin for this? WMI is quite accessible through RunCommand plugin. It might need admin rights (not sure about this though), but you can already get data from it without another plugin to do what is already possible. Maybe I'm missing something here?!

I'm using WMI through RunCommand just for the things I can't get any other way: physical RAM, pagefile files, physical disk data. I don't like to depend too much on it, as some regular users could have (potential, I'm just guessing here) issues running the WMI services...
I wrote my own plugin mainly because I didn't like the idea of using RunCommand at 1 second intervals to get WMI data like charge rate, discharge rate, and voltage. Seemed too hacky and fragile to me, so I just used code. (Also, at the time I had a laptop with 2 batteries, and I wanted to detect when the batteries switched over, and it was a lot easier to do this with code.) I do use RunCommand a lot to get stuff that's static.
User avatar
Yincognito
Rainmeter Sage
Posts: 6949
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: UsageMonitor in battery skin

Post by Yincognito »

SilverAzide wrote: January 5th, 2019, 1:32 amYep, I'm on Win 10 as well. The WMI objects don't have spaces, but the Performance Monitor seems to use them. :confused:
Yeah, I knew that, there's no confusion there - one is a DOS-like command, the other is a Windows application, so it's natural to treat spaces differently. What I meant was that it seems wrong to have different names for something within the same application, on the same OS.
SilverAzide wrote: January 5th, 2019, 1:32 amBy the way, in case it matters I tried escaping the battery instance name (i.e., "ACPI\\PNP0C0A\\1_0")... it doesn't help.
I could have saved you from the effort, it was one of the first things I tried - with the same result. :lol: This shouldn't be required however - the 'old' PerfMon plugin was working just fine for this task, before my 'upgrade' to UsageMonitor. I might be wrong, but I have the impression that UsageMonitor was a little rushed to be made "official", based on just the performance gains. I don't know how the plugin developer achieved it, but I also have the feeling that those lacking close to "0% usage" processes that are left out of the plugin output contribute quite a bit to the performance gain. If that's true and I'm not being stupid here, then this is also some kind of clever 'cheat', IMHO. :???:
SilverAzide wrote: January 5th, 2019, 1:32 amI wrote my own plugin mainly because I didn't like the idea of using RunCommand at 1 second intervals to get WMI data like charge rate, discharge rate, and voltage. Seemed too hacky and fragile to me, so I just used code. I do use RunCommand a lot to get stuff that's static.
Oh, I see. Too bad you can't "keep" a CMD/CONHOST process active, as a shell for the WMI calls, so instead of using the plugin every second to just execute WMIC within that existing process. Or maybe you can? Anyway, I used another trick for the calls to RunCommand/WMIC (was trying to avoid the UpdateDivider=-1 way): run them only on mouseover. Granted, my skins were designed for this (tooltips for extra info and all) and the data was more or less static (at least compared to yours), but this both updates and runs only when needed, with the very small drawback of some milliseconds of delay until the data is displayed in the tooltip the very first time (a delay that I actually like, it looks like it's "thinking about it" :lol: )...
User avatar
Yincognito
Rainmeter Sage
Posts: 6949
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: UsageMonitor in battery skin

Post by Yincognito »

Update: I take back my initial impression, this is not just a UsageMonitor plugin issue. It happens for the 'old' PerfMon plugin and the NomFerp one as well. The (debug mode) log says 'Could not find a category called BatteryStatus', when Rainmeter runs normally. When executed as an administrator, it works perfectly fine, in all 3 plugins (UsageMonitor, PerfMon and NomFerp).

Unless all 3 plugins use the same method of getting data (which I doubt...although they might use the same privileges, if any), this is not a plugin issue, but rather something about either Windows or Rainmeter.

SilverAzide noted that he uses WMI in his plugin to successfully get this data, so, unless all 3 plugins also use WMI but without the required privileges and the SilverAzide one has some kind of elevated running mode, it doesn't look like it's a privilege thing concerning WMI either.

I'll further investigate the issue, but in the meantime, SilverAzide, could you provide a link to your 64-bit version of your plugin, to see if it works for me? Assuming, of course, that you didn't hardcode Battery Status (with spaces) in your DLL, so that it can work with BatteryStatus (no spaces) and the other no spaces names used to query these things in my case. By the way, I tried WMIC Path Win32_Battery Get BatteryStatus /Format:List and it doesn't have charge/discharge rates available to display - are these only available programatically? O.O
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: UsageMonitor in battery skin

Post by rxtd »

Yincognito wrote: January 5th, 2019, 4:01 pm(UsageMonitor, PerfMon and NomFerp).

Unless all 3 plugins use the same method of getting data (which I doubt
All 3 plugins simply connect to Performance Monitor and request data from it, it's just different ways of how they process that data.
User avatar
Yincognito
Rainmeter Sage
Posts: 6949
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: UsageMonitor in battery skin

Post by Yincognito »

rxtd wrote: January 5th, 2019, 5:24 pm All 3 plugins simply connect to Performance Monitor and request data from it, it's just different ways of how they process that data.
Well, I investigated things a little further, and it seems they also use some WMI calls (surprise, surprise). I have 4 errors repeating themselves in the Application event log, each time I run Rainmeter "normally" (aka not as an administrator) with a UsageMonitor skin active (not only the Battery one, but each of the 5 skins I use UsageMonitor in!!!):

1. Perflib error: The Open Procedure for service "BITS" in DLL "C:\Windows\System32\bitsperf.dll" failed. Performance data for this service will not be available. The first four bytes (DWORD) of the Data section contains the error code.
2. Perflib error: The Open Procedure for service "MSDTC" in DLL "C:\Windows\system32\msdtcuiu.DLL" failed. Performance data for this service will not be available. The first four bytes (DWORD) of the Data section contains the error code.
3. PerfNet error: Unable to open the Server service performance object. The first four bytes (DWORD) of the Data section contains the status code.
4. Perflib error: The Open Procedure for service "WmiApRpl" in DLL "C:\Windows\system32\wbem\wmiaprpl.dll" failed. Performance data for this service will not be available. The first four bytes (DWORD) of the Data section contains the error code.

ZIP archive with the Event Log errors (I cleared the Event Log beforehand, for better clarity): Notice the 'wmi' parts in the 4th error description.
Note: While trying to debug the issue, I also granted myself (and then everyone) access to Performance counters and logs in Windows 10 user groups, like described here (I thought it would solve the issue, but it didn't). I did this because of the Rainmeter log error mentioned in my previous reply on this topic.
Post Reply