tinytuya icon indicating copy to clipboard operation
tinytuya copied to clipboard

Found device, but Network Error: Device Unreachable, Err: 905

Open davrivas80 opened this issue 1 year ago • 2 comments

Hi there.

I am trying to connect locally to a Zigbee Gateway with no avail.

This is my simple code:

gw = tinytuya.Device( GATEWAY_ID, address=GATEWAY_IP, local_key=GATEWAY_KEY, persist=True, version=3.4 ) print( 'GW IP found:', gw.address ) print(gw.status())

This is what I get:

GW IP found: 192.168.1.80 {'Error': 'Network Error: Device Unreachable', 'Err': '905', 'Payload': None} Process finished with exit code 0

With DEBUG ON:

DEBUG:TinyTuya [1.14.0]

DEBUG:Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32 DEBUG:Using pyca/cryptography 42.0.8 for crypto, GCM is supported DEBUG:status() entry (dev_type is default) DEBUG:final payload_dict for 'thisisthegatewayid' ('v3.4'/'default'): {1: {'command': {'gwId': '', 'devId': '', 'uid': '', 't': ''}}, 7: {'command': {'protocol': 5, 't': 'int', 'data': {}}, 'command_override': 13}, 8: {'command': {'gwId': '', 'devId': ''}}, 9: {'command': {'gwId': '', 'devId': ''}}, 10: {'command': {}, 'command_override': 16}, 13: {'command': {'protocol': 5, 't': 'int', 'data': {}}}, 16: {'command': {}}, 18: {'command': {'dpId': [18, 19, 20]}}, 64: {'command': {'reqType': '', 'data': {}}}} DEBUG:building command 10 payload=b'{}' DEBUG:socket unable to connect (timeout) - retry 1/5 DEBUG:socket unable to connect (timeout) - retry 2/5 DEBUG:socket unable to connect (timeout) - retry 3/5 DEBUG:socket unable to connect (timeout) - retry 4/5 DEBUG:socket unable to connect (timeout) - retry 5/5 DEBUG:ERROR Network Error: Device Unreachable - 905 - payload: null DEBUG:status() received data={'Error': 'Network Error: Device Unreachable', 'Err': '905', 'Payload': None}

Any clue?

davrivas80 avatar Jul 01 '24 23:07 davrivas80

It looks like either the IP address is wrong, or that gateway does not support local control. Does the scanner python3 -m tinytuya scan find it?

uzlonewolf avatar Jul 03 '24 15:07 uzlonewolf

Yes, scan can find it. IP address is correct.

It happens the same with three of my devices: a Zigbee Gateway (the above example, not really interested in polling it, but since it is the gateway to other devices if it is not reachable maybe those subdevices won't be either), a Smart Alarm, and a Smart Switch.

I have other devices I can reach without problem (some smart bulbs).

davrivas80 avatar Jul 03 '24 15:07 davrivas80

That particular "socket unable to connect" error only happens when a TCP connection to the device cannot be established at all - the IP address is wrong, the device is not listening for incoming connections, or a firewall is blocking the connection. I'd power cycle the device and try again. If it still does not work, what does the scanner say the 'Status:' is?

uzlonewolf avatar Jul 03 '24 21:07 uzlonewolf

Without modifying a single line of my code I managed to access the Zigbee Gateway and subdevices... I think it has something to do with the Tuya App. It seems a bit odd since it is something I had already discarded since the problems persisted even with my phone disconnected

davrivas80 avatar Jul 03 '24 22:07 davrivas80

I think it has something to do with the Tuya App.

Interesting. We often see unable to connect when the Tuya app is connected to the device. Many of the devices do not allow multiple connections. It varies a lot between manufacturers and devices.

jasonacox avatar Jul 07 '24 14:07 jasonacox

Since it sounds like you got everything working I'm going to go ahead and close this one out. Feel free to re-open it if you're still having issues.

uzlonewolf avatar Jul 25 '24 03:07 uzlonewolf