IOT Link - Windows Management using MQTT

Yes. There is an addon called Process Monitor where you can monitor any process or application. I use it to set my office to “Game Mode” whenever I launch Call of Duty. I can’t find the docs on the IOT website after a brief search but it’s got to be there somewhere.

Thats exactly what i want haha,
I’m gonna search for process monitor!

If you look in the \ProgramData\IOTLink\Addons\ProcessMonitor folder you will see the yaml files for configuration.

  • in the addon.yaml, make sure to set “enabled:true”
  • in the config.yaml, comment out all the default apps listed and add a new one for your app
monitors:
  #AnyDesk: !include apps/AnyDesk.yaml
  #Chrome: !include apps/Chrome.yaml
  #Discord: !include apps/Discord.yaml
  #Firefox: !include apps/Firefox.yaml
  #OBS: !include apps/OBS.yaml
  #Origin: !include apps/Origin.yaml
  #Plex: !include apps/Plex.yaml
  #Plex: !include apps/Plex-Server.yaml
  #Rambox: !include apps/Rambox.yaml
  #Skype: !include apps/Skype.yaml
  #Steam: !include apps/Steam.yaml
  #TeamViewer: !include apps/TeamViewer.yaml
  #VLC: !include apps/VLC.yaml
  #Zoom: !include apps/Zoom.yaml
  #Zoom-InMeeting: !include apps/Zoom-InMeeting.yaml
  Cod: !include apps/cod.yaml
  • in the addon subfolder create the file referenced above…in this case cod.yaml
  • add the exact process name (as listed in task manager) under “processes”
# ModernWarfare
processes:
  - ModernWarfare
windows:
classnames:
configs:
  enabled: true
  discoverable: true
  advancedMode: false
  displayName: CallOfDuty
  cacheable: true
  grouped: true
  compareType: 0
  interval: 10
5 Likes

It looks like the lock/unlock status sensor config is not setup so it never makes it onto HA. I was able to duplicate he config topic from the other services to easily add it, but wanted to let someone know so it can make it into any updates.

{
  "icon": "mdi:timer-outline",
  "availability_topic": "iotlink/workgroup/computer/lwt",
  "state_topic": "iotlink/workgroup/computer/windows-monitor/status",
  "name": "Computer Lock Status",
  "unique_id": "computer_systeminfo_lock_status",
  "payload_available": "ON",
  "payload_not_available": "OFF",
  "device": {
    "identifiers": [
      "Computer_SystemInfo"
    ],
    "name": "Computer SystemInfo",
    "model": "WORKGROUP",
    "manufacturer": "IOTLink 2.2.2.0"
  }
}
1 Like

Is it possible to stop all the values going to “unvailable” when the computer is turned off and MQTT Discovery is used?

I’ve set the retain to true in the configuration.yaml and MQTT Explorer shows that all the values have indeed been retained. However in home assistant every single entity has the state “unavailable” (from the moment the LWT switches from ON to OFF) which makes tracking battery levels and if it’s turned on or off a challenge, looks like this is down to the existence of the availability_topic attribute on the discovery topic. If I create a manual sensor (defeating the point of using discovery) it is indeed retained

e.g. a sensor with the following configuration

  - platform: mqtt
    name: "Techeetah - Remaining Battery Manual"
    state_topic: "iotlink/pitlane/techeetah/windows-monitor/stats/battery/remaining-percent"
    unit_of_measurement: '%'
    device_class: battery
    value_template: "{{ value }}"
    qos: 1

and a sensor with the binary_sensor

  - platform: mqtt
    name: "Techeetah - Connected"
    state_topic: "iotlink/pitlane/techeetah/lwt"
    value_template: "{{ value }}"
    payload_on: "ON"
    payload_off: "OFF"
    device_class: "connectivity"
    qos: 1

allow me to keep track of the values even when the machine if off.

Can’t find any example for process monitoring, can some help me to understand the state_topic to use, if for example, I want to monitor cpu usage for the xxx.exe process (once enable in the config file)?

Great work by the way!

3 posts up I gave an example for monitoring when my game is running.

Understand, but what about the state_topic value in such a case.

for global cpu usage I can define (in HA)
state_topic: “iotlink/workgroup/myMachine/windows-monitor/stats/cpu/usage”

but what are the available metrics when monitoring a process:
Is it “iotlink/workgroup/myMachine/process-monitor/myApp/stats/cpu/usage” or something else?
What are the different options per process?

Thanks,

Use mqtt-explorer or similar and you’ll see what’s being broadcasted

