IOT Link - Windows Management using MQTT

Thanks for your work @gibman.

Would you consider doing a pull request with your changes so @alexslx might verify and incorporate your changes in the official application? I’m not comfortable downloading from another source. Heck I wasn’t comfortable initially installing the official IOT. Just my thoughts.

Thanks again for working on improving this excellent service.

2 Likes

I guess it’s alot more work from my side :confused:

I would have to create a gitlab account, then figure out how to do a proper PR.

btw I hate git hehe :slight_smile:

1 Like

Ahh it wasn’t that hard after all.

commit here:

PR here:

3 Likes

Amazing and useful software, thank you

Looking for the way to run the command within the admin privileges:
Does it possible?

alias: P7- Save
sequence:
  - service: mqtt.publish
    data:
      topic: iotlink/sza/mark/commands/run
      payload: >-
        { "command":
        "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
        "args": "save-vm p7", "path": "C:\\", "user": "", "visible": true,
        "fallback": true }
mode: single

Want to use for save and start for Windows VM
But luck of privilege. IOTLink is a service so by idea it can run as admin.
Any thought how to manage it?

Second question: how to switch off|on the particular display (not all of them together)?

Were you able to figure this out? I just started looking at it and noticed that there really isn’t an entity_id for publishing an update to hibernate the computer for example

Hello,

I’m using IOT link intensively on my 4PCs. I can observe IOT link generated a lot of logs like:

(...)
Apr 01 10:08:01 raspberrypi hass[21528]: 2021-04-01 10:08:01 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor iotlink pc-marta_display-info_screen_0_width, sending update
Apr 01 10:08:01 raspberrypi hass[21528]: 2021-04-01 10:08:01 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor iotlink pc-marta_display-info_screen_0_height, sending update
Apr 01 10:08:01 raspberrypi hass[21528]: 2021-04-01 10:08:01 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: camera iotlink pc-marta_display-screenshot_screen_0, sending update
Apr 01 10:08:27 raspberrypi hass[21528]: 2021-04-01 10:08:27 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor iotlink pc-marta_cpu_usage, sending update
Apr 01 10:08:27 raspberrypi hass[21528]: 2021-04-01 10:08:27 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor iotlink pc-marta_memory_usage, sending update
Apr 01 10:08:28 raspberrypi hass[21528]: 2021-04-01 10:08:28 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor iotlink pc-marta_memory_available, sending update
Apr 01 10:08:28 raspberrypi hass[21528]: 2021-04-01 10:08:28 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor iotlink pc-marta_memory_used, sending update
(...)

It looks like the IOT link is reporting updates thru HA discovery, al the time?
Question: Is there a way to configure IOT Link to use discovery just initially (or at least periodically) and send updates in some other way? To reduce the number of such log entries… Note I do not want to switch discovery logging to WARN as I want to see if new devices appear.

Hmmm… Maybe it’s not possible. I just want to know.
Does anybody know?

I am trying to get the WOL to work, and I believe I have configure all the settings needed. However, when I put the pc to sleep OR hibernate, it restart itself soon after without me interfering. I have tried changing several settings as suggested on the net. Nothing seems to work. The only thing that keeps the pc in constant sleep/hibernate mode is disabling all these 3 check boxes, but we need these boxes to be checked in order to wake the pc.

When I run this cmd in windows, these are the devices that can wake the pc from sleep mode. I did not move any keys or mouse when pc is going to sleep.

C:\WINDOWS\system32>powercfg -devicequery wake_armed

Realtek USB GbE Family Controller
HID Keyboard Device (002)
HID-compliant mouse (002)
HID Keyboard Device (005)

The only box that “needs” to be checked is the middle one. I would actually recommend that the last box be unchecked.

If your computer is still not entering sleep mode, I would recommended closing running processes one at a time as you might have an app causing your issue. Start by closing out all apps running in the systray.

ok. will try that in a few. In process of running sfc /scannow

The only box that “needs” to be checked is the middle one. I would actually recommend that the last box be unchecked.

It didn’t work. I have tried ticking only the middle box and middle and 3rd boxes, but still restarts. It doesn’t look right as the boxes are slightly faded when I uncheck the 1st box. Can you share how yours looks like?

2021-04-10_7-56-45

Will be trying closing process next.

1st and 2nd boxes are checked on mine.

I have nothing in the taskbar running and these are to only Background processes running not counting the Windows processes.

Wish I could help further but it looks like you need to continue down the standard troubleshooting steps. Remove as much peripheral hardware and disable as much memory resident software as possible till you find the culprit. Also make sure you have updated your hardware drivers and maybe even your bios.

Beyond that, I have nothing else to recommend. Good luck.

Little late to the game but see this post

Hello everyone! I started this week in the world of smart home and discovered this amazing home assistance tool and when creating a dashboard I found this Iotlink solution to restart / shutdown computers, but I confess that I read this topic from start to finish in 2 days and I couldn’t put it to work. the connection of the home assistant to the windows pc running iotlink.
I confess that I don’t know anything about programming, the only thing I did on windows was to install Iotlink and change the configuration.yaml

my configuration.yaml

and log of iotlink:

