Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
March 27, 2024
The error you’re encountering in your code (AttributeError: ‘NoneType’ object has no attribute ‘uid’) indicates that the token_info attribute of the TuyaOpenAPI object is None. This means the authentication process is failing to retrieve the user information, including the UID.
Here are some steps to troubleshoot the issue:
Double-check your EMAIL, PASSWORD, ACCESS_ID, and ACCESS_KEY in the config.py file. Ensure they are correct for your Tuya account and the specific smart home schema you’re using (APP.value).
Make sure your device has a stable internet connection. A failing connection can disrupt the authentication process.
The Tuya API might be temporarily unavailable. Check online resources or forums to see if others are experiencing similar issues.
Ensure you’re following the tuya-iot-py-sdk documentation for authentication. Refer to the specific steps required for the Smart Home AuthType you’re using.
While you mentioned installing tuya-iot-py-sdk using pip3, consider checking if there are any newer versions available. You can update it using:
Bash
pip3 install --upgrade tuya-iot-py-sdk
Add print statements before the lines where the error occurs (around lines 41 and 239 in your code). Print the values of openapi.token_info and other relevant variables to see if they are populated correctly after the openapi.connect call.
If none of these solutions work, consider looking at the Tuya API documentation and the tuya-iot-py-sdk library documentation for more specific troubleshooting steps related to authentication errors. You might also find helpful information by searching online forums or communities for similar issues encountered by other users.