@bverkron and any others that installed the last beta: it didn’t include the latest code and -ironically- ‘notify on beta updates’ doesn’t yet work. If you have it installed, please update manually last one time. Sorry!
Thank you.
I figured out how to create a template switch to turn on and off the pc using wake_on_lan integration. I also created a custom command to open multiple webpages in chrome incognito. Waiting on the temp sensor now
Had to park my work on this for now as life has been busy. Not sure when I will have time to get to this again but looking forward to it whenever it happens. Thank you!
@duceduc: I’ve published a beta which includes scopes for wmi, you can download it here - so you can now fetch sensors from AIDA64 or openhardwaremonitor.
The release notes include an example on how to get CPU temp from openhardwaremonitor (you have to have that running in the background).
@bverkron: no worries of course, best of luck
I’ve published a beta which includes scopes for wmi, you can download it here - so you can now fetch sensors from AIDA64 or openhardwaremonitor.
Thanks. How can I get it to display °C ?
You can do that with a template sensor in HA, but being able to define the unit of measurement from within HASS.Agent is actually a really good idea - I’ll add it
Question/request: Would a sensor that shows whether a monitor/display is powered on or off?
I don’t think Windows knows whether a monitor is powered off (by the physical power button). Or do you mean turned off by Windows?
By physical button yeah. After some searching, I found the following information which may help:
I’ve tested these and some other samples, but they only detect when Windows puts the monitor in sleep mode, not when you toggle the power button yourself. Really don’t think Windows gets notified of that
Finally getting around to setting this us as we’ve just built my middle son’s first gaming PC. So far it’s FANTASTIC!
Submitted one issue related to the agent setup and have a suggestion about the logged-users feature.
In IoTLink the ...current_username
value was the username of the user who is currently logged in, i.e. actively logged into a desktop sessions. HASS.Agent on the other hand seems to report all users who are logged in whether or not they’re “actively” logged in and viewing the desktop session. For my use case this will not work as my automations rely on wether the user is actively logged in or not.
For example right now I can track now long someone is using the computer for based on how long the ..._current_username
value equals their name. Once they lock the PC or logout the ..._current_username
value goes to unknown
or unavailable
so I can stop tracking time against that user. With HASS.Agent I can’t really do that since any user who is logged in gets returned by the loggedusers
sensor even if they’re not actively using the desktop session (i.e. PC is locked or another user is actively using it). Returning a JSON list adds extra overhead for me as well since I’d have to parse things out even if there is only a single user value there.
Is it possible to have another sensor that just reports which user current has an active session and is a single string value of their username?
Aside from that (so far) things are AWESOME! Setup was quite easy and the sensors showed up right away in HA.
Quick question? Can the PC side sensors be configured via configurations files as well or only via the GUI? I’m all about tracking everything as code and if I roll HASS.Agent out to my other PCs to replace IoT Link I surely don’t want to manually configure all 4 of them via the GUI each time
Thanks for the kind words!
Is it possible to have another sensor that just reports which user current has an active session and is a single string value of their username?
Sure, no problem:
Yep. Go to this folder (assuming you installed in the default location):
%appdata%\LAB02 Research\HASS.Agent\config
You can copy all config files. Some notes:
- Change
appsettings.json
→devicename
if it’s custom, or make it empty so HASS.Agent will get the Windows name - Change all
Id
values in bothcommands.json
andsensors.json
. Nothing fancy, just 1 letter different is enough. - For clarity, change the names of the commands & sensors as well
- You don’t have to change them in
quickactions.json
, they’re for internal use only
I’ll put an export/import function on the to-do list that automates this, can imagine more people wanting to do this, and could double as a backup function.
Thanks for the quick response! I should be quicker to try out these things now that I have a good use case for setting up HASS.Agent. The existing implementations of IoTLink are working fine so “if it ain’t broke don’t fix it”.
Is it possible to setup the HASS.Agent to work as a Windows Service or something else that would allow it to function in a global sense? IoTLink currently allows me to sleep the PC regardless of who is logged in but right now HASS.Agent only sleeps if I’m logged in, not my son, presumably because I original set it up under my user account. I saw mentioned during setup or in the doc somewhere about user specific registry settings IIRC so I assume that’s why.
You’re really in sync with my development cycle @bverkron I’ve been working on a ‘satellite service’ which allows you to run specified sensors/commands in the background, regardless of being logged on. Been quite some work as I want it done properly, but the beta should be released within a week or two.
Nice! Good plan.
In the meantime what’s the best way to migrate installation to my sons user account? It’s his PC so if it can only function under one account for now I want it to be under his. I tried launching the agent under his account and I get a permissions error. If I run the installer under his account it gives me options to modify / repair / uninstall. I guess backup the config and re-install under his account?
Edit: this is an interesting usecase, multiple users on the same machine with parallel running instances. It shouldn’t be too hard to have HASS.Agent support this out-of-the-box. I’ll put it on my todo list. For now, you can follow the below instructions
The current installer runs under administrative privileges, so even if it’s installed in a user folder, it’ll still get registered system wide. The reason for the privileges is that it has to reserve a port to receive notifications.
Tthe easiest way to install HASS.Agent in any user account (multiple accounts isn’t a problem) is to download the .zip instead of the installer. Extract it to any folder in which it has write access (so no program files). The onboarding will help you enable start-on-login.
If you just want the user that used the installer to receive notifications, you don’t have to do anything. Just make sure to disable notifications in the other accounts.
If you want a user other that the one that used the installer to receive notifications, run the following in an elevated command prompt:
netsh http delete urlacl http://+:5115/
netsh http add urlacl url=http://+:5115/ user=Everyone
If you want all users to be able to receive notifications, that’s no problem either. Decide on a port number for each user. Then run this command for every port number (change 5115):
netsh http add urlacl url=http://+:5115/ user=Everyone
Then run the following command for each port in an elevated command prompt (change 2x 5115):
netsh advfirewall firewall add rule name="HASS.Agent Notifier 5115" dir=in action=allow protocol=TCP localport=5115
You can only auto-update the account that uses the installer. The others need to be done manually with the zip release.
This all is very cumbersome, I know. It’ll get better in future versions. If there’s anything more I can do to help, let me know!
Problem with setup: I already have one PC working as expected, however on the second I end without any possibility to create sensors or actions.
Installation happend with no problems/errors. I can send notification to the PC. The PC is not in MQTT (the other one is there as a device).
When the agent is started I get this picture
When I try and create a sensor I get this picture
I have tried to uninstall and install again. I have tried with different client names, I have tried to reconfigure the MQTT part, I have tried in MQTT with both IP address and homeassistant.local
I have tested the API and token, it report “connection OK” and show the correct versionnumber for HA.
Here is my current MQTT configuration
Im open for any good idea.
Hi @khvej8, that’s a known DPI scaling bug. You probably have Windows scaling on 110% (or higher) on that machine. The bug’s fixed in the next version, but until that’s released a simple workaround is to temporarily set your Windows scaling on 100% while configuring the commands and sensors.
Hope this helps!