# Tuya integration configuration

**URL:** <https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140>\
**Category:** Configuration\
**Created:** [October 26, 2024, 9:59am UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140 "2024-10-26T09:59:44Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francis66](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/francis66/32/17375_2.png) [@Francis66](https://community.gladysassistant.com/u/Francis66)\
**Post date:** [October 26, 2024, 9:59am UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/1 "2024-10-26T09:59:44Z")

</div>

Hello @pierre-gilles  
In Gladys, after configuring the Cloud Tuya integration, when I select «&nbsp;Tuya discovery&nbsp;», I get the response «&nbsp;No device was discovered&nbsp;» even after the scan.

I have the same integration for HA (Home Assistant) which works — I first retrieved the Access Key, Secret Key, App account UID from the project created for HA. Then I created a new project for Gladys with a new configuration. The Tuya devices are correctly linked to the project but they do not appear in Gladys.  
The Tuya service is reporting an error.  
Excerpt from Gladys Docker logs  
2024-10-26T12:19:33+0200 \u003cerror\u003e tuya.discoverDevices.js:38 (TuyaHandler.discoverDevices) Unable to load Tuya devices TypeError: Cannot destructure property ‹&nbsp;list&nbsp;› of ‹&nbsp;result&nbsp;› as it is undefined.  
at TuyaHandler.loadDevices (/src/server/services/tuya/lib/tuya.loadDevices.js:25:11)  
at processTicksAndRejections (node:internal/process/task\_queues:95:5)  
at TuyaHandler.discoverDevices (/src/server/services/tuya/lib/tuya.discoverDevices.js:35:15)  
at discover (/src/server/services/tuya/api/tuya.controller.js:10:21)

Thank you in advance for your help

---

<div class="post-metadata">

**Author:** ![GBoulvin](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/gboulvin/32/10006_2.png) [@GBoulvin](https://community.gladysassistant.com/u/GBoulvin)\
**Post date:** [October 26, 2024, 11:25am UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/2 "2024-10-26T11:25:16Z")

</div>

I’m referring you to @pierre-gilles’s message about this…  
It seems that Tuya is unusable at the moment, until someone looks into it!

> [@Ampoule globe, smart life et tuya](https://community.gladysassistant.com/t/ampoule-globe-smart-life-et-tuya/9105/2?u=gboulvin):
>
> Salut @macthieu ! Bienvenue sur Gladys slight_smile Malheureusement, j’ai l’impression que récemment Tuya a changé quelque chose à son API et le tutoriel tel qu’on le propose sur la doc ne permet plus de récupérer les appareils Tuya dans Gladys… tu n’es pas le seul à faire cette remarque. J’ai beaucoup investigué cet été sur le sujet sans succès. De manière générale, je déconseille globalement les appareils Tuya, tu fais passer tes données dans le cloud chinois et tu es à la merci du bon…

---

<div class="post-metadata">

**Author:** ![Francis66](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/francis66/32/17375_2.png) [@Francis66](https://community.gladysassistant.com/u/Francis66)\
**Post date:** [October 26, 2024, 12:24pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/3 "2024-10-26T12:24:24Z")

</div>

Thank you for the response,I will be patient

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [October 26, 2024, 4:15pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/4 "2024-10-26T16:15:04Z")

</div>

Hi @Francis66, thanks for your feedback!

Indeed, since this summer all users have had the same feedback as you.

I already worked on it this summer but couldn’t find what was wrong; I was convinced until then that the Tuya API was no longer open for this use.

But I’m really curious to know how HA does it then.

Did you do anything particular on the HA side? When you created the API keys for HA, was it the same process as in Gladys or do they do something extra?

---

<div class="post-metadata">

**Author:** ![Francis66](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/francis66/32/17375_2.png) [@Francis66](https://community.gladysassistant.com/u/Francis66)\
**Post date:** [October 29, 2024, 1:46pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/5 "2024-10-29T13:46:21Z")

</div>

No, I don’t see any notable difference. Home Assistant (HA) has developed a new Tuya Smart Life integration to avoid having to revalidate permissions on Tuya IoT.  
I just bought 3 Calex lamps for their aesthetics; I’ll look further into Tuya Convert to see if I can eliminate the cloud. Currently I’m mainly equipping myself with Zigbee2MQTT

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [October 29, 2024, 5:09pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/6 "2024-10-29T17:09:26Z")

</div>

Actually, when I look at the Node.js package we use to connect to Tuya, everyone is complaining about the same issue — we’re not the only ones:

> <https://github.com/tuya/tuya-connector-nodejs/issues/17>
>
> I'm following this documentation https://developer.tuya.com/en/docs/iot/device-c…ontrol-best-practice-nodejs?id=Kaunfr776vomb
> 
> my code is as in the example:
> 
> \`\`\`
> const { TuyaContext } = require('@tuya/tuya-connector-nodejs')
> 
> const context = new TuyaContext({
> baseUrl: 'https://openapi.tuyaus.com',
> accessKey: 'hidden',
> secretKey: 'hidden',
> })
> 
> async function test () {
> const device\_id = 'hidden'
> const devicedetail = await context.device.detail({
> device\_id: device\_id,
> })
> if (! devicedetail.success) {
> new Error()
> }
> 
> console.log('Device details:', devicedetail)
> }
> 
> test()
> 
> \`\`\`
> 
> But I'm getting this error:
> 
> \`\`\`
> Device details: {
> code: 60009001,
> msg: 'API permission package error. For the solution, see https://developer.tuya.com/en/docs/iot/authentication-method?id=Ka49gbaxjygox.',
> success: false,
> t: 1719470515607,
> tid: '585338b5345011ef9c7442b1fe1466b5'
> }
> \`\`\`
> 
> There is no explanation how it should work

It’s infuriating, these cloud products, because we developed this service in July 2023 (Source: [https://community.gladysassistant.com/t/gladys-assistant-4-26-gladys](https://community.gladysassistant.com/t/gladys-assistant-4-26-gladys)

---

<div class="post-metadata">

**Author:** ![Francis66](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/francis66/32/17375_2.png) [@Francis66](https://community.gladysassistant.com/u/Francis66)\
**Post date:** [October 30, 2024, 4:01pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/7 "2024-10-30T16:01:56Z")

</div>

Sorry for my request and for having wasted time because, in the end, the TUYA integration works very well in Gladys.

This malfunction was related to 2 problems.

1. I no longer had rights to the API resources

- access to Cloud Develop Base Resource and IoT Core because the Trial period had expired.

1. For the zone: I had entered Western Europe instead of Central Europe

I found my lamps in «&nbsp;Tuya Discovery&nbsp;»

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [October 30, 2024, 5:44pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/8 "2024-10-30T17:44:05Z")

</div>

Ah, incredible! Because you’re not the only one who’s complained! I’ll send your post to the other users

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [October 31, 2024, 10:57am UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/9 "2024-10-31T10:57:46Z")

</div>

@Francis66 I’ve added a message in the documentation that points to this topic:

> **[Tuya | Gladys Assistant](https://gladysassistant.com/fr/docs/integrations/tuya/#le-scan-ne-fonctionne-pas-)**
>
> Connecter Tuya à Gladys

---

<div class="post-metadata">

**Author:** ![PhilippeMA](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/p/b3f665/32.png) [@PhilippeMA](https://community.gladysassistant.com/u/PhilippeMA)\
**Post date:** [November 1, 2024, 9:55pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/10 "2024-11-01T21:55:02Z")

</div>

Hello @Francis66

Thanks for pointing out the source of the problem. I confirm it’s the same for me.

However, I have a practical question: how did you reactivate the service? I did find the option to extend the trial period but it only offers a 6-month extension (which must be validated by Tuya…); so, will I have to do this every 6 months if that’s the only way?

---

<div class="post-metadata">

**Author:** ![Francis66](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/francis66/32/17375_2.png) [@Francis66](https://community.gladysassistant.com/u/Francis66)\
**Post date:** [November 2, 2024, 4:04pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/11 "2024-11-02T16:04:35Z")

</div>

Please confirm the response to the Tuya integration issue; this will save Pierre-Gilles time. Before starting with the Gladys starter kit, I was on HA (Home Assistant); the integration procedure is identical on the Tuya IoT side, with a «&nbsp;trial&nbsp;» period for authorizations. Following an email from Tuya notifying me of the expiration, I requested a 6-month extension, which was granted immediately. At the expiry of the second validation in December 2023 my commands and automations using Tuya hardware continued to be functional!! ?

However, during the integration into Gladys, Tuya had to verify my permissions. I was able to fill out a form requesting an exceptional extension of 1 to 6 months. The request was accepted within the next 10 minutes. I hope my integration will still be functional in 6 months…

However, I advise retrieving the «&nbsp;Local Key&nbsp;» associated with the «&nbsp;Id&nbsp;» of Tuya devices. Access rights are blocked when the authorization date is reached. This could be useful for local use.

---

<div class="post-metadata">

**Author:** ![Xenicle](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/xenicle/32/4893_2.png) [@Xenicle](https://community.gladysassistant.com/u/Xenicle)\
**Post date:** [January 17, 2025, 9:46pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/12 "2025-01-17T21:46:40Z")

</div>

Excuse me for digging up an old thread but I have a problem with the Tuya integration:  
I recently changed internet providers and since then the lamps I used with the Tuya integration no longer respond.

At first, I tried deleting the lamps present in the «&nbsp;devices&nbsp;» part of the integration to try to rediscover them and nothing was found… I saw this post: so I checked my access to «&nbsp;IoT Core&nbsp;» (I did not find «&nbsp;Cloud Develop Base Resouce&nbsp;») and indeed the trial period had expired (I was also on the Europe Central cloud). I requested an extension which was accepted. Since then I tried discovery again and still nothing…

But in Gladys logs I have this when I validate the configuration:

```auto
 <warn> service.start.js:44 (Service.start) Unable to st art service tuya Error: connect ETIMEDOUT 2a05:d014:afa:af00:568a:5cc6:4603:c040 :443
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -110,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '2xxxx:dxxx:axxxx:af00:568a:5cc6:4603:c040',
  port: 443,
  config: {
    url: 'https://openapi.tuyaeu.com/v1.3/iot-03/devices?last_row_key=\u0026source_id =euxxxxxxxxxxxx\u0026source_type=tuyaUser',
    method: 'get',
    data: '{}',
    headers: {
      Accept: 'application/json, text/plain, */*',
      t: '1737148959580',
      sign: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      client_id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
      sign_method: 'HMAC-SHA256',
      access_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      Dev_lang: 'Nodejs',
      Dev_channel: 'SaaSFramework',
      'Signature-Headers': '',
      'Content-Type': 'application/json',
      'User-Agent': 'axios/0.21.4',
      'Content-Length': 2
    },
    params: {},
    transformRequest: [[Function: transformRequest] ],
    transformResponse: [[Function: transformResponse] ],
    timeout: 0,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    }
  },
  request: \u003cref *1\u003e Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      constructed: true,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false,
      closeEmitted: false,
      [Symbol(kOnFinished)]: []
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'https:',
      path: '/v1.3/iot-03/devices?last_row_key=\u0026source_id=euxxxxxxxxxxxxxxxxxxx\u0026s ource_type=tuyaUser',
      method: 'GET',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: 'openapi.tuyaeu.com',
      port: null,
      nativeProtocols: [Object],
      pathname: '/v1.3/iot-03/devices',
      search: '?last_row_key=\u0026source_id=euxxxxxxxxxxxxxxxxxxxxxxx\u0026source_type=tuyaUser'
    },
    _ended: false,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 2,
    _requestBodyBuffers: [[Object] ],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 2,
      _hasBody: true,
      _trailer: '',
      finished: false,
      _headerSent: true,
      _closed: false,
      socket: [TLSSocket],
      _header: 'GET /v1.3/iot-03/devices?last_row_key=\u0026source_id=euxxxxxxxxxxxxxxx AowJC\u0026source_type=tuyaUser HTTP/1.1\\r\\n' +
        'Accept: application/json, text/plain, */*\\r\\n' +
        't: 1737148959580\\r\\n' +
        'sign: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\ r\\n' +
        'client_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\r\\n' +
        'sign_method: HMAC-SHA256\\r\\n' +
        'access_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\\r\\n' +
        'Dev_lang: Nodejs\\r\\n' +
        'Dev_channel: SaaSFramework\\r\\n' +
        'Signature-Headers: \\r\\n' +
        'Content-Type: application/json\\r\\n' +
        'User-Agent: axios/0.21.4\\r\\n' +
        'Content-Length: 2\\r\\n' +
        'Host: openapi.tuyaeu.com\\r\\n' +
        'Connection: close\\r\\n' +
        '\\r\\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/v1.3/iot-03/devices?last_row_key=\u0026source_id=euxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u0026s ource_type=tuyaUser',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'openapi.tuyaeu.com',
      protocol: 'https:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    _currentUrl: 'https://openapi.tuyaeu.com/v1.3/iot-03/devices?last_row_key=\u0026s ource_id=euxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u0026source_type=tuyaUser',
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

```

It looks like it’s timing out but I don’t know why…

It works fine with the Smart Home app on my phone and I can ping a lamp from Gladys without problem.

I wonder if the API URL changed or what!? ^^

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 17, 2025, 9:53pm UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/13 "2025-01-17T21:53:15Z")

</div>

Hi @Xenicle, are you sure you don’t have a network issue or a misconfiguration?

If I open the URL you provided, there is indeed a server at the other end:

 ![Screenshot 2025-01-17 at 22.52.06](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/e/0/e000a33660b68cf711a7fabf2273dd51c9e6037b.jpeg)

(well, a token is missing to test, but the server is definitely there)

---

<div class="post-metadata">

**Author:** ![Xenicle](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/xenicle/32/4893_2.png) [@Xenicle](https://community.gladysassistant.com/u/Xenicle)\
**Post date:** [January 18, 2025, 1:57am UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/14 "2025-01-18T01:57:00Z")

</div>

I’ll check that! I thought of that too but haven’t «&nbsp;checked&nbsp;» yet…

---

<div class="post-metadata">

**Author:** ![Xenicle](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/xenicle/32/4893_2.png) [@Xenicle](https://community.gladysassistant.com/u/Xenicle)\
**Post date:** [January 18, 2025, 2:08am UTC](https://community.gladysassistant.com/t/configuration-de-lintegration-tuya/9140/15 "2025-01-18T02:08:34Z")

</div>

However, from the mini-PC :

```auto
@gladys:~$ httping -c 3 -g https://openapi.tuyaeu.com/v1.3/iot-03/devices?last_row_key=\u0026source_id=\u0026source_type=tuyaUser
[2] 181345
[3] 181346
gladys@gladys:~$ Auto enabling SSL due to https-URL
PING openapi.tuyaeu.com:443 (/v1.3/iot-03/devices?last_row_key=):
connected to 3.69.78.245:443 (617 bytes), seq=0 time=132,80 ms
connected to 3.69.78.245:443 (617 bytes), seq=1 time= 72,15 ms
connected to 3.69.78.245:443 (617 bytes), seq=2 time= 70,65 ms
--- https://openapi.tuyaeu.com/v1.3/iot-03/devices?last_row_key= ping statistics ---
3 connects, 3 ok, 0,00% failed, time 3278ms
round
```
