Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Exceptions #212

Closed
3 tasks
Lurker00 opened this issue Apr 27, 2024 · 2 comments
Closed
3 tasks

[Bug]: Exceptions #212

Lurker00 opened this issue Apr 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Lurker00
Copy link

Lurker00 commented Apr 27, 2024

LocalTuya Version

3.2.5.2b6

Home Assistant Version

2024.4.3

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

Exceptions in the log, 2 places of one case. I've included a log record for the failed connection with device mentioned in the 1st exception.

The first one looks like race condition, but can be a call without a check:

self._last_command_sent = time.time()
self.transport.write(data)

self.transport is None at the time of calling.

The second case is a related problem:

transport = self.transport
self.transport = None
transport.close()

Steps to reproduce.

Don't know

Relevant log output

2024-04-27 23:18:06.115 WARNING (MainThread) [custom_components.localtuya.coordinator] [bf2...38k] Connect to 192.168.0.32 failed:

2024-04-27 23:18:16.161 ERROR (MainThread) [custom_components.localtuya.core.pytuya] [bf2...38k] Heartbeat failed ('NoneType' object has no attribute 'write'), disconnecting
Traceback (most recent call last):
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 896, in heartbeat_loop
await self.heartbeat()
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1056, in heartbeat
return await self.exchange(HEART_BEAT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1017, in exchange
await self.transport_write(enc_payload, delay)
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 885, in transport_write
self.transport.write(data)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'write'

024-04-27 23:25:06.502 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 910, in heartbeat_loop
transport.close()
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'close'

Diagnostics information.

No response

@Lurker00 Lurker00 added the bug Something isn't working label Apr 27, 2024
@xZetsubou xZetsubou added the master/next-release Fixed in master branch, Will be ready in the next release label Apr 27, 2024
@xZetsubou
Copy link
Owner

Now that you mentioned it I forgot push the fix on GitHub thanks 👍

Copy link

This issue was closed because it was resolved on the release:

@github-actions github-actions bot added stale and removed master/next-release Fixed in master branch, Will be ready in the next release stale labels May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants