LAB02-Research / HASS.Agent

Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more.
https://hassagent.lab02-research.org
MIT License
1.56k stars 68 forks source link

Bug: PerformanceCounter not found #355

Closed Blacksimo closed 1 year ago

Blacksimo commented 1 year ago

Describe the bug I was trying to set a PerformaceCounter sensor, so at first i got the list of all counter with either the commands

typePerf.exe -q

or

Get-Counter -ListSet *

i tried a bunch of them but none works, i get the "PerformanceCounter not found" error. Since i tried the suggested command, and it works, and my commands are in italian (so is my OS), i was thinking this could be related.

Misc info (please complete the following information):

Please check what's applicable (multiple answers possible):

Logs 2023-09-16 15:58:45.458 +02:00 [FTL] [SENSORTESTER] Error while testing PerformanceCounter Category: Disco Fisso Counter: Byte letti da disco/sec Instance: _Total Error: PerformanceCounter not found System.Exception: PerformanceCounter not found at HASS.Agent.Shared.HomeAssistant.Sensors.PerformanceCounterSensor..ctor(String categoryName, String counterName, String instanceName, Nullable``1 updateInterval, String name, String id) at HASS.Agent.Functions.SensorTester.TestPerformanceCounter(String categoryName, String counterName, String instanceName)

image
amadeo-alex commented 1 year ago

Hello, The english names for performance counters should work at all times. From what I've been able to check in the code, if the name "is not english" it tries to get the localised name. What exactly are you putting in the sensor config fields? (please list the working english one and italian non-working one)

Blacksimo commented 1 year ago

Solved by getting the list of performance counters in english from the regedit key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter