IOT Link & Mosquitto Broker Addon = Socket error on client XXXXXXXX, disconnecting

I’m curious if anyone has figured out a way to get IOT Link for Windows to work with the Mosquitto Broker Addon reliably. IOT Link is able to connect and provide data; but then shortly after produces a socket error and reconnects again. I have another MQTT client (EventGhost) which connects to the MQTT Broker reliably. It seems like this issue is specific to IOT Link and the Home Assistant MQTT Broker Addon.

1593210514: New connection from 192.168.1.2 on port 1883.
1593210514: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210514: Client MQTTClient disconnected.
1593210514: New connection from 192.168.1.2 on port 1883.
1593210514: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210514: Socket error on client MQTTClient, disconnecting.
1593210518: New connection from 192.168.1.2 on port 1883.
1593210518: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210519: New connection from 192.168.1.2 on port 1883.
1593210519: Client MQTTClient already connected, closing old connection.
1593210519: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210580: Socket error on client MQTTClient, disconnecting.
1593210583: New connection from 192.168.1.2 on port 1883.
1593210583: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210583: Client MQTTClient disconnected.
1593210583: New connection from 192.168.1.2 on port 1883.
1593210583: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210585: Client MQTTClient disconnected.
1593210589: New connection from 192.168.1.2 on port 1883.
1593210589: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210590: Client MQTTClient disconnected.
1593210590: New connection from 192.168.1.2 on port 1883.
1593210590: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210590: Socket error on client MQTTClient, disconnecting.
1593210594: New connection from 192.168.1.2 on port 1883.
1593210594: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210594: Client MQTTClient disconnected.
1593210594: New connection from 192.168.1.2 on port 1883.
1593210594: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210655: Socket error on client MQTTClient, disconnecting.
1593210658: New connection from 192.168.1.2 on port 1883.
1593210658: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210658: Client MQTTClient disconnected.
1593210658: New connection from 192.168.1.2 on port 1883.
1593210658: New client connected from 192.168.1.2 as MQTTClient (p2, c1, k60, u'mkanet').
1593210661: Socket error on client MQTTClient, disconnecting.

Hi, did you find any solution to this?

@Jarpetnee, this issue is caused by IOT Link, not by HA’s MQTT broker. It looks like the developer for IOTLink finally abandon that project. The last time I saw him active on his IOTLink Discord server, he was busy playing a game on Twitch.

I finally had enough and decided to use Glances + Home Assistant REST sensors as an alternate solution. Glances offers much more information than IOT Link. It’s a bit of a PITA to configure all the REST sensors in Home Assistant; but, well worth it once its done. If you’re interested in going down this route, I can share my REST sensor configs from my Configuration.yaml. I even made a small script on my PC to take a screenshot every 15 seconds just like IOT Link; except with less resource consumption.

I still use HA’s MQTT broker to talk to Event Ghost without any issues

Cheers @mkanet . Yeah after another hour of troubleshooting after seeing your post I also decided to give it the boot. Probably for the best considering the other issues with memory leaks and security.

Would definitely be interested in seeing your Glances REST sensor configs if you have the time. I wish I had gone with Glances first time round.

Did you intend to use IOT Link for remote commands? If so do you recommend any alternatives? The main thing I want to do is remote shutdown.

Also how did you go about deleting all the IOTL/MQTT entities?

Many thanks.

Sorry for the late response. Please download my configuration.yaml example below. You can use it as a reference.

I use MQTT Broker Addon for Home Assistant --> EventGhost to use remote control commands for my Windows server. You can do pretty much anything you want using EventGhost. I use the MQTT addon for EventGhost. Sorry, I can’t remember how I removed my old IOT Link entities. If I remember, I’ll post here.

You’ll need to install Glances on the PC you have/had IOT Link installed on. Then, start Glances with the command line for example:

glances -w

configuration.yaml

The result could look something like the below screenshot. All the data you see below comes from Glances instead of IOT Link. Good luck!

I have the same problem

Could you post the configuration file here? The link is off

Please download it from the link below. You might want to download it soon so the link doesn’t break again. You would only need to modify it a little bit for your setup. All the hard part is already done. It includes all the sensors you would get in IOT-Link and more, Good luck. Let me know if you run into any issues.

configuration.yaml

If the link breaks… ty!

