Control your Windows PC with HASS Workstation Service

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

An open laptop on a desk displaying the Windows Start Menu with various application tiles such as Mail, Calendar, Microsoft Edge, and Photos visible. To the left of the laptop is a potted succulent plant on a white surface, adding a touch of greenery to the workspace.

HASS Workstation Service is a new free and open-source application which allows you to control and monitor your, or any other that might be in your network, Windows PC from Home Assistant using the MQTT network protocol. As it is always running in the background, the application was developed with the goal of being a lightweight service using well-defined standards.

As you would have come to expect with everything that was developed for Home Assistant, HASS Worksation Service is a local service which doesn't need any connection to the cloud. You can set it to only ever communicate through your MQTT broker, such as Mosquitto, using secure communication.

Contents

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.

A screenshot of the HASS Workstation Service showing a list of sensors and commands that can be used by Home Assistant.

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.

A screenshot of the Home Assistant Dashboard showing the list of entities provided by HASS Workstation Service.

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:

Rundll32.exe user32.dll,LockWorkStation

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.

No media controls

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.

A portrait photo oif Liam Alexander Colman, the author, creator, and owner of Home Assistant Guide wearing a suit.

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...