IOT Link - Windows Management using MQTT

My bad. I was using the ip of the windows host machine rather than the ip of the vm bridged adapter. :grimacing:

Just found IOTLink, great bit of kit but needs some help.

My automation basically checks if I have excess electricity at home (via solar) and if so starts my PC and runs my Ethereum miner.

I have all the bits working except that I cant run the miner (batch file) when PC boots as its not logged in.

Any workarounds aside from creating a service that starts on boot?

Thanks

That or have your pc boot straight to the desktop (remove lockscreen) if personal security is not an issue in your home.

Thank you for this project!

I canā€™t make the volume commands work (volume set, or mute).

I can see the message received in the log. I can use log off command, run apps, and send notifications no problem. It seems to just be volume that is not working.

Does anyone have similar issue or an idea how to make this work?

Example of command that DOES NOT work:

  arcade_computer_vol_max:
    alias: "Arcade Computer - Vol Max"
    sequence:
      - service: mqtt.publish
        data:
          topic: "iotlink/workgroup/arcade/commands/volume/set"
          payload: "100"

Example of command that DOES work:

  arcade_computer_notify:
    alias: "Arcade Computer - Notify"
    sequence:
      - service: mqtt.publish
        data:
          topic: "iotlink/workgroup/arcade/commands/notify"
          payload: '{ "title": "My Notification Title", "message": "This is an example of notification using IOT Link", "launchParams": "toast://open/https://iotlink.gitlab.io" }'

I am running:

Edition Windows 10 Pro
Version 20H2
Installed on ā€Ž4/ā€Ž27/ā€Ž2021
OS build 19042.985
Experience Windows Feature Experience Pack 120.2212.2020.0
1 Like

You could make a button that starts a script to launch an autohotkey script that adjusts your volume. Something like; (start a script creation in the UI and edit in YAML then paste this in, then switch back to UI)

alias: SFF Argus Monitor Profile 1
sequence:
  - service: mqtt.publish
    data:
      topic: iotlink/workgroup/sff/commands/run
      payload: >-
        { "command": "C:\\Windows\\system32\\net.exe", "args": "start IOTLink",
        "path": "C:\\Windows\\system32\\", "user": "", "visible": true,
        "fallback": true }
  - service: mqtt.publish
    data:
      topic: iotlink/workgroup/sff/commands/run
      payload: >-
        { "command": "C:\\Program Files\\AutoHotkey\\autohotkey.exe", "args":
        "ArgusMonitorProfile1.ahk", "path": "C:\\Program Files\\AutoHotkey\\",
        "user": "", "visible": true, "fallback": true }
mode: single
icon: mdi:fan

Once saved, I use a button card to call this script. This script makes IOT Link open an autohotkey script on Windows to interact with Argus Monitor (fan control/temperature monitoring software) via global hotkey. This allows me to control my computerā€™s fan speed from the Lovelace UI or in automations, like when opening the Plex app on my LG television (fans ramp down to quiet).

If you do this, just drop an ahk script in the same directory as the above ahk installation and made sure C:\Program Files\AutoHotkey\autohotkey.exe properties in Windows is set to run as administrator.

Note: the first part starts IOTLink service if it wasnā€™t running, just in case it wasnā€™t running (sometimes I have issues where it seems to stop responding to mqtt calls if my uptime is too high).

An example Volume50.ahk would contain simply the one-liner;

SoundSet, 50

which would set your system volume to 50.

1 Like

Thanks for the integration, i am using it in a very basic way, just turn off PC and it is more than good.

Trying this out now, and have the integration working well. On my test Windows client, the service runs as the local system, which was the default on installation. Regardless of who is actually logged in, I only see SYSTEM for the Current User. Is there a configuration Iā€™m missing?

Also having trouble like @fantangelo and @talondnb. Itā€™s really weird. I have two identical computers running identical configs and one shows notifications like a good 'un and the other justā€¦doesnā€™t I can see that the malfunctioning terminal connects up to the broker as well so itā€™s not thatā€¦

I gave up since development halted on the app.

hmmm, some interesting debug info: ā€œUser session not found, trying to get first active sessionā€