[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:46 -03:00][INFO][IOTLink.IOTLinkService]: Windows Service is started.
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:46 -03:00][INFO][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::Stop() - Finishing MQTT
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:46 -03:00][INFO][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::Start() - Initilizing MQTT
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:46 -03:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Connect() - Trying to connect to broker: tcp://192.168.1.137:1883.
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:46 -03:00][SYSTEM][IOTLinkService.Service.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/workgroup/desktop-4d3ner9/
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::OnDisconnectedHandler() - MQTT Disconnected
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/shutdown (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/reboot (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/logoff (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/lock (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/hibernate (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/suspend (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/run (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/displays/on (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/displays/off (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/notify (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/send-keys (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/playpause (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/stop (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/next (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkAddon.Service.CommandsService]: Addon Commands has subscribed to topic commands/media/previous (Accepts Global: True)
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:47 -03:00][INFO][IOTLinkService.Service.Engine.ServiceAddonManager]: Loading addon: commands
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:57 -03:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::OnDisconnectedHandler() - MQTT Disconnected
[WORKGROUP\DESKTOP-4D3NER9][2021-04-14 14:59:57 -03:00][ERROR][IOTLinkService.Service.MQTT.MQTTClientManager]

if anyone can help me I thank you very much! the sensors even work on the dashboard, if I put a cpu card it works normally, but what I need most is the function to restart / shutdown the pc remotely and it doesn’t work.

I have a script in Home Assistant to reboot my PC. It’s as follows (OSPREY is the name of my PC):

script:
  osprey_reboot:
    alias: "OSPREY - Reboot"
    sequence:
      - service: mqtt.publish
        data:
          topic: "iotlink/workgroup/osprey/commands/reboot"
          payload: ""

Hope that helps. Also, here is the link to all the commands.

Hi. I’m new into Home Assistant, because I want to use the IOT Link MQTTT solution to start a program from a Windows 10 pc into my local network. I try to get the MQTTT solution running, but i have no idea what I’m doing. :laughing: What I’ve done so far:

  1. Installing Home Assistant on my Synology NAS.
  2. Installing IOT Link on the Windows 10 machine I want to control / get information from.
  3. Tried to configurate the “configuration file” like:
    Configuration · Wiki · IOT Link / IOT Link Service · GitLab
########################################################################
# IOT Link - Engine Configuration File
########################################################################
# See https://gitlab.com/iotlink/iotlink/wikis/Configuration for details
########################################################################
mqtt:
  ########################################################################
  # Credentials Settings
  ########################################################################
  credentials:
    username: User
    password: Test123
  ########################################################################
  # TCP Connection Settings
  ########################################################################
  tcp:
    enabled: true
    hostname: 192.168.188.75 #my windows 10 machine i want to control
    port: 1883
    secure: false
    tlsConfig:
        allowUntrustedCertificates: false
        ignoreCertificateChainErrors: false
        ignoreCertificateRevocationErrors: false
        caCertificate:
        clientCertificate:
        clientCertificatePassword:
  ########################################################################
  # WebSocket Connection Settings
  ########################################################################
  websocket:
    enabled: false
    uri: 
    secure: false
    tlsConfig:
        allowUntrustedCertificates: false
        ignoreCertificateChainErrors: false
        ignoreCertificateRevocationErrors: false
        caCertificate:
        clientCertificate:
        clientCertificatePassword:
  ########################################################################
  # Message Settings
  ########################################################################
  messages:
    qos: 1
    retain: false
  ########################################################################
  # LWT Message Settings
  ########################################################################
  lwt:
    enabled: true
    qos: 1
    retain: true
    connectMsg: "ON"
    disconnectMsg: "OFF"
  ########################################################################
  # Discovery Settings
  ########################################################################
  discovery:
    enabled: true
    topicPrefix: homeassistant
    domainPrefix: false
  ########################################################################
  # General MQTT Settings
  ########################################################################
  clientId: INTEL-NUC #my windows 10 machine i want to control
  prefix: IOTLink
  globalPrefix: IOTLink/all
  cleanSession: true
  autoReconnectDelay: 10
  keepAlivePeriod: 60
  maxPendingMessages: 100

########################################################################
# Logging Configuration
########################################################################
logging:
  enabled: true
  ########################################################################
  # Level
  ########################################################################
  # Define the level of logging information that will be stored on logs.
  ########################################################################
  # 0 (Disabled)
  # 1 (Critical), 2 (Error), 3 (Warning)
  # 4 (Info), 5 (Verbose), 6 (Debug)
  # 7 (Debug Within Loops), 8 (Trace)
  # 9 (Trace Within Loops), 10 (Data Dumping)
  ########################################################################
  # Type: Integer
  # Default: 4 (Info)
  ########################################################################
  level: 4

########################################################################
# General Addon Configuration
########################################################################
addons:
  enabled: true
  1. Home Assistant → Configuration → Add Integration → MQTTT:
Server: 192.168.188.75
Port: 1883
User: User
Password: Test123

Checkbox "Enable Discovery" -> activated.
  1. Home Assistant tries to connect, but it can’t get a connection! :upside_down_face:

Is my “workflow” correct? Thank you very much!

Greeting!

Your config file is wrong. Your tcp settings should have the IP address of your MQTT server. Not the PC you want to control.

Ok, thank you. Stupid question: Is Home Assisant my MQTT Server or do I need a third application?

Thanks!

You need to set up your own MQTT broker/server. The Addon Store (Supervisor > Add-on Store) has Mosquitto Broker which is an open source MQTT server. Should be easer to setup. I use the same software but manually set it up years ago.

1 Like