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
856 stars 206 forks source link

Tuya IoT "your ip(XX.XXX.128.108) don't have access to this API" error 1114 #635

Open mrrepel opened 2 years ago

mrrepel commented 2 years ago

Describe the bug Can control Tuya with TuyaSmart and IoT Platform, can read "status" with Home assistant, cannot change status with Home assistant (example, switch on or off). Problem since a few days, worked fine before.

Expected behavior Home assistant control Tuya devices, not just show the status (example on or off)

Home Assistant Version 2021.10.5

Additional context When i go to the website https://openapi.tuyaeu.com/v1.0/devices/xxxx/ (one of my devices) i get:

code 1114
msg "your ip(XX.XXX.128.108) don't have access to this API"
success false
t 1635339362943

As far as i can see in the logs there is no API / login problem.

The log when i try to swtich the switch: 2021-10-27 14:26:26 DEBUG (Thread-5) [tuya iot] _on_log: Sending PINGREQ 2021-10-27 14:26:26 DEBUG (Thread-5) [tuya iot] _on_log: Received PINGRESP 2021-10-27 14:26:39 DEBUG (SyncWorker_0) [tuya iot] Request: method = POST, url = https://openapi.tuyaeu.com/v1.0/devices/xxxxx/commands, params = None, body = {'commands': [{'code': 'switch_1', 'value': False}]}, t = 1635337599476 2021-10-27 14:26:39 DEBUG (SyncWorker_0) [tuya iot] Response: { "result": true, "success": true, "t": 1635337599572 }

Full log for logging in to Iot / API

2021-10-27 13:49:19 DEBUG (MainThread) [custom_components.tuya_v2] Tuya async setup conf None 2021-10-27 13:49:19 DEBUG (MainThread) [custom_components.tuya_v2] tuya.init.async_setup_entry-->{'o0o0o0': '34ddf78c5c8d6a8517d19ebb3555891b0014427aa529fabd173f387fad5596ace57360d75fb2bd215011704c50a77cf4502d5bbd73a2248b48f6d7ada5e9748983afb0d1b812f3630cc72f403666ebaeb281a8c08ed678ae1a4473e0f0f6e1b916f7b1d0355865a820563d9619c192ff0fc983fffb07751867e259bc65dc14be50d1ee337d52c0ab5cf10c017e0dd9885aaacdXXXXXX'} 2021-10-27 13:49:19 INFO (MainThread) [custom_components.tuya_v2] tuya.init.exist_xor_cache-->True 2021-10-27 13:49:19 DEBUG (SyncWorker_1) [tuya iot] Request: method = POST, url = https://openapi.tuyaeu.com/v1.0/iot-01/associated-users/actions/authorized-login, params = None, body = {'username': 'XXX', 'password': '', 'country_code': '49', 'schema': 'tuyaSmart'}, t = XXXX 2021-10-27 13:49:19 DEBUG (SyncWorker_1) [tuya iot] Response: { "result": { "access_token": "", "expire_time": 7200, "platform_url": "https://openapi.tuyaeu.com", "refresh_token": "", "uid": "" }, "success": true, "t": XXXX } 2021-10-27 13:49:20 DEBUG (MainThread) [tuya iot] start 2021-10-27 13:49:20 DEBUG (Thread-4) [tuya iot] Request: method = POST, url = https://openapi.tuyaeu.com/v1.0/iot-03/open-hub/access-config, params = None, body = {'uid': '', 'link_id': '', 'link_type': 'mqtt', 'topics': 'device', 'msg_encrypted_version': '1.0'}, t = XXX 2021-10-27 13:49:20 DEBUG (SyncWorker_0) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/users/eu1626865384210GhnXe/devices, params = None, body = None, t = XXX 2021-10-27 13:49:20 DEBUG (Thread-4) [tuya iot] Response: { "result": { "client_id": "", "expire_time": 7200, "password": "", "sink_topic": { "device": "cloud/token/out/{device_id}" }, "source_topic": { "device": "cloud/token/in/391b55312XXXX" }, "url": "ssl://m1.tuyaeu.com:8883", "username": "cloud_391b55312b11eXXXXX" }, "success": true, "t": XXXX } 2021-10-27 13:49:20 DEBUG (Thread-4) [tuya iot] connecting ssl://m1.tuyaeu.com:8883 2021-10-27 13:49:20 DEBUG (Thread-4) [tuya iot] _on_log: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'cloud_XXXX5eedc' 2021-10-27 13:49:20 DEBUG (SyncWorker_0) [tuya iot] Response: { "result": [ { "active_time": 1628412520, "biz_type": 0, "category": "kg", "create_time": 1628412520, "icon": "smart/product_icon2/kg_1.png", "id": "vdevoXX", "ip": "", "lat": "", "local_key": "", "lon": "", "model": "HYS-00-001-HYS", "name": "Smart Switch-vdevo", "online": true, "owner_id": "XX", "product_id": "XX", "product_name": "Smart Switch", "status": [