[WORKGROUP\TERMINAL][2021-06-18 11:16:05 +01:00][VERBOSE][IOTLinkService.Service.WebSockets.Server.WebSocketServerManager]: Sending message to clients (Type: REQUEST_PING)
[WORKGROUP\TERMINAL][2021-06-18 11:16:15 +01:00][VERBOSE][IOTLinkService.Service.WebSockets.Server.WebSocketServerManager]: Sending message to clients (Type: REQUEST_PING)
[WORKGROUP\TERMINAL][2021-06-18 11:16:16 +01:00][DEBUG][IOTLinkService.Service.Engine.ServiceMain]: ServiceMain::OnMQTTMessageReceived() - MQTT Message Received
[WORKGROUP\TERMINAL][2021-06-18 11:16:16 +01:00][VERBOSE][IOTLinkAddon.Service.CommandsService]: OnRunMessage: Message received
[WORKGROUP\TERMINAL][2021-06-18 11:16:16 +01:00][DEBUG][IOTLinkAPI.Helpers.PlatformHelper]: Run - Command: notifu.exe Args: notifu.exe /m "Sprinkler in use " /p Alert WorkingDir:  User:  Visible: True FallBack: True
[WORKGROUP\TERMINAL][2021-06-18 11:16:16 +01:00][DEBUG][IOTLinkAPI.Platform.Windows.WindowsAPI]: WindowsAPI::Run() - User session not found, trying to get first active session.
[WORKGROUP\TERMINAL][2021-06-18 11:16:16 +01:00][DEBUG][IOTLinkAPI.Platform.Windows.WindowsAPI]: WindowsAPI::Run() - Process seems to be started.

And yes, getting replies from the dev aint easy! Still, heā€™s doing it all for free. He owes us nothing :slight_smile:

Iā€™ve noticed the same thing, wondering if itā€™s working for others? Iā€™m not seeing any logs pertaining to it so Iā€™m not sure how else to troubleshoot.

Iā€™m certainly sticking with IoT Link until a better alternative is available, even if their are issues and it isnā€™t the most active project. The only alternative I know of is HASS Workstation Service which has a similar level of activity and less capabilities (that are useful to me personally, at least).

As a new user, I admit Iā€™m a bit lost. The instructions say ā€œDownload the provided Installer for your system from the Downloads tab.ā€

Where exactly am I supposed to look? There is definetly no download ā€œTabā€ just like that.

EDIT: I think what this is trying to say is on this page. Can this be correct? Why is there no information about this in the post?

Iā€™m new to IOT Link, looks very promising and I would love to use it to control the state of my windows server machine. But Iā€™m having troubles getting started.

After I installed IOT Link (as admin) I install the service, update the configuration to have a proper username and password. After a manual service restart (just to be sure) I try to connect with MQTT explorer to IOT Link without luck.

