IOT Link Entities showing unavailable using MQTT

I am attempting to setup IOT Link to view the stats of 3 systems I have on my network. My setup consist of running Home Assistant in a VM on Windows 10. I have install the IOT executable and verified the service is running with no issues. I have the Mosquitto integration configured as well with the following info:

Broker: core-mosquitto
Port: 1883
Username: Mqtt
Password: Password

MQTT Options set as default including Network Discovery being enabled.

In Supervisor, MQTT is configured with the following info:
logins: []
customize:
active: true
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

I am not sure if my issue is with the credentials or not. I created a user in HA:
Username: Mqtt
Password: Password

The configuration.yaml file on the system (IOT Link in Program Data) is configured as well:

credentials:
username: mqtt
password: password
########################################################################

TCP Connection Settings

########################################################################
tcp:
enabled: true
hostname: 192.168.45.131
port: 1883
secure: false
tlsConfig:
allowUntrustedCertificates: false
ignoreCertificateChainErrors: false
ignoreCertificateRevocationErrors: false
caCertificate:
clientCertificate:
clientCertificatePassword:

I may be getting caught up as well on the info for my broker installation. The IP for the system that host the VM is 192.168.45.39. The IP for the VM is 192.168.45.131. I have HA accessible through Nginx Proxy Manager. The hostname of my system is SNORGESERVER. I have entered the IP address of both and the hostname into the location for the hostname under Tcp in the configuration.yaml. I also tried core-mosquitto in that location as well. Even the name of my HA instance (ex. https://HA web address)

The log from the Supervisor is as follows:
[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] mosquitto.sh: executing…
[08:47:46] INFO: Certificates found: SSL is available
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing…
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[08:47:47] INFO: Starting NGINX for authentication handling…
[services.d] done.
[08:47:47] INFO: Starting mosquitto MQTT broker…
1622468867: Loading config file /share/mosquitto/acl.conf
1622468867: mosquitto version 1.6.12 starting
1622468868: |-- *** auth-plug: startup
[08:47:48] INFO: Successfully send discovery information to Home Assistant.
[08:47:49] INFO: Successfully send service information to the Supervisor.
1622468867: Config loaded from /etc/mosquitto/mosquitto.conf.
1622468867: Loading plugin: /usr/share/mosquitto/auth-plug.so
1622468868: ├── Username/password checking enabled.
1622468868: ├── TLS-PSK checking enabled.
1622468868: └── Extended authentication not enabled.
1622468868: Opening ipv4 listen socket on port 1883.
1622468868: Opening ipv6 listen socket on port 1883.
1622468868: Opening websockets listen socket on port 1884.
1622468868: Opening ipv4 listen socket on port 8883.
1622468868: Opening ipv6 listen socket on port 8883.
1622468868: Opening websockets listen socket on port 8884.
1622468868: Warning: Mosquitto should not be run as root/administrator.
1622468868: mosquitto version 1.6.12 running
1622468868: New connection from 127.0.0.1 on port 1883.
1622468868: Socket error on client , disconnecting.
1622470254: New connection from 172.30.32.1 on port 1883.
{“result”: “ok”, “data”: {}}1622470258: New client connected from 172.30.32.1 as 7eokY3rCZZAMky8ErwyxI6 (p2, c1, k60, u’Mqtt’).
1622470668: Saving in-memory database to /data/mosquitto.db.
1622472469: Saving in-memory database to /data/mosquitto.db.
1622474270: Saving in-memory database to /data/mosquitto.db.
1622474410: New connection from 192.168.45.39 on port 1883.
{“result”: “ok”, “data”: {}}1622474410: New client connected from 192.168.45.39 as SNORGESERVER (p2, c1, k60, u’mqtt’).
1622474459: Socket error on client 7eokY3rCZZAMky8ErwyxI6, disconnecting.
1622474472: New connection from 172.30.32.1 on port 1883.
{“result”: “ok”, “data”: {}}1622474476: New client connected from 172.30.32.1 as 6CHQbdqaKeOzobv99dg4A6 (p2, c1, k60, u’Mqtt’).
1622476071: Saving in-memory database to /data/mosquitto.db.
1622477872: Saving in-memory database to /data/mosquitto.db.
1622479673: Saving in-memory database to /data/mosquitto.db.
1622480966: New connection from 172.30.32.1 on port 1883.
{“result”: “ok”, “data”: {}}1622480966: New client connected from 172.30.32.1 as 2gcZBmhl46irWD3XsQ7N9O (p1, c1, k60, u’Mqtt’).

The log from IOT Link shows:
[GATSON\SNORGESERVER][2021-05-31 10:19:58 -05:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Disconnect(True) - Trying to disconnect from broker: tcp://core-mosquitto:1883.
[GATSON\SNORGESERVER][2021-05-31 10:19:58 -05:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::Connect() - Trying to connect to broker: tcp://core-mosquitto:1883.
[GATSON\SNORGESERVER][2021-05-31 10:19:58 -05:00][SYSTEM][IOTLinkService.Service.MQTT.MQTTClient]: ALL YOUR MQTT TOPICS WILL START WITH iotlink/gatson/snorgeserver/
[GATSON\SNORGESERVER][2021-05-31 10:20:00 -05:00][INFO][IOTLinkService.Service.MQTT.MQTTClient]: MQTTClient::OnDisconnectedHandler() - MQTT Disconnected
[GATSON\SNORGESERVER][2021-05-31 10:20:08 -05:00][WARNING][IOTLinkService.Service.MQTT.MQTTClientManager]: MQTTClientManager::VerifyConnection() - MQTT Connection Bro

Regardless of the broker, I continue to get the same message. I have configured ACL as well and placed the acl.conf and accesscontrollist in /usr/share/hassio/share/mosquitto using Samba share. At this point, I feel like I’m spinning my wheels and going no where. I am looking for any insight, as every entity (IOT Link related) simply shows unavailable. Thank you in advance!

Hi,

Couple of thoughts to start.

  1. do you currently use the mqtt broker for any other integrations. By that i mean, have you confirmed that outside of what you are trying with iotlink, the mqtt broker is working & processing data? If you havn’t already, i recommend a great product named MQTT Explorer (http://mqtt-explorer.com/) for lifting the curtain on what’s happening inside your broker. I have found this an invaluable tool for this kind of thing. If you haven’t already, install it on the system where you want to collect iotlink data from. Can you make the connection to your broker?
  2. Also good practice to create a new home-assistant user specific for use with your iotlink systems. Maybe using the acl based config for your broker is overkill for now. You could try without.
    Cheers

Hi @nickh66,

Thank you for your response. I was able to install and configure MQTT Explorer on my system and I was able to successfully pull the info I was looking to add to HA:

Thank you for that recommendation! This was before I made any changes to ACL as well. I will kill the ACL config when i get back home as well. But the MQTT username I created was built in HA specifically for this instance. Are you saying I should change the name?

Hi,

This screen shot shows that your iotlink client is sending data to your mqtt broker successfully. So, essentially you need not make any changes to your mqtt broker configuration or the account the iotlink client users to connect.

So i’m guessing the missing link now is that the Mosquitto integration in Home Assistant is not automatically discovering your iotlink data?

  • In MQTT Explorer, if you expand the ‘homeassistant’ node, do you see something like the screen shot of my system? This is the data needed by the MQTT discovery to create the corresponding entitites in HA. If you don’t have that then auto-discovery won’t happen.

image

  • Enabling or disabling ‘discovery’ is a two part thing. The image below is from integration option to enable discovery.

image
image

  • Also, discovery is an option in the iotlink configuration.yaml too. It’s on be default so it’s probably not that.

If it looks like discovery is correctly set then…i’m not too sure what to do next. Other than manually creating the HA binary_sensors, sensors & cameras. The iot link documentation does cover how to manually create those entries in your HA yaml config.

Let me know what you find.

cheers
Nick

1 Like

Hello again!

I was able to see everything on my end like just like in your screen shot. I even verified my integration was set for newly added entities as well. But you’re last question made me realize the added entities in the configuration.yaml was not “standard”. I removed them, restarted HA and VOILA! They showed just fine in my dashboard. I really appreciate your assistance. You just saved me a huge amount of time and stress. Thank you sir!

You’re very welcome. Good luck with your HA & Iotlink journey. I’m really liking iotlink so far & finding some really good use cases in my environment.
Cheers
Nick