IOT Link - Windows Management using MQTT

Thank you very much! I’ve installed Mosquitto as a standalone docker container, because the menu item “Supervisior” isn’t available in the Home Assistant docker installation on Synology. (Even if there are some workarounds how to add this for the Synology users.)

:+1:t3:

1 Like

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.

Finally figured why my pc will not stay asleep or hibernate after telling it to sleep or hibernate. It is the NIC card. The above gave me a clue to swap out for another. Now, it goes to sleep and I can wake it with the IOT Link add-on. A bit of a disappointment with the faulty NIC card since it had 3 port usb built-in.

Hi there,

I’m using iotlink at the moment and I’ve managed to set my audio to play for a certain application, on a certain device.
For example to have only spotify to play on my headphones.

As iotlink doesn’t support a lot of audio controll, I was looking into getting the audio volume of my workstation. At the moment I was trying tho achieve this by running a command.
Only I can’t seem to get a return value for this command?

Is this possible?
This is what I use to controll the audio playback

    - service: mqtt.publish
      data:
        topic: "iotlink/workgroup/ws-s01/commands/run"
        payload: '{ "command": "C:\\xxx\\ToolsIT\\SoundVolumeView.exe", "args": "/SetAppDefault \"NVIDIA High Definition Audio\\Device\\DELL U2515H\\Render\" 0 \"chrome.exe\"", "path": "C:\\xxx\\ToolsIT\\", "user": "",  "visible": false, "fallback": true }'

C:\\xxx\\ToolsIT\\SoundVolumeView.exe /GetPercent "NVIDIA High Definition Audio\Device\DELL U2515H\Render"

This is what I’d like to use to retreive the audio level from a certain device, or the overall volume.

Thanks
Pieter

Hi,

I have some erros while loading ProcessMonitor and WindowsMonitor addons:

[ERROR][IOTLinkService.Service.Engine.ServiceAddonManager]: Error while loading addon ProcessMonitor: System.Runtime.InteropServices.COMException (0xC0000BBF): Exception de HRESULT : 0xC0000BBF
   à System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   à System.Management.ManagementEventWatcher.Start()
   à IOTLinkAPI.Platform.Windows.ProcessEventManager.Init()
   à IOTLinkAPI.Platform.Windows.ProcessEventManager.GetInstance()
   à IOTLinkAddon.Service.ProcessMonitorService.SetupEventMonitor()
   à IOTLinkAddon.Service.ProcessMonitorService.Init(IAddonManager addonManager)
   à IOTLinkService.Service.Engine.ServiceAddonManager.LoadExternalAddons()
[STUDIO-DYNAMIX\ORDICAT][2021-04-20 18:44:52 +02:00][ERROR][IOTLinkAddon.Service.WindowsMonitorService]: WindowsMonitorService::InitMonitors() - Error while trying to initilize CPU: Impossible de charger les données de nom de compteur, car un index non valide '' a été lu à partir du Registre.
[STUDIO-DYNAMIX\ORDICAT][2021-04-20 18:44:53 +02:00][ERROR][IOTLinkAddon.Service.WindowsMonitorService]: WindowsMonitorService::InitMonitors() - Error while trying to initilize Uptime: Impossible de charger les données de nom de compteur, car un index non valide '' a été lu à partir du Registre.
[STUDIO-DYNAMIX\ORDICAT][2021-04-20 18:44:53 +02:00][INFO][IOTLinkAddon.Service.WindowsMonitorService]: WindowsMonitorService::SetupTimers() - System monitor is activated.
[STUDIO-DYNAMIX\ORDICAT][2021-04-20 18:44:53 +02:00][ERROR][IOTLinkService.Service.Engine.ServiceAddonManager]: Error while loading addon WindowsMonitor: System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.
   à IOTLinkAddon.Service.Monitors.CPUMonitor.GetMonitorItems(Configuration config, Int32 interval)
   à IOTLinkAddon.Service.WindowsMonitorService.SetupDiscovery()
   à IOTLinkService.Service.Engine.ServiceAddonManager.LoadExternalAddons()
[STUDIO-DYNAMIX\ORDICAT][2021-04-20 18:44:54 +02:00][ERROR][IOTLinkAddon.Service.WindowsMonitorService]: WindowsMonitorService::ExecuteMonitor(CPU) - Error: System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.
   à IOTLinkAddon.Service.Monitors.CPUMonitor.GetMonitorItems(Configuration config, Int32 interval)
   à IOTLinkAddon.Service.WindowsMonitorService.ExecuteMonitor(IMonitor monitor)
[STUDIO-DYNAMIX\ORDICAT][2021-04-20 18:44:54 +02:00][ERROR][IOTLinkAddon.Service.WindowsMonitorService]: WindowsMonitorService::ExecuteMonitor(Uptime) - Error: System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.

Addon command is OK and works fine!

Any idea, please?

@Mister-Espria anyone figured a workaround for the CPU reads that are different from Task Manager reads?

I would like to run chrome in incognito. Anyone knows the command for it?

  my_computer_run_chrome:
    alias: "My Computer - Run Chrome"
    sequence:
      - service: mqtt.publish
        data:
          topic: "iotlink/workgroup/my-computer/commands/run"
          payload: '{ "command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "args": "https://iotlink.gitlab.io", "path": "C:\\Program Files (x86)\\Google\\Chrome\\Application", "user": "", "visible": true, "fallback": true }'

I can’t get this to work. Log says something about disabling tcp and web sockets.