Thanks, I’m working with MQTT only for a couple a hours, and that’s exactly the tool I was looking for.

It helps me to find the answer:
iotlink/workgroup/myComputer/process-monitor/processes/chrome/sensor => payload is a json stream.

The process addon seems to have an issue with PWAs, it shows as running only if its in the foreground. Anyone experience this?

Hi all,

I seem to be getting pretty much all the sensors (RAM, network, etc) except idle time. I’ve been monitoring it’s MQTT topic but it just never comes while other system stats like uptime do. Nothing interesting in the logs that I can see:

[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:20 +01:00][INFO][IOTLink.IOTLinkService]: Windows Service is started.
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:20 +01:00][INFO][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::Stop() - Finishing MQTT
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:20 +01:00][INFO][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::Start() - Initilizing MQTT
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:20 +01:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Connect() - Trying to connect to broker: tcp://192.168.2.21:1883.
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:20 +01:00][SYSTEM][IOTLinkService.Service.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/workgroup/desktop-d0cna5o/
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:20 +01:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::OnConnectedHandler() - MQTT Connected
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/shutdown (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/reboot (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/logoff (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/lock (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/hibernate (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/suspend (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/run (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/displays/on (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/displays/off (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/notify (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/send-keys (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/playpause (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/stop (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/next (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/previous (Accepts Global: True)
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:21 +01:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Loading addon: commands
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:30 +01:00][INFO][IOTLinkAddon.Service.ProcessMonitorService]: ProcessMonitorService::SetupMonitors() - Monitoring list is empty.
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:30 +01:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Loading addon: processmonitor
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:33 +01:00][INFO][IOTLinkAddon.Service.WindowsMonitorService]: WindowsMonitorService::SetupTimers() - System monitor is activated.
[WORKGROUP\DESKTOP-D0CNA5O][2020-12-02 12:31:33 +01:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Loading addon: windowsmonitor

Config hasn’t been changed from default, all things enabled:

monitors:
  CPU:
    enabled: true
    interval: 10
    cacheable: true
  Memory:
    enabled: true
    interval: 10
    cacheable: true
  HardDrive:
    enabled: true
    interval: 10
    cacheable: true
  Power:
    enabled: true
    interval: 10
    cacheable: true
  NetworkInfo:
    enabled: true
    interval: 10
    cacheable: true
  SystemInfo:
    enabled: true
    interval: 10
    cacheable: true
  IdleTime:
    enabled: true
    interval: 10
    cacheable: true
    inSeconds: true
  Uptime:
    enabled: true
    interval: 60
    cacheable: true
  Display-Info:
    enabled: true
    interval: 60
    cacheable: true
  Display-Screenshot:
    enabled: true
    interval: 60
    cacheable: false

Any ideas?

Idle time has been working great for me. I used it as part of a “motion” template sensor.

Have you tried restarting the IOT service since you updated your config?

Edit: and btw, the idletime entity is listed under the SytemInfo device.

Thanks for the reply

Yes, The IOT service and machine have been rebooted many times since the last config change.

I’m sorry, I don’t understand what you mean by “the idletime entity is listed under the systeminfo device”? I defined it as a sensor as shown in the documentation and get a sensor, but it almost always has a value of Unavailable… There was one time it went to 0, but that wasn’t correct either. It’s defined like this:

  - platform: mqtt
    name: "My Computer - Idle Time"
    state_topic: "iotlink/workgroup/my-computer/windows-monitor/stats/system/idle-time"
    unit_of_measurement: 'seconds'
    icon: mdi:timer
    value_template: "{{ value }}"
    availability_topic: "iotlink/workgroup/my-computer/lwt"
    payload_available: "ON"
    payload_not_available: "OFF"
    qos: 1

If your mqtt instance is setup for auto-discovery, then a device called “xxx SystemInfo” and within that device will be an entity called “xxx IdleTime”

It looks like you are maunally creating your entity based on the topic so things will be different for you.

I created a mqtt sensor manually using your yaml above (replacing “my-computer” with my actual computer name of course). It seems to work fine for me. It is updating every 10 seconds and the value increments by 10 with every update as expected…until I move my mouse and then it resets to 0 as it should.

Yes, this is what I did as well. It works for every single other sensor, but for some reason, nothing is published to the idle time topic at all.

Hmm…are you running the latest version of IOTLink?

Yes, I downloaded and installed it for the first time the day before yesterday.

Last question before I’d have to leave it to the author. When you installed it initially, did you install as administrator? It’s the only thing I can think of because it should just work. If you did, maybe try a complete uninstall and reinstall :man_shrugging: