Skip to content

Releases: jasonacox/tinytuya

v1.3.0 - TuyaCloud API Support

31 Dec 02:46
Compare
Choose a tag to compare
  • Code format cleanup and readability improvements (pull request #91)
  • Upgrade - Add TuyaCloud API support and functions (#87 #95)
import tinytuya

c = tinytuya.Cloud(
        apiRegion="us", 
        apiKey="xxxxxxxxxxxxxxxxxxxx", 
        apiSecret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 
        apiDeviceID="xxxxxxxxxxxxxxxxxxID")

# Display list of devices
devices = c.getdevices()
print("Device List: %r" % devices)

# Select a Device ID to Test
id = "xxxxxxxxxxxxxxxxxxID"

# Display DPS IDs of Device
result = c.getdps(id)
print("DPS IDs of device:\n", result)

# Display Status of Device
result = c.getstatus(id)
print("Status of device:\n", result)

# Send Command - This example assumes a basic switch
commands = {
	'commands': [{
		'code': 'switch_1',
		'value': True
	}, {
		'code': 'countdown_1',
		'value': 0
	}]
}
print("Sending command...")
result = c.sendcommand(id,commands)
print("Results\n:", result)

v1.2.11 - Updated Scan and Wizard Retry Logic

28 Nov 06:14
Compare
Choose a tag to compare
  • Added retries logic to wizard and scan to honor value set by command line or default to a value based on the number of devices (if known):
# Explicit value set via command line
python3 -m tinytuya wizard 50   # Set retry to 50 
python3 -m tinytuya scan 50     

# Use automatic computed value
python3 -m tinytuya wizard      # Compute a default
python3 -m tinytuya scan        

# Example output
TinyTuya (Tuya device scanner) [1.2.11]

[Loaded devices.json - 32 devices]

Scanning on UDP ports 6666 and 6667 for devices (47 retries)...

v1.2.10 - Wizard Update for New Tuya Regions

31 Oct 04:32
Compare
Choose a tag to compare
  • PyPi Version 1.2.10
  • Added ability to disable device auto-detect (default vs device22) via d.disabledetect=True.
  • Wizard: Added new data center regions for Tuya Cloud: (Issues #66 #75)
Code Region Endpoint
cn China Data Center https://openapi.tuyacn.com
us Western America Data Center https://openapi.tuyaus.com
us-e Eastern America Data Center https://openapi-ueaz.tuyaus.com
eu Central Europe Data Center https://openapi.tuyaeu.com
eu-w Western Europe Data Center https://openapi-weaz.tuyaeu.com
in India Data Center https://openapi.tuyain.com

v1.2.9 - Edge Case Device Support

29 Sep 01:42
Compare
Choose a tag to compare
  • PyPi Version 1.2.9
  • Added Error Handling in class Device(XenonDevice) for conditions where response is None (Issue #68)
  • Added edge-case handler in _decode_payload() to decode non-string type decrypted payload (Issue #67)

v1.2.8 - BulbDevice

02 Sep 02:38
Compare
Choose a tag to compare
  • PyPi Version 1.2.8
  • Added additional error checking for BulbDevice type selection
  • Added TinyTuya version logging for debug mode
  • Fix bug in scan when color=False (Issue #63)

v1.2.7 - New Tuya Cloud IoT Setup Wizard

28 Jul 05:12
Compare
Choose a tag to compare
  • PyPi Version 1.2.7
  • Updated setup wizard to support new Tuya IoT Cloud signature method (Issue #57)
  • Added Bulb type C and manual setting function set_bulb_type(type) (PR #54)
  • Wizard creates tuya-raw.json to record raw response from Tuya IoT Platform
  • Fixed device22 bug on retry - Now returns ERR_DEVTYPE error, status() includes auto-retry (#56)

v1.2.6 - Improved Error Handling

03 Jun 04:34
c3a94b8
Compare
Choose a tag to compare
  • PyPi Version 1.2.6
  • Added wizard handling to capture and display Tuya API server error responses (PR #45)
  • Added better error handling for BulbDevice state() function to not crash when dps values are missing in response (PR #46)
  • Added async examples using send() and receive()
  • Updated scan output to include device Local Key if known (PR #49 #50)
  • Fixed print typo in examples/devices.py (PR #51)

v1.2.5 - Send and Receive Functions

26 Apr 00:26
Compare
Choose a tag to compare
  • PyPi Version 1.2.5
  • Added raw mode send() and receive() function to allow direct control of payload transfers. Useful to monitor state changes via threads or continuous loops. This example opens a Tuya device and watches for state changes (e.g. switch going on and off):
import tinytuya

d = tinytuya.OutletDevice('DEVICEID', 'DEVICEIP', 'DEVICEKEY')
d.set_version(3.3)
d.set_socketPersistent(True)

print(" > Send Initial Query for Status < ")
payload = d.generate_payload(tinytuya.DP_QUERY)
d.send(payload)

while(True):
    # See if any data is available
    data = d.receive()
    print('Received Payload: %r' % data)

    # Send a keyalive heartbeat ping
    print(" > Send Heartbeat Ping < ")
    payload = d.generate_payload(tinytuya.HEART_BEAT)
    d.send(payload)

v1.2.4 - DPS Detection and Bug Fixes

19 Apr 05:57
Compare
Choose a tag to compare
  • PyPi Version 1.2.4
  • Added detect_available_dps() function
  • Fixed bug in json_error() function
  • Updated instruction for using Tuya iot.tuya.com to run Wizard
  • Added option to disable deviceScan() automatic device polling
  • Added better error handling processing Tuya messages (responses) Issue #39
  • Fixed display bug in Wizard device polling to show correct On/Off state

v1.2.3 - Dimmer and Brightness Functions

03 Mar 06:15
Compare
Choose a tag to compare
  • PyPi Version 1.2.3
  • Added set_dimmer() to OutletDevice class.
  • Added set_hsv() to BulbDevice class.
  • Updated set_brightness() in BulbDevice to handle white and colour modes. Issue #30
  • BulbDevice determines features of device and presents boolean variables has_colour, has_brightness and has_colourtemp to ignore requests that do not exist (returns error).