Closed abdullah20401 closed 1 year ago
It looks like I resolved it by using tuya-connector-python instead.
Here is how my code looks like now:
from tuya_connector import TuyaOpenAPI
import json
secrets = json.load(open('secret.json', 'r'))
ACCESS_ID = secrets['access_id']
ACCESS_KEY = secrets['access_key']
ENDPOINT = secrets['endpoint']
USERNAME = secrets['username']
PASSWORD = secrets['password']
LIGHTBULB_DEVICE_ID = secrets['lightbulb_device_id']
openapi = TuyaOpenAPI(ENDPOINT, ACCESS_ID, ACCESS_KEY)
openapi.connect()
commands = {
'commands': [
{
'code': 'switch_led',
'value': True
}
]
}
result = openapi.post(
f'/v1.0/iot-03/devices/{LIGHTBULB_DEVICE_ID}/commands', commands)
print(result)
Hi, I am getting an error
{'code': 1010, 'msg': 'token invalid', 'success': False, 't': 1682574088236, 'tid': '27e13586e4be11eda0c0360158882c1b'}
.Here is my code
Thank You,