TradeFace / tuyaface

Python Tuya client that allows you to locally communicate with tuya devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why remove protocols lower than v3.3?

codeclinic opened this issue · comments

Hi,

This project looks really interesting but I have a mixture of v3.1 and v3.3 devices. So, I was just wondering what was behind the decision to remove the compatibility with devices using anything less than v3.3 ?

Thanks.

Well, the original code was a big mess ( to be honest ). So, I had to weed through the code to find the core functionality. In the process a lot of the code was skipped/removed to create a somewhat cleaner base. Sadly I'm now a bit short on time to put it back in. If you have the time; I am open to your PR

I'd be glad to help when time allows. However, I've no idea what needs putting back or from where. IF you can point me in the right direction I'll see what I can do.

Basically function _generate_payload from line 79 onwards needs to reimplement the 3.1 code. The function as it is, is still too big ( too many subtasks ). The original function you can find here https://github.com/clach04/python-tuya/blob/master/pytuya/init.py line 184 onwards

I just want to express I am also interested in this, and I am sure others are as well especially now that clach04 isn't updating python-tuya going forward. The new code base looks much cleaner so I am hoping it's not too much of an addition.

I put back some code to support 3.1 devices. I have no way of testing this. Can you guys have a look?

@TradeFace Sorry, I never had time to make a contribution. I'll do my best to get the update tested this week. Thanks.

I actually wrote a small but popular Python script that uses the old PyTuya script to send Tuya data to MQTT. So, I'm really keen to see your code / project develop since the current PyTuya has now been mostly abandoned.

Okay, maybe we can integrate it with https://github.com/TradeFace/tuyamqtt ?

I'm not sure there is any need, since your https://github.com/TradeFace/tuyamqtt already does this. That's why I'm so keen to see yours develop. ;-)

I will try to give this a go later today at lunch or tonight (PT).

@TradeFace Does this mean testing is no longer needed?

Well, extra testing would be welcome. SDNick and I worked through the problems in this lib and tuyamqtt. For his device everything seems to work correctly now.
Ofcourse your device could respond a bit differently. So It would be nice to confirm all is well now for protocol 3.1

I have some outlets then I can try later. I need to flash them via tuya-convert or register them to the Tuya cloud (Tuyapi approach) to get their local key first.