Another MQTT Thread - No Data - Home Assistant and MQTT Explorer

Hi, Im looking for help. I run Home Assistant and have the Unlobito integration installed (https://github.com/unlobito/ha-hildebrandglow). It has worked flawlessly for the past 3 months. In the last few days the integration has not been working for me. I get no data. I have uninstalled the integration/reinstalled, rolled back to previous backup of HA when the device was working etc all to no joy.

Today I sent an email to support and Jane came back saying MQTT had not been enabled on my account and Jane has now enabled it and it was not enabled before. This was definitely wrong as I requested MQTT access on 24/12/21 and had the integrations working fine ever since - I know I had MQTT access running as I was able to see power consumption which was being updated every 20 seconds or so and matched my display.

The MQTT connection worked for about 20 minutes this morning and around 9:05 has not worked since. Again, I have removed integrations/ restarted/ added integration etc but just cant get any data.


As a last ditch effort before posting here, I have tried using MQTT Explorer and connecting to glowmqtt.energyhive.com with my username and password same as the Bright app. First I tried with port 1883/no TLS enabled. I can connect but see no data (Bright app shows data). I then tried enabling TLS and changed to port 8883 and selected Validate Certificate but I get an 'Certificate has expired'. Im not sure how to pull the updated certificate though to add to MQTT Explorer?

Also, the outstanding issue remains for Home Assistant - when deleting the integration, I have completely removed the custom integration and all files - I would be grateful if someone can help on both MQTT Explorer/certificate and Home Assistant side

Comments

  • edited March 2022

    I have just tried reloading the Home Assistant integration but noticed the following error, I’m wondering if it might help point to where the problem lies?


    ```

    This error originated from a custom integration.


    Logger: root

    Source: custom_components/hildebrandglow/glow/mqttpayload.py:62 

    Integration: Hildebrand Glow (documentation) 

    First occurred: 25 March 2022, 10:47:30 pm (2 occurrences) 

    Last logged: 9:48:10 am


    Uncaught thread exception

    Traceback (most recent call last):

     File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner

      self.run()

     File "/usr/local/lib/python3.9/threading.py", line 910, in run

      self._target(*self._args, **self._kwargs)

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3591, in _thread_main

      self.loop_forever(retry_first_connection=True)

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever

      rc = self._loop(timeout)

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1164, in _loop

      rc = self.loop_read()

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1556, in loop_read

      rc = self._packet_read()

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2439, in _packet_read

      rc = self._packet_handle()

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle

      return self._handle_publish()

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish

      self._handle_on_message(message)

     File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message

      on_message(self, self._userdata, message)

     File "/config/custom_components/hildebrandglow/glow/__init__.py", line 136, in _cb_on_message

      payload = MQTTPayload(msg.payload)

     File "/config/custom_components/hildebrandglow/glow/mqttpayload.py", line 255, in __init__

      Meter(payload["gasMtr"]) if "03" in payload["gasMtr"]["0702"] else None

     File "/config/custom_components/hildebrandglow/glow/mqttpayload.py", line 224, in __init__

      self.reading_information_set = self.ReadingInformationSet(payload)

     File "/config/custom_components/hildebrandglow/glow/mqttpayload.py", line 62, in __init__

      self.supply_status = self.SupplyStatus(

     File "/usr/local/lib/python3.9/enum.py", line 384, in __call__

      return cls.__new__(cls, value)

     File "/usr/local/lib/python3.9/enum.py", line 702, in __new__

      raise ve_exc

    ValueError: 'FF' is not a valid Meter.ReadingInformationSet.SupplyStatus

    ```

  • edited March 2022

    So, to try moving this forward, I have created a bridged MQTT connection from my instance of MQTT to Glow MQTT. I have:

    1. In the local MQTT share (/share/mosquitto/) I have created 3 files; 'accesscontrollist', 'acl.conf', 'mosquitto.conf' based on info from https://gist.github.com/ndfred/5bb51b567f8cfaf2bb06da6393169321:

    'accesscontrolllist' file contains:

    user mqtt-user
    topic readwrite #
    


    'acl.conf' file contains:

    acl_file /share/mosquitto/accesscontrollist
    


    mosquitto.conf file contains:

    connection glowmqtt
    address glowmqtt.energyhive.com:8883
    remote_username ***USER_NAME FROM BRIGHT APP***
    remote_password ***PASSWORD FROM BRIGHT APP***
    bridge_capath /etc/ssl/certs/
    topic ***ZIGBEE GLOW STICK DEVICE ID FROM BRIGHT APP*** in 0
    


    When I restart Mosquitto broker the log is filling up with the following error message repeated:

    1648382926: Socket error on client local.core-mosquitto.glowmqtt, disconnecting.
    1648382931: Connecting bridge glowmqtt (glowmqtt.energyhive.com:8883)
    

    Does this not mean the issue is at Glow side?

  • It would appear that the certificate is indeed expired, or at least signed by an authority that I don't have trusted on my HA install. Here's what works for me.

    Mosquitto options in HA

    logins:
      - username: glow
      - password: somethingsecrethere
    customize:
      active: true
      folder: mosquitto
    etc...
    

    I then created a glow.conf file in the \\homeassistant\share folder that I can access with SMB, though I think you can find it under /usr/share/hassio/share on the HA filesystem.

    connection glowmqtt
    address glowmqtt.energyhive.com:8883
    remote_username EMAIL
    remote_password PASSWORD
    local_password somethingsecrethere
    local_username glow
    bridge_capath /etc/ssl/certs/
    bridge_insecure true
    topic SMART/HILD/deviceMAC in 0
    

    By the way to see the data in MQTT explorer you'll need to add a subscription under the 'advanced' settings for the MQTT connection. SMART/HILD/DeviceMAC/# should do the trick.

  • In the process of integrating into HA which until I bite the bullet and but a Raspberry Pi is running under docker on a QNAP NAS. HA is running fine, I've set up mosquitto in a separate container and can connect to it using MQTT Explorer. I've set up a bridge and in Explorer it shows as connected but I can't see any data being pulled through, any ideas?

  • Got the data now, my education with MQTT and HA continues.

Sign In or Register to comment.