jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
1.01k stars 177 forks source link

How to control WiFi smart heater? #119

Closed thewh1teagle closed 1 year ago

thewh1teagle commented 2 years ago

I tried to control wifi smart heater with this library the function get status working but the function dev.turn_off(switch=True) hangs the result of get status is:

{'devId': '', 'dps': {'1': True, '2': 0, '4': 11474, '5': 26943, '6': 2367}}
jasonacox commented 2 years ago

Hi @thewh1teagle the switch parameter should be numeric (e.g. switch=1) and is used for outlets that have multiple switching plugs. You should just use something like this:

import tinytuya

# tinytuya.set_debug(True)

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

d.turn_off()