Code examples using tinytuya
module to control various Tuya devices.
getstatus.py - This script will read the status of a Tuya device.
bulb.py - This script tests controlling Smart Bulb with RGB capabilities.
bulb-scenes.py - This script tests out setting Scenes for the smart bulb
Tested devices: Peteme Smart Light Bulbs, Wi-Fi - link
monitor.py - This script uses a loop to listen to a Tuya device for any state changes.
async_send_receive.py - This demonstrates how you can make a persistent connection to a Tuya device, send commands and monitor for responses in an async way.
send_raw_dps.py - This script show how to send and set raw DPS values on a Tuya device.
devices.py - Poll status of all devices in devices.json
.
snapshot.py - Example of using snapshot.json
to manage Tuya Devices
# Load in snapshot.py and control by name
turn_off('Dining Room')
time.sleep(2)
turn_on('Dining Room')
cloud.py - Example that uses the Tinytuya Cloud
class and functions to access the Tuya Cloud API to pull device information and control the device via the cloud.