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

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

        private static DateTime GetLastInputTime()
        {
            var lastInputInfo = new LASTINPUTINFO();
            lastInputInfo.cbSize = Marshal.SizeOf(lastInputInfo);
            lastInputInfo.dwTime = 0;

            var envTicks = Environment.TickCount;

            if (!GetLastInputInfo(ref lastInputInfo)) return DateTime.Now;
            var lastInputTick = Convert.ToDouble(lastInputInfo.dwTime);

            var idleTime = envTicks - lastInputTick;
            return idleTime > 0 ? DateTime.Now - TimeSpan.FromMilliseconds(idleTime) : DateTime.Now;
        }
        
        [DllImport("User32.dll")]
        private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);

        [StructLayout(LayoutKind.Sequential)]
        private struct LASTINPUTINFO
        {
            private static readonly int SizeOf = Marshal.SizeOf(typeof(LASTINPUTINFO));

            [MarshalAs(UnmanagedType.U4)]
            public int cbSize;
            [MarshalAs(UnmanagedType.U4)]
            public uint dwTime;
        }

HI, I’ve been looking for a solid service to monitor my windows computers with within home-assistant and the stuff I’ve been reading lately says this is the one to go with. I have a quick question. How can I monitor a specific application on my windows machine and have home-assistant alert me if it crashes? I’ve read the wiki and couldn’t find anything on it.