renaudallard commented 2 years ago

I have the same issue and If I use the cloud IP whitelist to add my IP, it tells me:

Warning The IP address you added has exceeded the service range of the current data center, and there will be data security compliance risks. It is recommended that you change the IP address. Tuya will completely prohibit cross-regional data calls to ensure data security for you and the users.

renaudallard commented 2 years ago

The datacenter I had to choose is in Central Europe, as Belgium was only autheorized in central europe, which is already something strange. if I go to "https://openapi.tuyaeu.com/v1.0/devices/deviceid", I get the error, even from an IP in Germany or Poland

renaudallard commented 2 years ago

I have opened a ticket at tuya to check what they say.

Mehul commented 2 years ago

In my Tuya IoT project, I turned the "Cloud Authorization IP Allowlist" setting to OFF (under Cloud -> Overview) and it worked for me. Hope it helps.

image

romainlouvet commented 2 years ago

same problem for me Capture d’écran 2022-01-07 à 11 36 11

lcarrasco commented 2 years ago

Same :(

sasch901 commented 2 years ago

Same here

puntcomjordi commented 2 years ago

mismo problema. Login error (1114): your ip(95.169.xxx.xxx) don't have access to this API

crisanadrian commented 2 years ago

Scan the QR code with Smart Life App and it will work. i was try with whitelist for ip but it was still not work. then i read somewhere, somebody used SmartLife instead off tuya and it works.

ghost-bullet commented 2 years ago

check homepage development "Cloud Authorization IP Allowlist" is enabled , my answer is late but someone can benefit from it.

sener83 commented 2 years ago

check homepage development "Cloud Authorization IP Allowlist" is enabled , my answer is late but someone can benefit from it.

thank you for the hint. This has worked

michaelruck138 commented 1 year ago

this is exactly what happened to me. Had the tuya solution working really nicely and then it expired. They have kindly extended it by 6 months however when I look at the tuya integration in HA, there are no devices to manage thus all the automation has now failed. I've raised a ticket with them so I'll wait and see what they say.

PrzemekSkw commented 1 year ago

Still no working solution? That checking - unchecking Cloud Authorization IP Allowlist don't fix that error.

Salamandar commented 1 year ago

Same here, I added my IP address but i keep getting the same error message. Tuya is a nightmare.

coleburg commented 1 year ago

same issue here, is this being investigated as its been open for some time.

JesusMarlor commented 1 year ago

same

hod25 commented 1 year ago

same

arturmaj commented 1 year ago

same

jurgen4194 commented 1 year ago

same

Thijsjuh92 commented 1 year ago

Same

rccipriani commented 1 year ago

Having the same problem in Postman so it doesn't seem to be HASS-specific.

marbovo commented 9 months ago

Having the same problem in Postman so it doesn't seem to be HASS-specific.

I had the same error on postman, then I used Tuya's collection from here.

Note: On Pre-request Script the command const mode = pm.request.body.mode; must be changed to const mode = pm.environment.get("mode"); or simply "urlencoded"

AppleLatino commented 7 months ago

In my Tuya IoT project, I turned the "Cloud Authorization IP Allowlist" setting to OFF (under Cloud -> Overview) and it worked for me. Hope it helps.

image

Thank you very much. it work for me this solution. you save me a lot hours troubleshooting lol

EdisonACDC commented 7 months ago

Scansiona il codice QR con l'app Smart Life e funzionerà. Ho provato con la whitelist per IP ma ancora non funzionava. poi ho letto da qualche parte che qualcuno ha usato SmartLife invece di Tuya e funziona.

SI FINZIONA ANCHE CON SMARTLIFE

gcbarrie commented 7 months ago

There is a "configure" link next to "Cloud Authorization IP Allowlist" where you can add your IP address.

yanellap81 commented 7 months ago

In my Tuya IoT project, I turned the "Cloud Authorization IP Allowlist" setting to OFF (under Cloud -> Overview) and it worked for me. Hope it helps.

image

Thank You, works fine.

mimich38 commented 7 months ago

great Same for me

rhodsllwyd commented 5 months ago

In my Tuya IoT project, I turned the "Cloud Authorization IP Allowlist" setting to OFF (under Cloud -> Overview) and it worked for me. Hope it helps. image

Thank you very much. it work for me this solution. you save me a lot hours troubleshooting lol

Thanks for this quick fix