core: Tuya integration "Failed to set up" - 2024.2.0BETA only, please don't use this thread for earlier versions of HA

The problem

I’m running 2024.2.0b1 and trying the new Tuya integration. My device was discovered, I followed the steps, using QR code, etc. and got the device integrated, however, after a couple of minutes it fails with a message “Failed to set up” and even restarting didn’t solve the issue. I can remove the integration and repeat the process. It will again work for a couple of minutes and then fail again.

What version of Home Assistant Core has the issue?

2024.2.0b1

What was the last working version of Home Assistant Core?

N/A

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:442
First occurred: 10:49:23 (1 occurrences)
Last logged: 10:49:23

Error setting up entry xxxxxxxxxx@xxxxxxxxxx for tuya
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 442, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 67, in async_setup_entry
    await hass.async_add_executor_job(manager.update_device_cache)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/manager.py", line 58, in update_device_cache
    homes = self.home_repository.query_homes()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/home.py", line 17, in query_homes
    response = self.api.get(f"/v1.0/m/life/users/homes")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 176, in get
    return self.__request("GET", path, params, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 121, in __request
    raise Exception(f"network error:({ret['code']}) {ret['msg']}")
Exception: network error:(-9999999) sign invalid

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 44 (6 by maintainers)

Most upvoted comments

Good catch from @ccorderor. I’ve repeated the test and while I don’t enable the sensors (Current, Power or Voltage), the Switch works pretty well and the integration remains operational. As soon one of those entities are enabled, the integration fails.

For context, my device is a Teckin SP22 with stock firmware.

I think I found the root cause on this one; seems fixable.

same problem here hassio 2024.1.6

I’ve had/have the same issues: the integration stopped working after an update (none of my tuya devices appeared in Home Assistant -HA-) and it failed to set up again. I deleted the cache in the Tuya app, changed the password, re-initialised everything in HA and now it loads without any errors but the issue still remains: HA can’t find any tuya devices or entities.

running HA Core 2024.1.6 - Supervisor 2023.12.1- Operating System 11.4

This issue is related to the beta 2024.2, not earlier versions

I can confirm the issue is when you enable the entities.

And I didn’t have to restart home assistant. Just remove the integration and set it up again

Remove the integration and reboot Home Assistant. It will get detected again, so follow the same steps to set it uol but this time don’t try to enable any entity other the the ones already enabled as enabling this will brake it again. Then wait for a fix to this. 😉

I didn’t enable anything individually. But I have 40+ devices and I’m not sure how to tell if a specific one is causing the exception.

Won’t Work With Mine. I have trouble shooted so much and i get no where.

Same issue here with 2024.2.0b3

Tuya with dev account stopped working on 2024.1.6 so i switched to beta, integration works fine until activating sensors, then im getting the following error:

File “/usr/local/lib/python3.12/site-packages/tuya_sharing/customerapi.py”, line 121, in __request raise Exception(f"network error:({ret[‘code’]}) {ret[‘msg’]}") Exception: network error:(-9999999) sign invalid

I already did set up the integration again but that wont help.

Same problem, can not enable any of the sensors without failing. Switching works fine. Did all the steps to try an fix, no go. If I do a reload of integration it will also fail.