https://jpst.it/2vr-Y

And some other errors.

My home assistant seems to detect something connecting based on the logs. Idrk what I’m doing with this. How do I disable it and will that fix the unhandled exception it’s saying there is? Thank you.

Paste your config settings

Hi all
Is there an easy way to deactivate the IOTLink service through HA? Sometimes I need to see the messages in HAs Mqtt and since I have 4 laptops connected to HA right now almost the only messages I see is from IOTLink.
thanks

I’m using IOT link on a laptop and my primary server (separate form HA server). It has a UPS attached, but IOT link does not recognize a battery attached even though Windows does (NoSystemBattery). Anyone else have this problem?

Don’t have a clue why but I can’t even get the installer to open on Windows 10, admin or no admin. Anyone know why? Haven’t had any success getting a response from @alexslx with previous issues so posting here! :slight_smile:

Hi @alexslx

I have just installed IOT link and its amazing thanks !

I was wondering if there is a way to enable me to login into my windows machine by first waking my windows 10 machine and then inputting my password. There is only one user so selecting users shouldn’t be a problem.

Is that possible?

Thanks.

I am having the same issue described here.

If HA restarts… nothing gets populated. Here’s the thing, I can restart the Windows Service and it fixes everything just like @grokshot mentioned…

However, I found that going to “Configuration” => “Integrations” => “MQTT” and then under “Listen to a topic” I put in “iotlink/#” and hit “Start Listening”.

I see a flood of iotlink topics flow in, and then all of a sudden all of my sensors get populated with data.

So, I am not sure if this is an IoT Link issue… sounds more like it’s on HA.

It’s really weird that simply listening makes it work.

I’m on the latest Mosquitto Broker Add-on (HASS OS) 6.0.1, although this has been happening for a while… several versions back.

I’ve also tried to fire - service: mqtt.reload on the homeassistant start event and that doesn’t help either.

Only restarting the service, or listening to the MQTT topics solves it.

I use this on 5 machines, so it is pretty annoying to have to fix this every time. At least listening to MQTT for 10 seconds or so fixes it for all vs. how I used to go through each restarting the service.

If anybody has any insight here I’d really appreciate it!!

IoT Link Config:

########################################################################
  # 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: false
    topicPrefix: homeassistant
    domainPrefix: false
  ########################################################################
  # General MQTT Settings
  ########################################################################
  clientId: 
  prefix: IOTLink
  globalPrefix: IOTLink/all
  cleanSession: true
  autoReconnectDelay: 10
  keepAlivePeriod: 60
  maxPendingMessages: 100

Example Sensor Config:

- platform: mqtt
  name: "PC - Windows - Current User"
  state_topic: "iotlink/workgroup/windows/windows-monitor/stats/system/current-user"
  unit_of_measurement: ''
  icon: mdi:account
  value_template: "{{ value }}"
  availability_topic: "iotlink/workgroup/windows/lwt"
  payload_available: "ON"
  payload_not_available: "OFF"
  qos: 1

I just found the post about the /refresh IoTLink endpoint (IOT Link - Windows Management using MQTT - #191 by alexslx)

I will give that a go and hopefully that solves the issue!!

EDIT:

Unfortunately, that does not seem to fix the issue. I put it in my homeassistant start event automation, and when it didn’t work, tried to fire it manually several times.

The only thing that works is hitting “start listening” and then they all populate immediately! So weird!

I don’t seem to have this issue with any other MQTT entities (Tasmota mostly)

I am unable to connect to my mqtt broker. see below log from iot link which keeps repeating on every reconnect attempt. running iot link v2.2.2. i am running mosquito mqtt broker on ha. all my other devices are bale to connect on the same ip. can someone please help.

[WORKGROUP\HTPC][2021-05-30 18:37:59 +10:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Connect() - Trying to connect to broker: tcp://192.168.1.25:1883.
[WORKGROUP\HTPC][2021-05-30 18:37:59 +10:00][SYSTEM][IOTLinkService.Service.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/workgroup/htpc/
[WORKGROUP\HTPC][2021-05-30 18:38:01 +10:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::OnDisconnectedHandler() - MQTT Disconnected
[WORKGROUP\HTPC][2021-05-30 18:38:09 +10:00][WARNING][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::VerifyConnection() - MQTT Connection Broken. Reconnecting.
[WORKGROUP\HTPC][2021-05-30 18:38:09 +10:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Disconnect(True) - Trying to disconnect from broker: tcp://192.168.1.25:1883.

post your iot link config file.

thanks for the quick reply. please see below my config:
########################################################################

IOT Link - Engine Configuration File

########################################################################

See https://gitlab.com/iotlink/iotlink/wikis/Configuration for details

########################################################################
mqtt:
########################################################################

Credentials Settings

########################################################################
credentials:
username: xxxx
password: xxxx
########################################################################

TCP Connection Settings

########################################################################
tcp:
enabled: true
hostname: 192.168.1.25
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: htpc
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

Your config looks similar to mine. The only difference is the clientId:. I did not set one. Though it should connect for you regardless.

clientId: htpc
prefix: IOTLink
globalPrefix: IOTLink/all
cleanSession: true
autoReconnectDelay: 10
keepAlivePeriod: 60
maxPendingMessages: 100

yes correct it should. it was working on my older pc but after a rebuilt my pc and installed iotlink it does nto connect to the mqtt broker

One user from a different forum suggest to tweak the Windows firewall to trust local network.