Closed okaapi closed 8 months ago
HI @okaapi , thanks for the kind remarks!
You didn't provide any code, so I don't know if you are doing this already, but you need to access the devices behind the gateway differently (it uses a parent/child model). Here is an example: https://github.com/jasonacox/tinytuya/blob/master/examples/zigbee_gateway.py
Thanks! That looks exactly like what I was looking for!
Still, I am somehow not able to connect to the gateway. This is from python interpreter:
Connecting to it via Tuya cloud (id = 'eb...md')
tuya_cloud.getstatus('eb...md') {'result': [{'code': 'switch_alarm_sound', 'value': False}, {'code': 'master_state', 'value': 'normal'}, {'code': 'factory_reset', 'value': False}, {'code': 'alarm_active', 'value': ''}], 'success': True, 't': 1706465008065, 'tid': '89bcb2...77f8'}
And then locally (this works for fine for the bulbs etc):
gw = tinytuya.Device(dev_id="eb...md", address="192.168.0.X", local_key='6a...93', persist=True, version=3.3) gw.address '192.168.0.X' gw.status() {'Error': 'Network Error: Unable to Connect', 'Err': '901', 'Payload': None}
I know this could mean that the local key is wrong, but these are ID and key as reported by Tuya cloud (and also in devices.json).
PS: I noticed another thing. The Gateway and all the Zigbee devices have "eb...vb" as "parent" (in devices.json). This parent id appears also to be the main id of one of the Zigbee devices. I would have expected the Gatway to be the "parent"...
You sure it's a v3.3 device? v3.4/3.5 devices will not respond to v3.3 commands due to the key exchange they need.
Brilliant!
No, of course I was not sure :-)
I tried 3.4, and now I can access the gatway as well as the Zigbee devices.
Thanks all!
Congrats and thanks for confirming @okaapi ! Closing this.
I have thermostats, plugs and bulbs among my Tuya devices, and I can control them using tinytuya, thanks for this project!
There is one exception - I have a gateway that controls some Zigbee devices, and when I do status(), it reports a "Network Error: Unable to Connect", error 901. The gateway is definitely online, shows in the Tuya app, and lists its Zigbee devices in the app.
The gateway DOES respond to "getstatus(id)" through the Tuya cloud.
My hope was that I could get access to the Zigbee devices through tinytuya - right now I get to their status (temperatures) throug Tuya cloud every time.
Thanks for any pointers!