Sign inSign up

insatomcat/tuyaweb

By insatomcat

•Updated 4 months ago

Tuya Web Control (Smart Life depuis PC)

Image
0

2.1K

insatomcat/tuyaweb repository overview

⁠Tuya Web Control (Smart Life from PC)

Python web app to list and control devices from a Tuya/Smart Life account.

⁠What the app does

  • Lists all account devices (via Tuya Cloud API)
  • Shows each device state (status)
  • Lets you send commands:
    • quick switch_1 ON/OFF buttons
    • free-form code + value (JSON) form for all other use cases

⁠Prerequisites

  • Python 3.10+
  • A project on Tuya IoT Platform with:
    • Client ID (API Key)
    • Client Secret
    • region (eu, us, cn, in)

⁠Installation

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

⁠Configuration

cp .env.example .env

Edit .env:

TUYA_API_REGION=eu
TUYA_API_KEY=your_client_id
TUYA_API_SECRET=your_secret
TUYA_API_DEVICE_ID=
APP_HOST=127.0.0.1
APP_PORT=8000

TUYA_API_DEVICE_ID is optional, but useful for some accounts/projects.

⁠Run the application

source .venv/bin/activate
python -m app.main

Then open:

⁠Docker

Build the image:

docker build -t tuyaweb .

Run the container with your local .env:

docker run --rm -p 8000:8000 --env-file .env tuyaweb

Then open:

Optional: if you want to change the host-exposed port:

docker run --rm -p 8080:8000 --env-file .env tuya-web-control

⁠Smart Life login/password: is it possible?

Partially and not reliably. Direct login endpoints are unofficial and may break.

A bootstrap attempt script is provided:

source .venv/bin/activate
python scripts/login_password_bootstrap.py --region eu --username "[email protected]" --password "password"

If this does not work, use the recommended method: Client ID + Client Secret.

⁠Security

  • .env is ignored by git (not tracked)
  • Never commit your secrets

Tag summary

Content type

Image

Digest

sha256:90b64e30a…

Size

60.5 MB

Last updated

4 months ago

docker pull insatomcat/tuyaweb