Tuya Bulb Control - API wrapper for you smart bulbs developed by Tuya
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:
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)
Go to Cloud -> API Group and enable Authorization management, Device Management and Device Control.
Done!