For some reason I canā€™t seem to connect to my device (both IOT Link and MQTT explorer are running on the same machine. I tried to connect with 127.0.0.1, localhost, and my local IP without luck. Any idea what I did wrong?

I noticed that the part of the log I attached is repeating itself constantly and at some point, you can see ā€œ0 monitors foundā€ which is a bit strange. I have all addons installed and enabled in their own config file (and in configuration.yml addons are enabled by default)

Here is the debug log I got from IOT Link:

[WORKGROUP\VASTE-PC][2021-07-13 12:56:28 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgents() - Initialized
[WORKGROUP\VASTE-PC][2021-07-13 12:56:28 +02:00][TRACE][IOTLinkService.Service.Engine.ServiceMain]: StartAgents() - Windows Session Found. SessionId: 2 StationName: Console Username: mikha IsActive: True
[WORKGROUP\VASTE-PC][2021-07-13 12:56:28 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Initialized. SessionId: 2 Username: mikha
[WORKGROUP\VASTE-PC][2021-07-13 12:56:28 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: GetAgents() - Initialized
[WORKGROUP\VASTE-PC][2021-07-13 12:56:28 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Agent Found. SessionId: 2 PID: 16960 Username: mikha CommandLine: 
[WORKGROUP\VASTE-PC][2021-07-13 12:56:28 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Agent instance is already running for this user. Skipping.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:29 +02:00][DEBUG][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::OnRefreshTimerElapsed() - Refreshing LWT
[WORKGROUP\VASTE-PC][2021-07-13 12:56:29 +02:00][VERBOSE][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::SendLWTConnect() - MQTT is disconnected. Skipping LWT.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgents() - Initialized
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.Engine.ServiceMain]: StartAgents() - Windows Session Found. SessionId: 2 StationName: Console Username: mikha IsActive: True
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Initialized. SessionId: 2 Username: mikha
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: GetAgents() - Initialized
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Agent Found. SessionId: 2 PID: 16960 Username: mikha CommandLine: 
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.Engine.AgentManager]: StartAgent() - Agent instance is already running for this user. Skipping.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][DEBUG][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::OnVerifyTimerElapsed() - Checking MQTT Connection.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][WARNING][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::VerifyConnection() - MQTT Connection Broken. Reconnecting.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][VERBOSE][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::Disconnect(True)
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Disconnect(True) - Trying to disconnect from broker: tcp://localhost:1883.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][VERBOSE][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::Connect()
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][TRACE][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Init() - MQTT Init finished.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Connect() - Trying to connect to broker: tcp://localhost:1883.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:33 +02:00][SYSTEM][IOTLinkService.Service.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/workgroup/vaste-pc/
[WORKGROUP\VASTE-PC][2021-07-13 12:56:37 +02:00][VERBOSE][IOTLinkService.Service.WebSockets.Server.WebSocketServerManager]: Sending message to clients (Type: REQUEST_PING)
[WORKGROUP\VASTE-PC][2021-07-13 12:56:37 +02:00][TRACE][IOTLinkService.Service.WebSockets.Server.WebSocketServerManager]: Message received from client 8ed4c4294ddc4464a55870b32e33a007
[WORKGROUP\VASTE-PC][2021-07-13 12:56:37 +02:00][DEBUG][IOTLinkAddon.Service.ProcessMonitorService]: ProcessMonitorService::OnProcessStarted(msedge) - 0 Monitors found.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:37 +02:00][DEBUG][IOTLinkAddon.Service.ProcessMonitorService]: ProcessMonitorService::OnProcessStarted(msedge) - 0 Monitors found.
[WORKGROUP\VASTE-PC][2021-07-13 12:56:38 +02:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::OnDisconnectedHandler() - MQTT Disconnected
[WORKGROUP\VASTE-PC][2021-07-13 12:56:38 +02:00][VERBOSE][IOTLinkService.Service.Engine.ServiceMain]: ServiceMain::OnMQTTDisconnected() - MQTT Disconnected

EDIT. Added IOT Link config

mqtt:
  credentials:
    username: xx
    password: xx
  tcp:
    enabled: true
    hostname: 192.168.72.22
    port: 1883
    secure: false
    tlsConfig:
        allowUntrustedCertificates: false
        ignoreCertificateChainErrors: false
        ignoreCertificateRevocationErrors: false
        caCertificate:
        clientCertificate:
        clientCertificatePassword:
  websocket:
    enabled: false
    uri: 
    secure: false
    tlsConfig:
        allowUntrustedCertificates: false
        ignoreCertificateChainErrors: false
        ignoreCertificateRevocationErrors: false
        caCertificate:
        clientCertificate:
        clientCertificatePassword:
  messages:
    qos: 1
    retain: false
  lwt:
    enabled: true
    qos: 1
    retain: true
    connectMsg: "ON"
    disconnectMsg: "OFF"
  discovery:
    enabled: false
    topicPrefix: homeassistant
    domainPrefix: false
  prefix: IOTLink
  globalPrefix: IOTLink/all
  cleanSession: true
  autoReconnectDelay: 10
  keepAlivePeriod: 60
  maxPendingMessages: 100
logging:
  enabled: true
  level: 8
addons:
  enabled: true

Also, my windows firewall is disabled and Iā€™m on a private network (changed in windows network options screen)

Someone got an idea what Iā€™m doing wrong here?
Thanks in advance!

I did recently see this project, which doesnā€™t really have the best documentation, but I believe itā€™s a bit more reliable. I havenā€™t had a chance to try it myself yet.

https://system-bridge.timmo.dev/

1 Like

I have migrated to using System Bridge. There are still a few kinks to be ironed out, but the developer is very active and responsive to feedback/feature requests. The biggest problem with the documentation is that it does not directly explain how to get the sensors into HA. Anyway this thread is about IOT Link, will leave any further discussion about System Bridge to its own dedicated thread.

Whoops, I had completely forgotten Iā€™d already tried System Bridge. The /display endpoint didnā€™t seem to work so I stuck with IOT-Link but I should give it another go.

Looks great @alexslx ,

But i have another questionā€¦
on the screenshot I see the screenshot of a w10 machine?
I assume this is refreshed regularly?

If i might ask, what/how do to grab the screens?

Edit:
Never mindā€¦just read some more, itā€™s from iotlink :rofl:

camera:
  - platform: mqtt
    name: "My Computer - Screen 0"
    topic: "iotlink/workgroup/my-computer/windows-monitor/stats/display/0/screen"

Finally had some time to implement.

Seems to work fineā€¦however, some sensors seem to stop after some timeā€¦
f.e. cpu load says ā€˜last updated 7 secs agoā€™
and them c: drive usage unavailable ā€˜last update 20hrs agoā€™
Havenā€™t figured out yet what the issue is, just set log level to debugā€¦
But if anyone has a clueā€¦.

anybody know how to disable the system information logging? I want to retain the ability to use commands but donā€™t need to know (for example) the kb of traffic exchanged every few seconds etc!! many thanks

should be as simple as uninstalling the windows monitor addon for iotlink on your pc.
(edit:) Alternatively if already installed, go to C:\ProgramData\IOTLink\Addons\WindowsMonitor, open config.yaml, and set enabled to false. You probably want to do the same for the process monitor addon too