[Issue] Mqtt and tuya exceptions during startup - system only partially working

Yesterday I upgraded to 2022.11.2
today I restarted homeassistant and some integrations, especially the tuya don’t come up.
Please find an excerpt from the log file

2022-11-09 22:49:29.658 ERROR (Thread-2) [tuya_iot] error while get mqtt config
2022-11-09 22:49:29.676 ERROR (Thread-2) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/site-packages/tuya_iot/openmq.py", line 161, in run
time.sleep(self.mq_config.expire_time - 60)
AttributeError: 'NoneType' object has no attribute 'expire_time'

I have uninstalled the MQTT broker, nevertheless there are references to it in the logfile

my installation of home assistant is pretty new (2 weeks) and is running on a Raspberry 4

What could I do to resurrect my installation?

1 Like

I have the same issue. Everything was working fine before last update (2022.11.2), and yesterday, after a reboot, I got the same error and all of the devices provided by the Tuya Integration have disappeared.

I tried to delete the Tuya integration and set it up again, but it didn’t work, so I think the only option is to try a downgrade. I will investigate more and come back if I find anything.

I have the same issue.

Logger: homeassistant.config_entries
Source: components/tuya/__init__.py:224
First occurred: 15:39:09 (1 occurrences)
Last logged: 15:39:09

Error unloading entry [email protected] for tuya
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 498, in async_unload
    result = await component.async_unload_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 224, in async_unload_entry
    hass_data.device_manager.mq.stop()
  File "/usr/local/lib/python3.10/site-packages/tuya_iot/openmq.py", line 212, in stop
    self.client.disconnect()
AttributeError: 'NoneType' object has no attribute 'disconnect'

Home Assistant 2022.11.2
Supervisor 2022.10.2
Operating System 9.3
Frontend 20221108.0

Similar issue on my side as well - suddenly started today from 2022.11.1. Updating to 2022.11.2 doesn’t help.

Logger: homeassistant.config_entries
Source: components/tuya/__init__.py:79
First occurred: 10:42:11 PM (2 occurrences)
Last logged: 11:07:01 PM
Error setting up entry [email protected] for tuya

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 365, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 79, in async_setup_entry
    response = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/tuya_iot/openapi.py", line 222, in connect
    self.token_info = TuyaTokenInfo(response)
  File "/usr/local/lib/python3.10/site-packages/tuya_iot/openapi.py", line 41, in __init__
    token_response.get("t", 0)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
1 Like

Hi,

I have an update about my issue. The root cause was an expired subscription on the Tuya IoT Platform. I renewed it and now it’s now working again.

You can read more about this issue here: ℹ️ Tuya integration not working · Issue #80278 · home-assistant/core · GitHub

I hope it helps.

2 Likes

Thank you @Hydrocephalic
after renewing the Tuya subscription it works again :slightly_smiling_face:

a better error message would be of course great :wink:

How long renewing subscription takes to work? 4 hours and still getting the same error:

“Error unloading entry TUYA SMART LIFE for tuya” …