ecowitt2mqtt: MQTT stops publishing after some time on 2022.06.xx

Running 2022.06.xx versions and dev I appear to get a timeout and crash error publishing to mqtt. Had previously run versions 2022.05.xx and 2022.04.xx with no issues. Have just downgraded back to 2022.05 to confirm it is nothing else on my end that could be causing this and will update if I see anything error on the old version. Running this as a docker container on ubuntu publishing to eclipse-mosquitto.

Here is the last of the log file when it stops/freezes:

2022-06-15 13:58:56,990 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:03,063 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:25,397 | asyncio | ERROR | Task exception was never retrieved
future: <Task finished name='Task-239090' coro=<HomeAssistantDiscoveryPublisher.async_publish() done, defined at /venv/lib/python3.10/site-packages/ecowitt2mqtt/helpers/publisher/hass.py:357> exception=PublishError('Error while publishing to Home Assisstant MQTT Discovery: Operation timed out')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 214, in wait
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/asyncio_mqtt/client.py", line 390, in _wait_for
    return await asyncio.wait_for(fut, timeout=timeout, **kwargs)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/ecowitt2mqtt/helpers/publisher/hass.py", line 378, in async_publish
    await asyncio.gather(*futures)
  File "/venv/lib/python3.10/site-packages/asyncio_mqtt/client.py", line 99, in decorated
    return await method(self, *args, **kwargs)
  File "/venv/lib/python3.10/site-packages/asyncio_mqtt/client.py", line 285, in publish
    await self._wait_for(confirmation.wait(), timeout=timeout)
  File "/venv/lib/python3.10/site-packages/asyncio_mqtt/client.py", line 392, in _wait_for
    raise MqttError("Operation timed out")
asyncio_mqtt.error.MqttError: Operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/ecowitt2mqtt/helpers/publisher/hass.py", line 382, in async_publish
    raise PublishError(
ecowitt2mqtt.helpers.publisher.PublishError: Error while publishing to Home Assisstant MQTT Discovery: Operation timed out
2022-06-15 13:59:25,727 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:25,737 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:27,050 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:33,075 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:40,934 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:45,089 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 13:59:51,297 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-15 14:00:07,022 | asyncio | ERROR | Task exception was never retrieved
future: <Task finished name='Task-241525' coro=<HomeAssistantDiscoveryPublisher.async_publish() done, defined at /venv/lib/python3.10/site-packages/ecowitt2mqtt/helpers/publisher/hass.py:357> exception=PublishError('Error while publishing to Home Assisstant MQTT Discovery: [code:4] The client is not currently connected.')>
Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/ecowitt2mqtt/helpers/publisher/hass.py", line 378, in async_publish
    await asyncio.gather(*futures)
  File "/venv/lib/python3.10/site-packages/asyncio_mqtt/client.py", line 99, in decorated
    return await method(self, *args, **kwargs)
  File "/venv/lib/python3.10/site-packages/asyncio_mqtt/client.py", line 277, in publish
    raise MqttCodeError(info.rc, "Could not publish message")
asyncio_mqtt.error.MqttCodeError: [code:4] The client is not currently connected.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/ecowitt2mqtt/helpers/publisher/hass.py", line 382, in async_publish
    raise PublishError(
ecowitt2mqtt.helpers.publisher.PublishError: Error while publishing to Home Assisstant MQTT Discovery: [code:4] The client is not currently connected.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 34 (16 by maintainers)

Most upvoted comments

Trying the new version 2022.07.4 now. Will update status soon.

EDIT: A couple hours in and no issues. Lasted longer than prior versions so far! Will update in 24 hours if still going.

I got it to error again but didn’t catch a verbose log. It appears to simply lose the mqtt client connection and never recover. Just dies at the final line. Going to restart with a verbose log and see if I can catch when it dies.

2022-06-16 22:01:12,995 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-16 22:01:19,003 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-16 22:01:20,721 | ecowitt2mqtt | INFO | Published to Home Assistant MQTT Discovery
2022-06-16 22:01:33,129 | ecowitt2mqtt | ERROR | Unable to publish payload: Error while publishing to Home Assisstant MQTT Discovery: [code:4] The client is not currently connected.

Ok. I am going to keep messing with stuff to try and debug. Realized I was using the deprecated mqtt environment variables so have updated those and will try to generate a log with errors if possible (unless of course getting rid of the deprecated env. variables is a magic fix).

Yes, using the image linked. Re-pulled the dev version just now to confirm and am running verbose logs. Typically runs about an hour or so until freezes up. Will post the logs once it happens.