tuya-local icon indicating copy to clipboard operation
tuya-local copied to clipboard

Import keys automatically from iot.tuya.com

Open wjnelson78 opened this issue 4 years ago • 6 comments

Is there a way to import the tuya keys after extracting from iot.tuya.com?

wjnelson78 avatar Feb 14 '21 03:02 wjnelson78

Not in the libraries currently available for python, which Home Assistant integrations use. Currently only the nodejs library and tuyacli app connect to iot.tuya.com

make-all avatar Feb 18 '21 02:02 make-all

There does appear to be provision for this in tinytuya, but currently it is implemented as a command-line wizard, and I think will require refactoring of the library itself to make work entirely within HA.

make-all avatar Jul 11 '21 23:07 make-all

localtuya manages to do this, somehow?

ssorgatem avatar May 07 '23 11:05 ssorgatem

localtuya maintains its own fork of pytuya. I don't have the bandwidth to do that, so I rely on tinytuya, which is the most maintained fork of pytuya. tinytuya does support discovery now, but as they do not support asyncio, it is a bit more complex to integrate than I would like, probably it is below #682 on the priority list for major changes.

make-all avatar May 07 '23 12:05 make-all

Also, if this integration does discovery, it will make it mutually exclusive with localtuya - currently it is possible to use some devices with this, and some with localtuya, provided you do not try to use auto IP address detection. For standard discovery protocols, Home Assistant works around this mutual exclusivity by making the discovery an HA provided service, but since tuya does not use standard protocols, we have to implement it at the integration level which will block all other integrations trying to use the same discovery ports.

make-all avatar May 07 '23 12:05 make-all

Also, if this integration does discovery, it will make it mutually exclusive with localtuya - currently it is possible to use some devices with this, and some with localtuya, provided you do not try to use auto IP address detection. For standard discovery protocols, Home Assistant works around this mutual exclusivity by making the discovery an HA provided service, but since tuya does not use standard protocols, we have to implement it at the integration level which will block all other integrations trying to use the same discovery ports.

Isn't more simple to bind MAC address of devices from ARP table. Each device have unique MAC address in difference of IP. If router restart start to give random IP's if not set to bind them to specific one.

Saentist avatar May 08 '23 06:05 Saentist