Core: TUYA Error in log with 0.117.0

Created on 29 Oct 2020  路  13Comments  路  Source: home-assistant/core

The problem


After upgrade HA to 0.117.0 i've loop error for tuya device.

Device work but, after few time, sometime stop to work

Environment

  • Home Assistant Core release with the issue: 0.117.0
  • Last working Home Assistant Core release (if known): 0.116.4
  • Operating environment (OS/Container/Supervised/Core): HA Core in venv
  • Integration causing this issue: Tuya
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/tuya/

Problem-relevant configuration.yaml

No configuration

Traceback/Error logs

Oct 28 23:56:48 raspberrypi hass[462]: 2020-10-28 23:56:48 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.bf59303c89ae38e766znbo fails
Oct 28 23:56:48 raspberrypi hass[462]: Traceback (most recent call last):
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
Oct 28 23:56:48 raspberrypi hass[462]:     await self.async_device_update()
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 474, in async_device_update
Oct 28 23:56:48 raspberrypi hass[462]:     raise exc
Oct 28 23:56:48 raspberrypi hass[462]:   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
Oct 28 23:56:48 raspberrypi hass[462]:     result = self.fn(*self.args, **self.kwargs)
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/tuya/__init__.py", line 255, in update
Oct 28 23:56:48 raspberrypi hass[462]:     self._tuya.update()
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/devices/switch.py", line 16, in update
Oct 28 23:56:48 raspberrypi hass[462]:     return self._update(use_discovery=True)
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/devices/base.py", line 84, in _update
Oct 28 23:56:48 raspberrypi hass[462]:     devices = self.api.discovery()
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 188, in discovery
Oct 28 23:56:48 raspberrypi hass[462]:     response = self._request("Discovery", "discovery")
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 267, in _request
Oct 28 23:56:48 raspberrypi hass[462]:     self._raise_frequently_invoke(
Oct 28 23:56:48 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 292, in _raise_frequently_invoke
Oct 28 23:56:48 raspberrypi hass[462]:     raise TuyaFrequentlyInvokeException(message)
Oct 28 23:56:48 raspberrypi hass[462]: tuyaha.tuyaapi.TuyaFrequentlyInvokeException: Method [Discovery] fails 9 time(s) using poll interval 60.0 - error: you can discovery once in 600 seconds
Oct 28 23:59:43 raspberrypi hass[462]: 2020-10-28 23:59:43 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Oct 28 23:59:43 raspberrypi hass[462]: Traceback (most recent call last):
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/tuya/__init__.py", line 153, in async_poll_devices_update
Oct 28 23:59:43 raspberrypi hass[462]:     device_list = await hass.async_add_executor_job(_get_updated_devices)
Oct 28 23:59:43 raspberrypi hass[462]:   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
Oct 28 23:59:43 raspberrypi hass[462]:     result = self.fn(*self.args, **self.kwargs)
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/tuya/__init__.py", line 146, in _get_updated_devices
Oct 28 23:59:43 raspberrypi hass[462]:     tuya.poll_devices_update()
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 166, in poll_devices_update
Oct 28 23:59:43 raspberrypi hass[462]:     return self.discover_devices()
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 207, in discover_devices
Oct 28 23:59:43 raspberrypi hass[462]:     devices = self.discovery()
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 188, in discovery
Oct 28 23:59:43 raspberrypi hass[462]:     response = self._request("Discovery", "discovery")
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 267, in _request
Oct 28 23:59:43 raspberrypi hass[462]:     self._raise_frequently_invoke(
Oct 28 23:59:43 raspberrypi hass[462]:   File "/srv/homeassistant/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 292, in _raise_frequently_invoke
Oct 28 23:59:43 raspberrypi hass[462]:     raise TuyaFrequentlyInvokeException(message)
Oct 28 23:59:43 raspberrypi hass[462]: tuyaha.tuyaapi.TuyaFrequentlyInvokeException: Method [Discovery] fails 1 time(s) using poll interval 60.0 - error: you can discovery once in 600 seconds

Additional information

some friends have same problem

tuya

Most helpful comment

This is consequence of TuyaHA library update and will be solved when PR #41375 will be released.

All 13 comments

I have the same problem ..

Hey there @ollo69, mind taking a look at this issue as its been labeled with an integration (tuya) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

Exactly the same here with HA 0.117.0.
How to change the polling interval from 60s to 600s since Tuya configuration through config.yaml is discouraged?

This is consequence of TuyaHA library update and will be solved when PR #41375 will be released.

Just tested @ollo69 PR and it resolves this issue. Thanks!

I have a similar issue with Tuya not working on 0.117.2

Logger: homeassistant.helpers.entity
Source: components/tuya/__init__.py:255
First occurred: 8:47:52 PM (6 occurrences)
Last logged: 9:02:48 PM

Update for climate.abc123 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, *self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 255, in update
self._tuya.update()
File "/usr/local/lib/python3.8/site-packages/tuyaha/devices/base.py", line 134, in update
return self._update(use_discovery)
File "/usr/local/lib/python3.8/site-packages/tuyaha/devices/base.py", line 84, in _update
devices = self.api.discovery()
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 188, in discovery
response = self._request("Discovery", "discovery")
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 267, in _request
self._raise_frequently_invoke(
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 292, in _raise_frequently_invoke
raise TuyaFrequentlyInvokeException(message)
tuyaha.tuyaapi.TuyaFrequentlyInvokeException: Method [Discovery] fails 1 time(s) using poll interval 60.0 - error: you can discovery once in 600 seconds

The problem will persist until PR #41375 is accepted - it wasn't included in 0.117.2.

If you need a temp fix, and you don't mind getting your hands a little dirty, you can try the following:
1) Download the tuya files from @olla69 repo here
2) Add the tuya folder/files to the custom_component folder of you home assistant config (you may have to create the custom_component folder if it doesn't exist yet)
3) Reboot Home Assistant

Or don't bother with this if you can wait until it's officially included.

is it merged to 117.3 ? dont see it in rls notes while its mergeD?

No, its not included in 0.117.3

It's not included also in 0.117.4

Not in 0.117.5

The fix is in the dev branch, not master, so I don't think it would be released in any of 0.117.x. 0.118.0 maybe.

PR's that contains new features will be a part of the next main release (0.118.0) in this case.
Closing as https://github.com/home-assistant/core/pull/41375 has been merged.

Was this page helpful?
0 / 5 - 0 ratings