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 from socket messages over and over, even though it actually works? #30

Open
Nodi-Rubrum opened this issue Sep 13, 2020 · 9 comments

Comments

@Nodi-Rubrum
Copy link

This is weird, I have 4 smart plugs from the same vendor, Awow. All for work without issue via my phone, all 4 work via the TUYA API, i.e. from this node. But one keeps reporting error from socket messages over and over, even though it actually works. Any idea why this is the case?

@subzero79
Copy link
Owner

Could be the wrong key maybe? Check their fw if they are different?

@Nodi-Rubrum
Copy link
Author

Nodi-Rubrum commented Sep 14, 2020

Good suggestion, I confirmed that virtual id, key and FQDN and IP address are correct. The device does connect, it is functional, but it does not retain the connection. Because the smart plug works, if appears that the status changes but functionality remains in place. I have 12 smart plugs, across three vendors/producers, and this is the first time I have seen such behavior.

I have tried both API 3.1 and 3.3, since some of the plugs I have work under 3.1 versus 3.3.

Is there a detailed log or such I can review, the node-red log just shows the same as the debug window, the endless socket errors. For example...

`9/13/2020, 8:58:32 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:58:42 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:58:52 PMnode: 42633b64.18bd54
msg : string[41]
"Error: Error from socket device: Awow 163"

9/13/2020, 8:59:02 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:59:11 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:59:22 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:59:32 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:59:42 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 8:59:52 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"

9/13/2020, 9:00:01 PMnode: 42633b64.18bd54
msg : string[41]

"Error: Error from socket device: Awow 163"`

@Nodi-Rubrum
Copy link
Author

Nodi-Rubrum commented Sep 14, 2020

Here is the node-red log...
`14 Sep 04:14:41 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:14:41 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:14:51 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:14:51 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:15:01 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:15:01 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:15:11 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:15:11 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:15:21 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:15:21 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:15:31 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:15:31 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:15:41 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:15:41 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:15:51 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:15:51 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:16:01 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:16:01 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:16:11 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:16:11 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:16:14 - [error] [Bme280:Sensor] Sensor Init failed ->Unexpected BMx280 chip ID: 0x0

14 Sep 04:16:21 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:16:21 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163

14 Sep 04:16:31 - [warn] [tuya-local:42633b64.18bd54] Error: Error from socket device: Awow 163

14 Sep 04:16:31 - [info] [tuya-local:42633b64.18bd54] error: Trying to clear a possible timeout timer for device Awow 163
`

@subzero79
Copy link
Owner

Make sure you’re not duplicating nodes for the same socket. Also don’t use the app at the same time.
There are no fixes as I don’t have tuya hw anymore. Also fw can be changed now ota to alternatives like tasmota o esphome in case of esp chips.

There is a lot to improve in the node, PR’s are welcome or if someone wants to take over the repo also would be great.

@Nodi-Rubrum
Copy link
Author

Nodi-Rubrum commented Sep 14, 2020

FIrmware... MCU Module 1.0.4 and update-to-date, on all 4 of the same group/publisher/bundle I purchased. The vendor ID code is also identical in the Tuya API/IoT clould API/website.

@Nodi-Rubrum
Copy link
Author

Right, I am sure I am not cross connecting the nodes. Phone offline while active in node red. I did try the tuya-cli wizard, and it matches the web site information. The virtual IDs and secrets match consistently. I once had a typo in a secret key, so I know what you mean, about the ids/secrets validated.

@Nodi-Rubrum
Copy link
Author

I am not completely sure the node is the cause, it might be the tuya API its-self, but since the phone instance for the device is functional, as well as the NR node, even when reporting the connection socket error, it does suggest something odd in the node logic. If I can get the tuya-cli working for linking, and it works, then I start looking at the actual node code next.

@subzero79
Copy link
Owner

The problem might be the timeout canceling that is set to keep retrying the connection. So maybe two timers occur and making dual connection to the socket inviable. So node connects one time then there is a timer on the background not cancelled attempts connection and so on. Endless. The Connection retry logic needs to be redone.

@Nodi-Rubrum
Copy link
Author

I look again, that idea makes sense. I just don't think I have anything else connecting. If I did the issue should be happening to all 4 devices, since my NR flow is identical for all 4, or so I believe at this time.

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