IOT Link - Windows Management using MQTT

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:

I’m pretty sure I did, but I guess complete reinstall is the only next option if there’s nothing else to try. Thanks for trying.

Is ist Possible to get CPU Temperature and GPU Temp?

Greetz

@kalyway101 one extra thing I implemented today. I was getting a little annoyed by the command prompt window that would pop up every time I logged in showing the service starting and stopping.

I already had a small program called nircmd that I use to change my window sound device settings and only just realized it could execute batch files in the background. I now have my scheduled task execute something like this:

nircmd exec hide “c:\myPath\myFile.bat”

Now the service restarts out of sight. Small fix but it helps with my ocd :wink:

1 Like

Guys can Someone Help me?
I got Iot Link Running and everything works well, but i try to start a Programm with Node Red what do i need to send to the Topic when i wanne start for example Notepad located on c:/program/notepad.exe

I tryed a lot but i always Fail everything else works great (sending keys , monitoring…)

Thx in advance

@Chrisss, I created the following script and tested. It worked fine for me.

mypc_notepad_test:
  alias: "Open Notepad"
  sequence:
    - service: mqtt.publish
      data:
        topic: "iotlink/workgroup/mypc/commands/run"
        payload: '{ "command": "C:\\windows\\notepad.exe", "path": "C:\\windows", "user": "", "visible": true, "fallback": true }'

I don’t have NR configured at the moment but it should be fairly simple to translate into a flow.
Keep in mind that when notepad opened for me it did not open to the forefront. It was in the background and I had to click on the instance in the taskbar.

1 Like

would you mind sharing your bat file? I want to reset the service once a day, because sometimes the HDD info unavailable, and the only way to get it back is to restart the service.