redphx / tuya-local-key-extractor

Get Tuya device's local key easily
30 stars 6 forks source link

Error when extracting data #1

Open arnauddomes opened 1 year ago

arnauddomes commented 1 year ago

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'

TiddlyWiddly commented 1 year ago

Same problem here

lippenyit commented 1 year ago

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

TiddlyWiddly commented 1 year ago

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.

lippenyit commented 1 year ago

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.

scana commented 1 year ago

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/

twhittock-disguise commented 7 months ago

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.

marianri commented 7 months ago

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

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