sensor:
  - platform: rest
    resource: http://192.168.1.2:61208/api/3/uptime
    value_template: '{{ value_json | regex_replace(find="[\"]", replace="") | regex_replace(find="(?<=( (\d{1})|(\d{2})):\d{2}):\d{2}", replace=" hours") }}'
    name: Horizon Uptime
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    resource: http://192.168.1.2:61208/api/3/cpu
    name: Horizon CPU
    value_template: '{{ value_json.total | round }}'
    unit_of_measurement: "%"
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    resource: http://192.168.1.2:61208/api/3/mem
    name: Horizon RAM
    value_template: '{{ value_json.percent | round }}'
    unit_of_measurement: "%"
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    resource: http://192.168.1.2:61208/api/3/memswap
    name: Horizon Pagefile
    value_template: '{{ value_json.percent | round }}'
    unit_of_measurement: "%"
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    name: gpu
    resource: http://192.168.1.2:61208/api/3/gpu
    value_template: '{{ ( value_json ) }}'
    json_attributes:
      - name
      - mem
      - proc
      - temperature
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    name: network
    resource: http://192.168.1.2:61208/api/3/network
    value_template: N/A
    json_attributes:
      - interface_name
      - time_since_update
      - cumulative_rx
      - rx
      - cumulative_tx
      - tx
      - cumulative_cx
      - cx
      - is_up
      - speed
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    resource: http://192.168.1.2:61208/api/3/fs
    name: Horizon C Drive Used
    value_template: '{{ value_json[0].percent | round }}'
    unit_of_measurement: "%"
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    resource: http://192.168.1.2:61208/api/3/fs
    name: Horizon E Drive Used
    value_template: '{{ value_json[1].percent | round }}'
    unit_of_measurement: "%"
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    name: diskio_0
    resource: http://192.168.1.2:61208/api/3/diskio
    value_template: '{{ ( value_json[0] ) }}'
    json_attributes:
      - time_since_update
      - disk_name
      - read_count
      - write_count
      - read_bytes
      - write_bytes
    verify_ssl: false
    timeout: 20
    scan_interval: 8
  - platform: rest
    name: diskio_1
    resource: http://192.168.1.2:61208/api/3/diskio
    value_template: '{{ ( value_json[1] ) }}'
    json_attributes:
      - time_since_update
      - disk_name
      - read_count
      - write_count
      - read_bytes
      - write_bytes
    verify_ssl: false
    timeout: 20
    scan_interval: 8

  - platform: template
    sensors:
      horizon_c_drive_read_bytes:
        value_template: '{{ ((state_attr("sensor.diskio_0", "read_bytes") / state_attr("sensor.diskio_0", "time_since_update") | int) / 1000000) | round (2) }}'
        # value_template: '{{ ((state_attr("sensor.diskio_0", "read_bytes") | int) / 1000000) | round (2) }}'
        unit_of_measurement: 'MB/s'
  - platform: template
    sensors:
      horizon_c_drive_write_bytes:
        value_template: '{{ ((state_attr("sensor.diskio_0", "write_bytes") / state_attr("sensor.diskio_0", "time_since_update") | int) / 1000000) | round (2) }}'
        # value_template: '{{ ((state_attr("sensor.diskio_0", "write_bytes") | int) / 1000000) | round (2) }}'
        unit_of_measurement: 'MB/s'
  - platform: template
    sensors:
      horizon_e_drive_read_bytes:
        value_template: '{{ ((state_attr("sensor.diskio_1", "read_bytes") / state_attr("sensor.diskio_1", "time_since_update") | int) / 1000000) | round (2) }}'
        # value_template: '{{ ((state_attr("sensor.diskio_1", "read_bytes") | int) / 1000000) | round (2) }}'
        unit_of_measurement: 'MB/s'
  - platform: template
    sensors:
      horizon_e_drive_write_bytes:
        value_template: '{{ ((state_attr("sensor.diskio_1", "write_bytes") / state_attr("sensor.diskio_1", "time_since_update") | int) / 1000000) | round (2) }}'
        # value_template: '{{ ((state_attr("sensor.diskio_1", "write_bytes") | int) / 1000000) | round (2) }}'
        unit_of_measurement: 'MB/s'
  - platform: template
    sensors:
      horizon_gpu_name:
        value_template: '{{ state_attr("sensor.gpu", "name") }}'
        # value_template: '{{ states.sensor.gpu.attributes["name"] }}'
  - platform: template
    sensors:
      horizon_gpu_memory:
        value_template: '{{ state_attr("sensor.gpu", "mem") | round }}'
        # value_template: '{{ states.sensor.gpu.attributes["mem"] | round }}'
        unit_of_measurement: "%"
  - platform: template
    sensors:
      horizon_gpu_processor:
        value_template: '{{ state_attr("sensor.gpu", "proc") }}'
        # value_template: '{{ states.sensor.gpu.attributes["proc"] }}'
        unit_of_measurement: "%"
  - platform: template
    sensors:
      horizon_gpu_temperature:
        value_template: '{{ state_attr("sensor.gpu", "temperature") }}'
        # value_template: '{{ states.sensor.gpu.attributes["temperature"] }}'
        unit_of_measurement: "°C"
  - platform: template
    sensors:
      horizon_download_speed:
        value_template: '{{ ((state_attr("sensor.network", "rx") / state_attr("sensor.network", "time_since_update") | int) * 8 / 1000000) | round (2) }}'
        unit_of_measurement: "Mbps"
  - platform: template
    sensors:
      horizon_upload_speed:
        value_template: '{{ ((state_attr("sensor.network", "tx") / state_attr("sensor.network", "time_since_update") | int) * 8 / 1000000) | round (2) }}'
        unit_of_measurement: "Mbps"
  - platform: template
    sensors:
      horizon_total_speed:
        value_template: '{{ ((state_attr("sensor.network", "cx") / state_attr("sensor.network", "time_since_update") | int) * 8 / 1000000) | round (2) }}'
        unit_of_measurement: "Mbps"