tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
857 stars 206 forks source link

Tuya v2 - Error 2007 - IP cross-region access is not allowed - MU login country code #627

Open robertiturnbull opened 2 years ago

robertiturnbull commented 2 years ago

Since the upgrade of home assistant, I can no longer use the integration.

Tuya Smartlife App country : MU

My device seesm to be attached to the china data center:

image

image

image

image

image

Log Details (ERROR) This error originated from a custom integration. Logger: custom_components.tuya_v2 Source: custom_components/tuya_v2/init.py:153 Integration: Tuya v2 (documentation) First occurred: October 22, 2021, 3:22:08 PM (1 occurrences) Last logged: October 22, 2021, 3:22:08 PM

Tuya login error response: {'code': 2007, 'msg': 'your ip(xxxx) cross-region access is not allowed', 'success': False, 't': 1634901727919}

themabrennan commented 2 years ago

It looks like I am having the same issue. I am NOT sure what I am doing wrong trying to add these devices.

11/7/2021, 2:31:26 PMTuya Web BridgePreparing Advertiser for 'Tuya Web Bridge 7A31' using bonjour-hap backend! 11/7/2021, 2:31:26 PMTuya Web BridgeStarting to advertise 'Tuya Web Bridge 7A31' using bonjour-hap backend! 11/7/2021, 2:31:26 PMTuya Web BridgeBridge is running on port 51866. 11/7/2021, 2:31:27 PMTuya Web BridgeTuyaOpenAPI response: {"code":2007,"msg":"your ip(xxx.xxx.xxx.xx) cross-region access is not allowed","success":false,"t":1636317087373} path = /v1.0/iot-01/associated-users/actions/authorized-login 11/7/2021, 2:31:27 PMTuya Web BridgeTypeError: Cannot destructure property 'access_token' of 'res.result' as it is undefined. 11/7/2021, 2:31:27 PMTuya Web Bridgeat processTicksAndRejections (internal/process/task_queues.js:95:5) 11/7/2021, 2:31:27 PMTuya Web BridgeAttention⚠️ ⚠️ ⚠️ ! You get an error! 11/7/2021, 2:31:27 PMTuya Web BridgeFailed to get device information. Please check if the config.json is correct.

LyZzardMD commented 2 years ago

I have the same problem. My region in Tuya App is China. The request from Home Assistant is made from Moldova. It stopped to work on latest upgrades. It used to work when the integration was in Beta version.

ohauglend commented 1 year ago

Im not sure if this helps but the issue in my case was that the endpoint was set to China (tuyacn) where as I needed tuyaeu

https://developer.tuya.com/en/docs/iot/device-control-best-practice-python?id=Kav4zc0nphsn5

fedemengo commented 1 year ago

For me the problem was a wrong country code in the plugin config