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]: Exception in async def exchange() #214

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

[Bug]: Exception in async def exchange() #214

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

Comments

@Lurker00
Copy link

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?

The line numbers in the log are for my source code. They correspond to:

await self.transport_write(enc_payload, delay)
msg = await self.dispatcher.wait_for(seqno, payload.cmd)

Note, that close() performs

if self.dispatcher is not None:
self.dispatcher.abort()
self.dispatcher = None

and, probably, can be called concurrently.

Steps to reproduce.

Don't know

Relevant log output

2024-04-28 19:59:57.100 ERROR (MainThread) [custom_components.localtuya.core.pytuya] [bf2...38k] Heartbeat failed ('NoneType' object has no attribute 'wait_for'), disconnecting
Traceback (most recent call last):
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 900, in heartbeat_loop
await self.heartbeat()
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1061, in heartbeat
return await self.exchange(HEART_BEAT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/localtuya/core/pytuya/__init__.py", line 1023, in exchange
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'wait_for'

Diagnostics information.

No response

@Lurker00 Lurker00 added the bug Something isn't working label Apr 29, 2024
@xZetsubou
Copy link
Owner

xZetsubou commented Apr 29, 2024

It seems "transport_write" closed the connection, thanks for the catch 👍

edit: resolved in 6d9491d

@xZetsubou xZetsubou added the master/next-release Fixed in master branch, Will be ready in the next release label Apr 30, 2024
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