Installing HASS Workstation Service on Windows
Please note, that you will have to have an MQTT broker up and running before being able to use HASS Workstation Service. This guide will not cover how to install and set up a such a broker. The easiest way of doing so is by using the Mosquitto add-on for Home Assistant. Mosquitto can also be set up as a Docker container or as a native application on Windows, macOS, or Linux.
You can download an installer for the latest HASS Workstation Service version in this Reddit thread and install it as you would any other Windows application. However, if you get can't install the application due to Windows not trusting it, I encountered this issue, you can enable a prompt to appear by editing the registry subkeys described in this article.
Once installed, all you have to do is add your MQTT broker's credentials and click the save button. If you've already set up MQTT on Home Assistant and have enabled discovery, the sensors, and commands you add to HASS Workstation Service should automatically appear as entities.
Once fully configured, HASS Workstation Service it will stay active in the background and run as a Windows service. In my short time using the application I have not seen it creep above 0.5% CPU utilization, and, in my case, it occupies around 25 MB of memory.
Windows sensors provided by HASS Workstation Service
In its current version, you can configure up to twelve sensors using HASS Workstation. These include sensors which report whether your microphone or webcam is active, information on your CPU (load and clock speed) and memory usage, and also the title of the currently active window.
Using the provided sensors, you could, for example, have any noise producing machines in your office turn off whenever the microphone is active. Or you could turn on certain lights when HASS Workstation Service detects that the webcam is turned on.
Windows commands provided by HASS Workstation Service
There are three preconfigured commands which will add a switch to Home Assistant to log off the current user, restart the computer, and fully shut down the computer. There is also the option of adding custom commands, and the author has helpfully provided a few in the aforementioned Reddit thread. You can simply copy and paste the code below and add them as custom commands.
Put the computer to sleep (this will hibernate the computer if hibernation is enabled):
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Lock the computer:
HASS Workstation Service vs. IOT Link
In a previous article, I presented the desktop application IOT Link, which has many parallels to HASS Workstation Service. IOT Link is currently the more mature of the two applications and provides many more sensors, including the ability to display a screenshot of what you are currently doing as a camera feed in Home Assistant.
HASS Workstation Service does go slightly easier on your system, though the difference is minimal, and provides a simpler interface. The setup is also easier but provides you with fewer options as all you have to do is enter your MQTT broker's IP, whereas IOT Link requires you to edit a YAML file. IOT Link does also not have the ability to report the active window and webcam usage yet, which is one big advantage HASS Workstation Service has over it.
Where HASS Workstation Service falls short
Keep in mind that HASS Workstation Service is still very much beta software. I am in no way criticizing the developers or trying to say that they should do better. This application was developed in their spare time and is given away for free. As I can't contribute to the project, I am in no position of telling them what to do. Still, there are a few shortcomings I believe you should be aware of before installing it.
No edit button for sensors and commands
In its current state, HASS Workstation Service does not allow you to edit any existing sensors or commands. If you want to change anything, for example how often the sensor is updated, you are forced to delete the sensor and add it again with the desired settings.
Having media controls would be a nice feature and, luckily, is being worked on by the developers, but as isn't integrated as yet. This would allow you to remotely skip tracks and adjust the volume when listening to Spotify or another music service through your computer speakers, even if the screen were turned off.
Some sensors should be binary sensors
Currently, every sensor you add to HASS Workstation Service is reported as a sensor to Home Assistant. However, the webcam and microphone status should definitely be reported as binary sensors, as they can only ever be one of two states. Namely, on or off.
Append computer name
One thing HASS Workstation Service should definitely do implement is prepending the computer's name to any sensor and command. If you were to have the application set up on multiple computers in your network you would have to carefully adjust the sensors and commands on each installation to avoid any duplicates. If duplicates do occur, Home Assistant will simply append
_2 to one of them, making them difficult to discern.