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

Error during scrape #87

Open
Jared0430 opened this issue May 10, 2024 · 2 comments
Open

Error during scrape #87

Jared0430 opened this issue May 10, 2024 · 2 comments

Comments

@Jared0430
Copy link

Jared0430 commented May 10, 2024

Hi, I have just purchased some Tuya smart plugs and am trying to get them connected with this package.

I grabbed my local keys using npx @tuyapi/cli wizard and setup my config file, but I am getting this error every time I try to scrape

ts=2024-05-10T16:59:24.467Z caller=exporter.go:56 level=warn msg="error during scrape" device=PC error=EOF
ts=2024-05-10T16:59:24.673Z caller=exporter.go:56 level=warn msg="error during scrape" device=AC error=EOF
ts=2024-05-10T16:59:24.867Z caller=exporter.go:56 level=warn msg="error during scrape" device=Server error=EOF

Let me know if there's a way I can get more info and thanks for the help!

EDIT: I've done some tracing and the issue is coming from pkg/proto/client.go:

func (p *proto) exchange() ([]byte, error) {
        // ...

	inbuffer := make([]byte, 256)
	read, err := conn.Read(inbuffer) // <--

if that helps debug the issue, I'm not very familiar with Go

@rkosegi
Copy link
Owner

rkosegi commented May 10, 2024

Hi @Jared0430, EOF during read means that device closed connection before read completes. Not sure what to do with that 🤷‍♂️

@Jared0430
Copy link
Author

I also tried connecting to my device with codetheweb/tuyapi and am getting a similar issue, with the socket being immediately closed. It seems this may be a problem with Tuya protocol version 3.4.

After applying the fix from helberhlm/tuyapi@bd28e0f the connection seems to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants