jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
879 stars 159 forks source link

Can you rewrite with golang? #85

Open feeops opened 2 years ago

feeops commented 2 years ago

Can you rewrite with golang?

golang performance is 10x faster than python

jasonacox commented 2 years ago

Thanks for the suggestion. I often thought about porting this but haven't had the time. For performance, I usually write in C/C++/Obj-C and would also consider Rust. Golang would be a good option as well.

My motivation for creating this library in python is due to the accessibility of the python language. It is easy to understand and use for hobbyist as well as computer scientists at all levels of learning. I'm keen on making tools easily accessible to anyone wanting to learn and expand their smarthome integrations. Python provides that. In the case of TinyTuya, the performance constraint is really at the IoT devices themselves, often with single threaded http handlers and slow SoC processors. I had to add sleep, delay and wait loops in TinyTuya's python functions just to handle the slower Tuya device responses and processing time. In other words, the majority of the constraint for performance is on the IoT side rather than the client python code side.

I still love your idea and may embark on that some day. Thanks again for the feedback!

fuatakgun commented 2 years ago

As a full time software developer, i like these stuff to be accessible over python, for sake of home assistant, one of the main open source home automation software. I am not about additional value of speed vs accessibility.

Thanks for great work.

axydavid commented 2 years ago

My 2 cents, by using python I am able to use my mobile phone as a local controller. I have Tasker to automate commands using termux which then executes the tinytuya commands. Works perfectly. I'm using a budget redmi 7a phone however the response is very quick in my experience. Now how do we make this thing stop pinging home....