tuya-local-key-extractor icon indicating copy to clipboard operation
tuya-local-key-extractor copied to clipboard

Error when extracting data

Open arnauddomes opened this issue 3 years ago • 7 comments

hello

I try to use the extract tool to retrieve my FingerBot data and I get that:

Exception in thread Thread-1: Traceback (most recent call last): openapi <tuya_iot.openapi.TuyaOpenAPI object at 0x7f7c4ccb24c0> openmq <TuyaOpenMQ(Thread-1, started 140171782297344)> File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/home/arnaud/.local/lib/python3.8/site-packages/tuya_iot/openmq.py", line 158, in run self.__run_mqtt() File "/home/arnaud/.local/lib/python3.8/site-packages/tuya_iot/openmq.py", line 164, in __run_mqtt mq_config = self._get_mqtt_config() File "/home/arnaud/.local/lib/python3.8/site-packages/tuya_iot/openmq.py", line 67, in _get_mqtt_config "uid": self.api.token_info.uid, AttributeError: 'NoneType' object has no attribute 'uid' Traceback (most recent call last): File "./extract.py", line 31, in <module> device_manager.update_device_list_in_smart_home() File "/home/arnaud/.local/lib/python3.8/site-packages/tuya_iot/device.py", line 239, in update_device_list_in_smart_home response = self.api.get(f"/v1.0/users/{self.api.token_info.uid}/devices") AttributeError: 'NoneType' object has no attribute 'uid'

arnauddomes avatar Sep 14 '22 06:09 arnauddomes

Same problem here

TiddlyWiddly avatar Sep 24 '22 15:09 TiddlyWiddly

Same here: AttributeError: 'NoneType' object has no attribute 'uid'

lippenyit avatar Nov 12 '22 13:11 lippenyit

Same here: AttributeError: 'NoneType' object has no attribute 'uid'

It’s been a while but I did figure this out, I just forgot to update. I believe this was an issue with the specific cloud. There are a few different cloud regions and for whatever reason they didn’t all behave the same way. Try recreating your project in all of the US regions.

TiddlyWiddly avatar Nov 12 '22 14:11 TiddlyWiddly

As I figured it out, it's not working due to the replaced authentication method in Tuya API. I think that: it was an update period when not every region had the same version, but now it's not working globally.

lippenyit avatar Nov 12 '22 20:11 lippenyit

I got it working by selecting a proper country code in extract.py: openapi.connect(EMAIL, PASSWORD, "48", "tuyaSmart") You can grab yours from here https://countrycode.org/

scana avatar Dec 27 '22 17:12 scana

This happened to me when I used the incorrect password (using the IOT password instead of the app password.)

The error actually happens during the call to openapi.connect - it returns a response with a success value of false, but the script doesn't abort.

twhittock-disguise avatar Nov 12 '23 12:11 twhittock-disguise

@TiddlyWiddly is right, the error is related to cloud regions, for Europe try, in "config.py", replace:

ENDPOINT = 'https://openapi.tuyaeu.com'

marianri avatar Nov 23 '23 16:11 marianri