Stop being the product.
Become the owner.
or
sign uplog in

I made a Python tool to control SmartLife Smart plugs…

I made a Python tool to control SmartLife Smart plugs without the paid API

I built a Python script that acts like an API for controlling Smart Life smart plugs.

It currently supports:

* Login
* Device discovery
* Device status checks
* On/off control

I was working on some home automation scripts and wanted to see whether there was an API I could use.

Tuya does provide a cloud API, but it requires setting up a cloud project through their developer portal, and the API access I found was only available as a limited free trial before becoming paid.

I didn’t want to pay for API access or be limited to controlling the plug manually through the mobile app. I wanted to integrate it into my own automation system, and the app itself didn’t give me the flexibility I needed.

So I started looking into how the mobile app communicates with Tuya's backend and wrote a Python implementation around that flow.

While working on it, I also ended up digging into some of the protocol details, including:

* Password encryption
* RSA-based login flow
* TLS communication
* Request signing
* HMAC-SHA256
* Device datapoints / DPs
* Bitmap token decoding
#home
source
earnings
1,000 mlx total
$0  total
engagement
2 views
0 reactions

0 comments