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

Hi @nightfever, you’re very welcome :slight_smile:

Alright, let’s see if we can find out why. In Home Assistant, please go to ConfigurationDevices & ServicesDevices, then type the name of your PC. Click on your device, and there should be a list of entities under Sensors. If nothing drive-related is showing here, they’re not arriving in HA properly.

In that case, could you look through HASS.Agent’s logs to see if there are any errors or exceptions? If you’ve used the installer, they’re located in %appdata%\LAB02 Research\HASS.Agent\Logs.

If there are no exceptions or errors showing in the logs, could you also check Home Assistant’s logs? You can find them by going to ConfigurationSettingsLogs.

1 Like

I do receive MQTT disconnect notifications and failed to connect to MQTT. Surprised by this as my MQTT broker is rock solid and configuration is correct.

What topics does HASS.Agent use and does it create these or does the HA part do that? Is this likely a never able to connect to MQTT or a connect but often disconnect later issue. I get a notification about every hour.

That is weird. HASS.Agent uses homeassistant/sensor/{device_name}, you can use a MQTT client to subscribe and see what gets sent.

What broker do you use? Are the sensors working (did they get added in HA) or not at all? Are there any additional messages in HASS.Agent’s logs? Is your PC on the same network as your broker?

1 Like

This is everything in %appdata%\LAB02 Research\HASS.Agent\Logs.
ConfigurationSettingsLogs shows nothing specially related to MQTT or HASS.agent
The mosquitto broker integration shows 1 device with 3 entities: cpu load, last boot and memory usage. No storage sensors.

2022-01-04 16:13:46.267 +01:00 [INF] [LOG] Coderr exception reporting disabled
2022-01-04 16:13:46.267 +01:00 [INF] [PROGRAM] Extended logging disabled
2022-01-04 16:13:47.607 +01:00 [INF] [SETTINGS] Config storage path: C:\Users\AlexRenzo\AppData\Roaming\LAB02 Research\HASS.Agent\Config
2022-01-04 16:13:47.731 +01:00 [INF] [SETTINGS] No config found, storing default settings
2022-01-04 16:14:10.731 +01:00 [INF] [TASK] Launch-on-login task created
2022-01-04 16:24:45.250 +01:00 [INF] [SETTINGS] Configuration stored
2022-01-04 16:24:46.309 +01:00 [INF] [SYSTEM] Application shutting down
2022-01-04 16:24:46.421 +01:00 [INF] [SYSTEM] Application shutdown complete
2022-01-04 16:24:55.464 +01:00 [INF] [LOG] Coderr exception reporting disabled
2022-01-04 16:24:55.464 +01:00 [INF] [PROGRAM] Extended logging disabled
2022-01-04 16:24:56.104 +01:00 [INF] [SETTINGS] Config storage path: C:\Users\AlexRenzo\AppData\Roaming\LAB02 Research\HASS.Agent\Config
2022-01-04 16:24:56.419 +01:00 [INF] [SETTINGS] Configuration loaded
2022-01-04 16:24:56.419 +01:00 [INF] [SETTINGS_QUICKACTIONS] Config not found, no entities loaded
2022-01-04 16:24:56.427 +01:00 [INF] [SETTINGS_COMMANDS] Config not found, no entities loaded
2022-01-04 16:24:56.427 +01:00 [INF] [SETTINGS_SENSORS] Config not found, no entities loaded
2022-01-04 16:24:56.493 +01:00 [INF] [MQTT] Connecting ..
2022-01-04 16:24:56.575 +01:00 [INF] [NOTIFIER] Initializing local API ..
2022-01-04 16:24:56.651 +01:00 [INF] [HASS_API] Home Assistant version: 2021.12.7
2022-01-04 16:24:56.825 +01:00 [INF] [MQTT] Connected
2022-01-04 16:24:56.999 +01:00 [INF] [HASS_API] System connected with http://192.168.1.252:8123
2022-01-04 16:24:58.664 +01:00 [INF] [MQTT] Initial registration completed
2022-01-04 16:24:58.945 +01:00 [INF] [NOTIFIER] API listening on port 5115
2022-01-04 16:28:22.537 +01:00 [INF] [SENSORS] Added single-value sensor: CpuLoad
2022-01-04 16:28:22.584 +01:00 [INF] [SENSORS] Added single-value sensor: MemoryUsage
2022-01-04 16:28:22.584 +01:00 [INF] [SENSORS] Added single-value sensor: LastBoot
2022-01-04 16:28:22.741 +01:00 [INF] [SENSORS] Added multi-value sensor: Storage
2022-01-04 16:28:22.819 +01:00 [INF] [SETTINGS_SENSORS] Stored 4 entities

Edit: nevermind, bug, can reproduce. Will fix for next version.


Looks like it’s properly added. What OS do you use?

I made a small console app that uses the exact same code to enumerate the available disks, could you run it to see if your disks are being recognised?

https://shared.lab02-research.org/StorageSensorTest.zip

Released v2022.1.7.1 that should fix this issue!

