tuya-home-assistant icon indicating copy to clipboard operation
tuya-home-assistant copied to clipboard

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

Open mrrepel opened this issue 3 years ago • 28 comments

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": [

mrrepel avatar Oct 27 '21 12:10 mrrepel

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 avatar Nov 04 '21 10:11 renaudallard

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 avatar Nov 04 '21 11:11 renaudallard

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

renaudallard avatar Nov 04 '21 11:11 renaudallard

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

Mehul avatar Jan 07 '22 05:01 Mehul

From Tuya website:

How to resolve it if the calling interface has an error code: 1114, your ip(...) don't have access to this API? Last Updated on: 2021-11-01 10:49:30

  1. Check whether the whitelist is enabled on the homepage of the cloud development project without adding an IP
  2. Check if Client_id is added to the API request header

mvalcke avatar Jan 07 '22 06:01 mvalcke

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

romainlouvet avatar Jan 07 '22 10:01 romainlouvet

Same :(

lcarrasco avatar Jan 23 '22 23:01 lcarrasco

Same here

sasch901 avatar Feb 10 '22 20:02 sasch901

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

puntcomjordi avatar Feb 13 '22 18:02 puntcomjordi

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.

crisanadrian avatar Mar 04 '22 18:03 crisanadrian

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

ghost-bullet avatar Apr 10 '22 02:04 ghost-bullet

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

sener83 avatar Jun 01 '22 13:06 sener83

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.

michaelruck138 avatar Oct 12 '22 16:10 michaelruck138

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

PrzemekSkw avatar Nov 17 '22 11:11 PrzemekSkw

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

Salamandar avatar Dec 19 '22 16:12 Salamandar

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

coleburg avatar Feb 08 '23 20:02 coleburg

same

JesusMarlor avatar Feb 24 '23 17:02 JesusMarlor

same

hod25 avatar Mar 07 '23 16:03 hod25

same

arturmaj avatar Mar 19 '23 08:03 arturmaj

same

jurgen4194 avatar Mar 26 '23 13:03 jurgen4194

Same

Thijsjuh92 avatar Mar 28 '23 23:03 Thijsjuh92

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

rccipriani avatar May 18 '23 01:05 rccipriani

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"

marbovo avatar Sep 28 '23 17:09 marbovo

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

AppleLatino avatar Nov 06 '23 12:11 AppleLatino

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

EdisonACDC avatar Nov 06 '23 20:11 EdisonACDC

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

gcbarrie avatar Nov 07 '23 00:11 gcbarrie

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.

yanellap81 avatar Nov 21 '23 18:11 yanellap81

great Same for me

mimich38 avatar Nov 27 '23 19:11 mimich38

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

rhodsllwyd avatar Jan 17 '24 17:01 rhodsllwyd