https://github.com/octoober/tuya-bulb-control
API wrapper for you smart bulbs developed by Tuya 💡
https://github.com/octoober/tuya-bulb-control
api-wrapper smart-bulb tuya tuya-api tuya-smart
Last synced: about 1 year ago
JSON representation
API wrapper for you smart bulbs developed by Tuya 💡
- Host: GitHub
- URL: https://github.com/octoober/tuya-bulb-control
- Owner: Octoober
- License: mit
- Created: 2021-01-12T22:15:19.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-16T12:20:15.000Z (over 2 years ago)
- Last Synced: 2025-04-14T00:08:11.166Z (about 1 year ago)
- Topics: api-wrapper, smart-bulb, tuya, tuya-api, tuya-smart
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 36
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tuya Bulb Control #
Tuya Bulb Control - API wrapper for you smart bulbs **developed by Tuya**
[](https://pypi.org/project/tuya-bulb-control/)
[](https://pypi.org/project/tuya-bulb-control/)
[](https://github.com/psf/black/)
---
## Installation
Install or upgrade tuya-bulb-control:
```
$ pip install tuya-bulb-control --upgrade
```
Or install source:
```
$ git clone https://github.com/Octoober/tuya-bulb-control.git
$ cd tuya-bulb-control
$ python setup.py install
```
Demo:
```Python
from tuya_bulb_control import Bulb
CLIENT_ID = ''
SECRET_KEY = ''
DEVICE_ID = ''
REGION_KEY = 'eu'
bulb = Bulb(
client_id=CLIENT_ID,
secret_key=SECRET_KEY,
device_id=DEVICE_ID,
region_key=REGION_KEY
)
# Turn on the bulb
bulb.turn_on()
# Change the color to green
bulb.set_colour_v2(rgb=(0, 255, 0))
# Turn off the light bulb after 5 minutes
bulb.set_toggle_timer(value=5)
```
## Getting access to API
#### Step 1: CLIENT_ID and SECRET_KEY
- Register or Login on Tuya.
1. Create a cloud development project Cloud -> Project.
2. After successful creation, you will receive the **Client ID** and **Secret Key**.
#### Step 2: DEVICE_ID
1. Install **Tuya Smart** app or **Smart Life** app on your mobile phone.
2. Go to Cloud -> Link Devices page.
3. Selecting a tab **Link Devices by App Account**.
4. Click **Add App Account** and scan the QR code with **Tuya Smart** app or **Smart Life** app.
5. Now you can go to devices Cloud -> Device List and copy **Device ID**.
* Notes: Try to select a your region if devices are not displayed.
#### Step 3: Request access to API calls
Go to Cloud -> API Group and enable **Authorization management**, **Device Management** and **Device Control**.
**Done!**