Working, thank you very much.

Great :slight_smile: Thanks for the feedback

A wonderful tool, thanks a lot! Worth a hole pot of coffee! :slight_smile:

One feature request comes to mind: the ability to remote control the PC the agent is installed on. E.g. to shut down that PC or to put it to sleep.

That’s already possible. Look into the ‘Commands’ part of the application.

1 Like

Oops! I somehow misread the documentation of the command section and was under the impression it would allow me to trigger the execution of commands on the HA server, not the other way around.

It took me a while to figure out that commands are exposed as switches in HA, but I got it working now :slight_smile:

@SamKr , I may have missed this, but is there an option to influence the entity naming scheme used?

When using more than one agent, it becomes difficult to see which sensor belongs to which PC as they are just getting numbered:

Perhaps the easiest way would be to automatically add the PC name to the entity name? E.g.:

sensor.PCNAME01_cpuload
sensor.PCNAME02_cpuload

Once again, great tool, thank you!

Hi @amplitur, for starters thanks you for your donation! Very kind, should keep me fueled for coding :stuck_out_tongue:

You can already name your sensors when creating them, HASS.Agent pre-fills the field with the sensor’s name. But it’s a good idea to prepend the machine name as well (and give the option to define your own value), will add in the next version!

Thanks @freakshock for replying!

I’m on vacation this week so responses take longer than usual…

Thanks @SamKr !

I didn’t realize that one can change the name of the sensors, the dark grey background of the input field tricked my mind into assuming that this value cannot be changed. Perhaps change the background of the input fields for name and seconds to the same light grey as the “type” field? At least for me, that would be a more intuitive way of indicating that these three fields are input fields where the value can be changed by the user (as opposed to the sensor description field).

Having a configurable pre-fix (default set to the machine name) which would be inserted automatically if defined will be an extra bonus.

Regarding the sensor names: Manually changing the sensor name e.g. to LL2020_sensorname works for all sensors with one exception: the multi-value Network sensor. Even when changing the name to “LL2020_Network” the actual names assigned for the values still all start with "NIC ".

BTW, the parsing for the storage network sensor values doesn’t seem to work correctly in all cases, see examples in screenshot above.

Cheers,
Lutz

Thanks @amplitur for the input, will do :slight_smile:

About the naming; you’re right, will fix. I only see network sensors in your screenshots, no storage sensors, what parsing is going wrong? Or do you mean the addresses? Because those seem ok, they’re sent as a string array which you can in turn parse in Home Assistant.

Sorry, I meant the network sensor values. Agreed, the attribute “dns_addresses” can have multiple values/addresses. Couple of observations:

  • I don’t see a sensor name for sensor.nic_bluetooth_network_connection_dns_addresses displayed in the example above. I am not sure why it’s not being displayed, as the sensor has a name. Most (but not all) of my other NIC dns_addresses and ip_addresses sensors have a similar behaviour, e.g. sensor.nic_bluetooth_network_connection_ip_addresses.

  • Having the name of the attribute as part of the value of the attribute is somewhat redundant, so perhaps instead of assigning the value {“dns_addresses”:[“fec0:0:0:ffff::1%1”,“fec0:0:0:ffff::2%1”,“fec0:0:0:ffff::3%1”]} you could just use [“fec0:0:0:ffff::1%1”,“fec0:0:0:ffff::2%1”,“fec0:0:0:ffff::3%1”] instead?

Anyhow, all of this is just cosmetics :slight_smile:

Hi. Thank you for the great app that works out of box.

Could someone provide an example of WMI query or some manual how it should look? I was trying to make Intel NUC’ LED work with HASS notifications without any luck. And I noticed from the doc that WMI sensor could be a pain. Thank you.

Hi @IvanUA, thanks! Always glad to hear it works on other people’s PC as well as mine :slight_smile:

The WMI querys you refer to are for sensors, so they are designed to fetch values, not set them. In your case, you want to set a value. The easiest way to do this is to make a custom command to launch a powershell script, in which you execute the WMI query.

If you want, I can write an example powershell script you can use. But since I’m away, you’ll have to wait a bit. If you want to try yourself, here’s an example WMI script in C# for your NUC (so it has to be converted to Powershell).

In case you also want to fetch values from your NUC, this site contains some more info.

And I noticed from the doc that WMI sensor could be a pain.

It can, but it can be useful. Just keep an eye on how much CPU HASS.Agent uses, and also Windows’ WMI executable (wmiprvse.exe I think). In some cases WMI can start using lots of CPU, but that can be fixed, so if it does let me know.

I think the sensor names are hidden behind the values, but I’ll have a look when I get back.

Yep kinda redundant, I just like to know what’s in an array, but that can be perfectly inferred from the sensor’s name.

Thanks again for the feedback!

1 Like

HASS.Agent now has a Discord channel. Of course I’ll still be monitoring this thread as well.


@freakshock: I’ve published a beta release that fixes a hotkey bug. If you’re interested, you can try to see if it fixes quickaction hotkeys for you.