HASS.Agent: Windows client to receive notifications, use commands, sensors, quick actions and more!

When I set up a wmi query with Scope: .\ROOT\OpenHardwareMonitor and
Query: SELECT value FROM Sensor WHERE Name LIKE “%CPU Core%” AND SensorType = “Temperature” I get an error when activating it:

2022-04-07 15:09:42.415 +02:00 [FTL] [SENSORSMANAGER] Error while storing: Der Parameter ist ungültig. 
System.Management.ManagementException: Der Parameter ist ungültig. 
   at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
   at System.Management.ManagementPath.CreateWbemPath(String path)
   at System.Management.ManagementPath..ctor(String path)
   at System.Management.ManagementScope..ctor(String path)
   at HASSAgent.Shared.Models.HomeAssistant.Sensors.WmiQuerySensor..ctor(String query, String scope, Nullable`1 updateInterval, String name, String id)
   at HASSAgent.Settings.StoredSensors.ConvertConfiguredToAbstractSingleValue(ConfiguredSensor sensor)
   at HASSAgent.Sensors.SensorsManager.StoreAsync(List`1 sensors, List`1 toBeDeletedSensors)

What’s going wrong?

Hi @nightfever,

Can you please make sure your scope looks like this (note the double backslash at the beginning):

\\.\ROOT\OpenHardwareMonitor
1 Like

Hi @nightfever,

Sidenote, if I were you I would replace “%CPU Core%” with “%CPU Package%” as based on your screenshot from Open Hardware Monitor, CPU Package is showing the highest temperature accross all cores, so it should give you a more accurate temperature.

2 Likes

Great, thanks. It was the missing double backslash.
But temperature is delivering ‘unknown’, load is okay

Try “Temperatures”, plural, as that’s what shows on OpenHardwareMonitor.

If anyone’s interested in a very lightweight method of controlling a PC with python + MQTT I posted my script here:

1 Like

Nice one! I’ve been asking the devs for a central place to collect all clients, so users can pick the one they like for their OS of choice, but they don’t want it unfortunately.

Tried that. Powers delivers unknown as well.
I’ll stay with the Openhardwaremonitor integration.

Hi @nightfever,

I reproduced the error and it’s actually a bug in HASS.Agent - sorry. Will get it fixed with next beta (coming this week) and let you know.

Scratch that, I actually think we’ve both been making the same mistake. But to be fair, the UI needs to be more clear.

Can you make sure you entered the query in the first field, and the scope in the second:

I switched those, which resulted in the same error as you.

These are the values I used:

SELECT value FROM Sensor WHERE Name LIKE "%CPU Core%" AND SensorType = "Temperature"

\\.\ROOT\OpenHardwareMonitor

I’ll add a test and warning dialog in the next version.

1 Like

Your query is working, thanks.

Odd. It is very hard to find this! As you saw I ended up making a python script first but I’m gonna try your agent soon since my python script needs a bunch of work to make it solid.

Have you got steps to build your agent from source in tinfoilhat mode? :slight_smile:

Yea it’d be great if there were a centralised place that lists all HA companion apps.

Not yet. It’s easy, but I’ll add a wiki page with manual build- & install steps. I’ll let you know when it’s done.

2 Likes

Hey @VNRARA,

What you’re describing is part of the reason I built this; all other options were either bugged (and not getting fixes/updates) or missing features.

HASS.Agent will have bugs (I develop this in my spare time, and every complex application has them) but I always do my best to fix them soon after getting reported, depending on severity. Its development has been going steady for the past year or so, with a public release 6 months ago and updates every few weeks after.

If you have any questions or encounter problems, you can join us on Discord, open a GitHub ticket or just post them here. There’s also a wiki with a lot of troubleshooting/examples.

But of course I hope it’ll just work for you!

I wrote a short instruction on how to build from scratch:

Afterwards, you can use this to install and configure your build:

3 Likes

I just discovered your plugin and I just have to write here and say this is an awesome job you have done! This application is already so good and has a lot of potential. Super easy to setup as well.

1 Like

Thank you! That’s really nice to hear :heart:

1 Like

Thank you! Will try it out

Great work man,
I was just looking the best option for a windows integration and this has come for the win!

I have one question - how does the last active sensor works?
Is it the last time I moved the mouse or pressed a key in the keyboard?
It seems like it’s updating to the current time even if don’t do any of those 2 actions

Hi @idan37s,

Thanks, glad you like it! The ‘last active’ sensor works by using the same Windows-provided metric that for instance screensavers use. It’s basically what you mention; keyboard and mouse input.

Are you perhaps using a mouse emulating tool to prevent your machine from going to sleep or something like that?

No nothing special regarding mouse or keyboard is being used.
do you mind pointing me to the specific .Net API being used with this sensor?
I will try to debug it