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

Hi @Insearchofth1ngs, you can use the ProcessActiveSensor. It returns the amount of instances the provided process is active.

If the sensor returns ‘0’, you’ll know the process is no longer active.

Oh and if it’s a service, you can use the ServiceStateSensor.

Hopefully this’ll be of use for you, if not, let me know!

Awesome thanks. I’m gonna try and get this installed tonight and give it a test.

So after fixing the screen saver the sensor is working again,
Thanks!

1 Like

just a quick note to say ‘thank you’ for this great piece of software! exactly what I was looking for :smiley:

1 Like

Thanks, glad it’s useful :grinning_face_with_smiling_eyes:

Another thank you here Sam! Brilliant work!

1 Like

I have recentlry setup a new PC and now some of HASS.Agent functions are not working.

The system status looks OK and Quick actions work as expected but my local sensors don’t do anything.

I am also seeing this error in the core log:

2022-05-11 14:01:27 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform mqtt does not generate unique IDs. ID 33ad8489-4255-490f-9aea-d3eb515cc47e already exists - ignoring binary_sensor.samsung_printer_hass_agent
2022-05-11 14:01:27 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform mqtt does not generate unique IDs. ID ed836fc4-efd4-47ae-b089-a955c6d6238e already exists - ignoring binary_sensor.dymo_hass_agent

Do I need to have a new api token for this PC ??

EDIT: The below info is only relevant if by ‘new pc’ you mean ‘I bought a new pc to replace the old one’. If you’re using HASS.Agent on two pc’s now, you need to give the sensors unique names.

For instance; pc_one_samsung_printer and pc_two_samsung_printer.

That’s why the names HASS.Agent auto-generates for you, contain the device’s name.

Note that you can change that name in the Configuration window.


Let’s remove your device to start with a clean slate (don’t worry, your automations/scripts will keep working).
Could you please try the following:

  • Close HASS.Agent
  • Go to your Home Assistant instance
  • Press c to launch the search bar
  • Search for devices and press enter
  • Search for your device and open it

On this page, make sure under Device info it says by LAB02 Research, and there’s a MQTT INFO. This way you know for sure it’s the right device:

image

Afterwards, press DELETE DEVICE:

image

Click OK to confirm. You’ll now get this message:

image

For completeness-sake, please restart your Home Assistant instance. When the restart’s completed, you can also restart HASS.Agent. Your device will now be re-registered, and all entities should be good to go.

If not, please let me know and we’ll debug further!

Thank you @TheHolyRoger! It’s not always fun investing time & energy besides a fulltime job into this, but gestures like this keep me motivated :heart:

1 Like

I wrote a more extensive ‘command basics’ page on the documentation:

https://hassagent.readthedocs.io/en/latest/commands/command-basics/

Useful for anyone that wants to learn what HASS.Agent’s commands are and how to use them, starting at the very beginning.

I did mean that I setup HASS Agent on another PC, but the MQTT info was the same as the old PC.

So fixing the names of the local sensors on the new PC and deleting the device fixed the issue.

The Windows10 printer driver behaves differently than the old Win7 PC that I tested it on so I will have to play with my automatons as the NamedWindow I was using does not seem to exist on Win10.

Good to hear it’s fixed!

I’m adding a PrintQueue sensor to the next version, so if all else fails, you could use that one to detect whether a print’s waiting to be processed.

Hi, love the plugin, been waiting for something like this for awhile. I’m trying to use one of these sensors as an occupancy sensor for a room with a desktop computer. I’ve enabled the lastactive sensor but I’ve noticed that it will 100% always fire the active response, even if my computer is idle and the display is asleep. I’m assuming the culprit is some program I’m running in the background. Is this sensor supposed to only listen for input devices to determine active? If so, I do use a virtual mouse remapper tool, and I’m wondering if it is conflicting with this sensor.

Alternatively, are there any other sensors available or that could be made available that could also get at whether or not a person is using a computer, for the purposes of occupancy detection for light/fan control? Thanks!

Great work on this. I’ve come across from IoTLink which worked great, but seems to be abondoned, and I’d always have the service stop reporting, so I’d have to manually stop and restart it to get it working again.

I am having 1 issue though, and I don’t know if it’s related to HASS.Agent, or something else, but is only happening with HASS.Agent.

I make use of the Hibernate command to put power down my PC of a night. Since moving to HASS.Agent, everytime I wake my PC, it will crash resulting in me having to hard power cycle the PC, which is annoying.

I don’t know what’s different about HASS.Agent, but I would assume it uses the shutdown /h command like one normally would from the Command Prompt.

I think IoTLink did something different, as it’s Hibernate command would allow the PC to wake really really fast rather than the normal way where you see a bit of the Bios and the Windows splash screen with the spinner (which is where it crashes).

UPDATE: So, upon further investigation, it seems that hibernate seems to mess up my PC a bit. Not sure why. IoTLink would put my PC to sleep rather than hibernate for some odd reason, but when using HASS.Agent, it would properly put my PC into hibernate, which has highlighted the issue with my PC.

For now, I’ve disabled hibernate (as I don’t use it) using powercfg -h off and things are working how I like again, and using the Sleep command in HASS.Agent works how it should.

1 Like

Hi @chadbaum and @cjsimmons,

Sorry for the late reply - very busy weeks work-wise. For starters; thanks to you both for the kind words! It’s always nice and motivating to hear :slight_smile:

@chadbaum: The value that I use is something that’s provided by Windows itself, so not something I determine - but I’m pretty sure it’s based on keyboard and mouse activity. It’s the same value used to determine when to trigger the screensaver. You can start by disabling applications one by one, and see what comes up. I’ll think about alternative methods, maybe create seperate lastkeyboardevent and lastmouseevent sensors so you can decide for yourself which to use.

@cjsimmons: Glad to hear you fixed it! Hibernation/sleep can be a mess …

1 Like

@SamKr, thanks for the reply. In the intervening time I’m happy to report I think the sensor is working as expected now. All I did was reboot my computer. :slight_smile:

Hah, perfect!

Hi all! Great windows agent! I had been using IOTLink until now and was happy but I never really felt that it was precisely what I was looking for. Specially I was looking for a tool that allows me to play a windows local wav file triggered from HA. I’ve install the HACS media player addon, but it is giving me an error on start:
“2022-05-23 21:23:10 ERROR (MainThread) [homeassistant.components.media_player] hass_agent_mediaplayer: Error on device update!
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 736, in async_device_update
await task
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/hass_agent_mediaplayer/media_player.py”, line 119, in update
self._volumeLevel = int(response.text)
ValueError: invalid literal for int() with base 10: ‘Method Not Implemented: Get /media’”

Any idea what could be the problem?
And a wish: one of the things I liked about IOTLink is the automatic screenshot capabilitiy (good to keep an eye on what the kids are doing… :wink: ). I can imagine you could implement that with commands in HASS agent, but I am not sure if there is a good screenshot tool that operates from CLI and could be triggered from HASS Agent?

Again, thanks for the awesome work! Installation worked like a charm!

1 Like

Hey @NachoMas,

Thanks, glad you like it!

You need to install the latest beta, 2022.12.0-beta3. The regular release doesn’t support media yet.

I’ll add screenshots to the list of sensors :slight_smile: (I’m not aware of such a cli tool either).

1 Like

Japp! I just read it in the thread. Sorry for firing the question first! I’ll check tomorrow.

Thanks again!

Update: I just updated HassAgent and the media player works like a charm! Thanks so much for the time you are putting on this! Really useful!

1 Like