Open jonwaland opened 2 months ago
Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
tuya documentation tuya source (message by IssueLinks)
additional log, presumably related:
2024-04-10 18:15:08.600 ERROR (MainThread) [homeassistant.components.automation.light_turn_on_the_extra_light_in_powder_room_when_is_use] LIGHT: turn on the extra light in powder room when is use: Error executing script. Unexpected error for call_service at pos 1: network error:(-9999999) sign invalid
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 507, in _async_step
await getattr(self, handler)()
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
response_data = await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/homeassistant/__init__.py", line 144, in async_handle_turn_service
await asyncio.gather(*tasks)
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
response_data = await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 996, in entity_service_call
raise result from None
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1580, in async_request_call
return await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1655, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/tuya/switch.py", line 711, in turn_on
self._send_command([{"code": self.entity_description.key, "value": True}])
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/tuya/base.py", line 275, in _send_command
self.device_manager.send_commands(self.device.id, commands)
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/manager.py", line 93, in send_commands
return self.device_repository.send_commands(device_id, commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/device.py", line 180, in send_commands
self.api.post(f"/v1.1/m/thing/{device_id}/commands", None, {"commands": commands})
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
return self.__request("POST", path, params, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/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
2024-04-10 18:15:08.613 ERROR (MainThread) [homeassistant.components.automation.light_turn_on_the_extra_light_in_powder_room_when_is_use] While executing automation automation.light_turn_on_the_extra_light_in_powder_room_when_is_use
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/automation/__init__.py", line 726, in async_trigger
return await self.action_script.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 1713, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 457, in async_run
await self._async_step(log_exceptions=False)
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 509, in _async_step
self._handle_exception(
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 539, in _handle_exception
raise exception
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 507, in _async_step
await getattr(self, handler)()
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
response_data = await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/homeassistant/__init__.py", line 144, in async_handle_turn_service
await asyncio.gather(*tasks)
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
response_data = await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 996, in entity_service_call
raise result from None
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1580, in async_request_call
return await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1655, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/tuya/switch.py", line 711, in turn_on
self._send_command([{"code": self.entity_description.key, "value": True}])
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/tuya/base.py", line 275, in _send_command
self.device_manager.send_commands(self.device.id, commands)
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/manager.py", line 93, in send_commands
return self.device_repository.send_commands(device_id, commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/device.py", line 180, in send_commands
self.api.post(f"/v1.1/m/thing/{device_id}/commands", None, {"commands": commands})
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
return self.__request("POST", path, params, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/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
Is there a status on this? I have to reload the integration every few hours to get it to respond again. I even downgraded Home Assistant Core 2024.3.1 but that didn't fix the problem.
I even downgraded Home Assistant Core 2024.3.1 but that didn't fix the problem.
its a problem with Tuya, not Home Assistant. Which is unfortunate, as that means we are dependent on https://github.com/tuya and https://github.com/zlinoliver (@zlinoliver) to give feedback at least.
2024-05-14 20:14:59.186 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140184982998848] Unexpected exception
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
conn.connect()
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 1042, in _create
self.do_handshake()
File "/usr/lib/python3.12/ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.12/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/connectionpool.py", line 799, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='apigw.tuyaeu.com', port=443): Max retries exceeded with url: /v1.1/m/thing/02000855807d3a4f4853/commands (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2738, in async_call
response_data = await coro
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2779, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 975, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1047, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1688, in async_turn_off
await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/tuya/switch.py", line 715, in turn_off
self._send_command([{"code": self.entity_description.key, "value": False}])
File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/tuya/base.py", line 275, in _send_command
self.device_manager.send_commands(self.device.id, commands)
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/manager.py", line 93, in send_commands
return self.device_repository.send_commands(device_id, commands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/device.py", line 180, in send_commands
self.api.post(f"/v1.1/m/thing/{device_id}/commands", None, {"commands": commands})
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 192, in post
return self.__request("POST", path, params, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/tuya_sharing/customerapi.py", line 107, in __request
response = self.session.request(
^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/homeassistant/lib/python3.12/site-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='apigw.tuyaeu.com', port=443): Max retries exceeded with url: /v1.1/m/thing/02000855807d3a4f4853/commands (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))
Same problem here. I have to re-authenticate daily
@frenck - I know this isn't your problem - but do you have any leverage?
I'm having the same issue. For me it started after I had to re-authenticate using the the new tuya authentication method. Since then, when I turn on a light in the app. I have to wait 10 seconds, then click the button again. At that point it retrieves the correct status for the switch.
But if I'm not at the house, I have to reload the integration to get the statuses to be correct.
It also causes automations to stop working where the status of a switch is a condition in the automation.
It's not that it's not usable this way. But it is to the point that there doesn't seem to be much point to trying to make it work like this.
FWIW I had the network error:(-9999999) sign invalid error. I just reloaded the integration and it worked though. Hope it helps someone
the reload forces a resync. until the next error.
This not working forced me to finally work on getting localtuya working. I was sick of automations not working when the status wouldn't update.
It was a bit time consuming to get all the devices added and then automations updated. But it's working nicely now.
Im getting the same error. I know it appears to be a cloud issue, but can we get the integration to handle this error and requeue it for retry? How do you get the secrets nowadays for localtuya?
I've just cut across to https://github.com/xZetsubou/hass-localtuya/
Same issue here has anyone got a work around at this time ?
I setup localtuya and everything has been working as expected again.
I also switched to Tuya Local a few days ago- Ditto that it was a little annoying having to switch over all my entities, but well worth it to finally have my devices reporting correct states again after several months. (Plus the added bonus of devices updating much faster now without relying on the cloud is very nice)
The problem
TUYA Cloud is doesn't always respond, leading to incorrect device state, and devices showing as unavailable.
What version of Home Assistant Core has the issue?
core-2024.4.2
What was the last working version of Home Assistant Core?
core-2024.2.1
What type of installation are you running?
Home Assistant Core
Integration causing the issue
tuya
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tuya
Diagnostics information
config_entry-tuya-5f1d5cd1692d89477e6bd1422092e741.json
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
debug logs attached above, whilst turning switches on and off via GUI, and via the actual switch. State changes from using the switch are frequently missed. Using the GUI the device is always toggled (eg cloud received the command), but doesn't always respond with a state update.
also see https://github.com/home-assistant/core/issues/114209 https://github.com/home-assistant/core/issues/114100 https://github.com/home-assistant/core/issues/114048 https://github.com/home-assistant/core/issues/113955
which may or may not be related