tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
117 stars 47 forks source link

failure to initiate tuya integration on home assistant #64

Closed tomdov closed 1 year ago

tomdov commented 1 year ago

https://github.com/tuya/tuya-iot-python-sdk/blob/20a7c92898fdd44e559667bbf8f2bf6fdb1e9185/tuya_iot/openapi.py#L42

the returned dictionary contains 'expire_time': '7200' which is str, therefore exception is raised:

File "/usr/local/lib/python3.9/site-packages/tuya_iot/openapi.py", line 41, in __init__
    token_response.get("t", 0)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
dulantha-p commented 1 year ago

Check out https://github.com/tuya/tuya-home-assistant/issues/851#issuecomment-1260662028

dulantha-p commented 1 year ago

Check out tuya/tuya-home-assistant#851 (comment)

Hope @tsutsuku can pick this up to patch openapi.py, otherwise I'm happy to create/submit a PR tomorrow, I have just run out of time for today.

strasharo commented 1 year ago

Added PR for it: https://github.com/tuya/tuya-iot-python-sdk/pull/65

tomdov commented 1 year ago

token API doesn't respond with expiration time as string anymore, issue doesn't re-occur