IOTlink: Full control and monitoring of your Windows 10 machine using MQTT

IOTlink: Full control and monitoring of your Windows 10 machine using MQTT

I recently decided to try an add-on called IOTlink. I was looking for a way to remotely monitor and control my main workstation pc. IOTlink seemed to be just the answer. In layman’s terms, it appears to install an MQTT client in Windows which continually publishes relevant sensor data to a particular topic which you can then pick up using your home automation platform. In my case that’s Home-Assistant/Node-red. I’ll walk you through the set up.

I downloaded and installed the application from here. Note you need to run the installer as Admin. After a couple of moments, all that was left was a folder in my start menu called IOTlink:

IOTlink Start Menu Entry
IOTlink Start Menu Entry

Open the configuration files and basically input the data that will allow this app to communicate with your MQTT broker. These are pretty self explanatory and a lot of the mqtt related stuff is already pre-filled in for you in terms of logging, retain, discovery etc. I had to change the following:

  • username
  • password
  • host
  • port
  • ssl
  • topicprefix i.e. “homeassistant”
  • prefix “IOTlink”

Once changed, I saved the configuration file and started the “windows service.” A command prompt window appeared momentarily but that was it. There was nothing visibly running on my workstation. I wasn’t even sure it was working. I switched over to the HA side of things. I’m using hassio (or core or whatever they call it now) and so I went to the integrations page and the MQTT section. IOTlink was already enabled under MQTT discovery, so it was just a matter of adding the discovered items into lovelace.

IOTlink MQTT Discovery
IOTlink MQTT Discovery

 

So far so good. I now had all the incoming sensor data I wanted from my main machine (IP addresses redacted). Now to set up a way I can control the workstation from HA.

This was as simple as copying a script into my scripts.yaml. For example to reboot and shutdown the machine I added these:

my_computer_shutdown:
  alias: Shutdown
  sequence:
  – service: mqtt.publish
    data:
      topic: iotlink/workgroup/ryzen/commands/shutdown
      payload: ”
my_computer_reboot:
  alias: Reboot
  sequence:
  – service: mqtt.publish
    data:
      topic: iotlink/workgroup/ryzen/commands/reboot
      payload: ”
I also wanted a way of launching applications at will. The idea behind this was that I am a gamer/streamer and wanted to issue a voice command to Alexa to enable stream mode. This would wake the machine, and load up a series of specific applications that I use (I also partnered this with node-red to also turn on the stream lights as well as turn off any music that was playing in the background). Here’s an example of a scriptto run a specific application.
my_computer_restream:
  alias: restream.io
  sequence:
  – service: mqtt.publish
    data:
      topic: iotlink/workgroup/ryzen/commands/run
      payload: ‘{ “command”: “C:\\Users\\XXX\\AppData\\Local\\Programs\\restream-chat\\Restream
        Chat.exe”, “args”: “/AUTO”, “path”: “C:\\Users\\XXX\\AppData\\Local\\Programs\\restream-chat\\”,
        “user”: “”, “visible”: true, “fallback”: true }’
The scripts work. This is a powerful tool and you can customise these as much as you like. A full list of script examples can be found here in the official documentation. Note also on this page it shows you how to manually configure the sensor data I showed you above (useful if you’re not using MQTT discovery).
Now for the fun stuff. Here’s some examples of my inner geek in action.
When any of my guys are online (Steam) I get an announcement via HA notification on my phone and GoogleTTS provided the time is between 18.45-23.45pm.
Gaming Flow
Gaming Flow
I then tell Alexa it’s streamtime and she switches on the various apps, sets the computer audio level and turns off Sonos (in case am listening to music already, the internet loves dishing out DCMA takedowns at the moment). Note I am able to use Home-Assistant service calls or directly use MQTT. I use pushover to send a quick message to my friends to see if they’re interested in joining me for a game.
Stream-Time Flow
Stream-Time Flow
How to turn your monitors off:
Node-red:
Node-Red MQTT Monitors OFF
Node-Red MQTT Monitors OFF
Node-Red MQTT Monitors OFF code
Node-Red MQTT Monitors OFF code
Home-Assistant:
place in scripts.yaml
my_computer_monitor_off:

  alias: My Computer – Displays Off
  sequence:
  – service: mqtt.publish
    data:
      topic: iotlink/workgroup/ryzen/commands/displays/off
      payload: ”

iotlink HA displays off
iotlink Home-Assistant displays off

 

As you can see, using node-red and home-assistant it’s possible to make automations quite quickly and easily. Other ideas for the future:

  • I can have google home or alexa notify me via voice (as well as phone notification) when:
  • my harddrive is getting dangerously full
  • my network speed drops below a certain level or disconnects
  • my computer temperature is getting too warm or cold (remote server monitoring?)
  • If someone else logs onto my pc (state change on username field)
  • If my computer is turned on whilst I’m not there

Literally the possibilities are endless.

Hope this helps. The documentation for IOTlink was surprisingly good, and you really can be up and running in a short amount of time. All the commands and scripts are basically there waiting to be copy pasted. Just remember to change your topic/prefix as needed. If you do start to experience any issues with MQTT such as ghosting (randomly turning on and off) then this post might be of use for you. If you like this post and it’s useful, maybe you might like my other posts and if you’re considering making your home smart and looking for somewhere to start, then my book might also be of use.

Let me know in the comments if you have any questions or thoughts.

Cheers!

 

Leave a Reply