TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
261 stars 44 forks source link

Wizard returns a strange key (encoded ?) #160

Open AlainKaim opened 1 year ago

AlainKaim commented 1 year ago

Hello From time to time, one of my device is disconnected, so I have to connect it again with the Tuya App. And then, I use tuya-cli wizard to get the new key and modify my homebridge config file. This is usually a smooth process, but today, after successfully reconnecting a blind to Tuya app( and it works through it), the wizard returned a strange key : { name: 'Volet salon petit', id: 'XXXXXXX', key: "1C<S<'HIBk*o_{eY" },

The name and id fields are ok. And the full informations are also ok for my other devices. It is just this key which is odd, and of course unusable in homebridge.

Any help will be appreciated :)

ferni7 commented 1 year ago

I've just came here to report the same thing, device disconnected had to re-add it with tuya app and now this one device has this weird key which doesn't work..

  {
    name: 'Stairs',
    id: 'xxxxxx',
    key: 'nKwYCKpsudKQn^?F'
  },
caco3 commented 1 year ago

Note that it at least is consistent with what the Tuya IoT REST API provides:

https://eu.iot.tuya.com/cloud/explorer?groupId=group-home&interfaceId=470224448454738 > "Device Management" > "Query Device Details in Bulk" returns:

{
  "result": [
    {
      [..]
      "local_key": "V+IuH~QWR`)v6A{r",
      [..]
    }
  ],
  "success": true,
  "t": 1687381074266,
  "tid": "4acd3a94107611eea68636790d793901"
}

And tuya-cli wizard returned

  {
    name: 'Wi-Fi hub',
    id: 'bf641c545b9e1920da14vi',
    key: 'V+IuH~QWR`)v6A{r'
  },
murtazabasrai commented 1 year ago

I have having the same issue after re-adding the device to Tuya App. Does anyone know how to get the correct key?

caco3 commented 1 year ago

Are you sure it is now encrypted? How did the yey look like before? I use exactly the key that gets returned and it works fine.

murtazabasrai commented 1 year ago

Hi, I tried and the returned key is correct. It's just that the key format has changed. Earlier it used to be in HEX. Now it's having symbols.

The issue of new key not working was in the homebridge Tuya plug-in that I was using which was validating the key as per the old format. I have found the fix to that so this new key format is not an issue. Thanks!

ferni7 commented 1 year ago

@murtazabasrai was that the Tuya Plugin https://github.com/iRayanKhan/homebridge-tuya#readme ?

If so can you please share the fix?

On Wed, 5 Jul 2023 at 5:05 am, Murtaza Basrai @.***> wrote:

Hi, I tried and the returned key is correct. It's just that the key format has changed. Earlier it used to be in HEX. Now it's having symbols.

The issue of new key not working was in the homebridge Tuya plug-in that I was using which was validating the key as per the old format. I have found the fix to that so this new key format is not an issue. Thanks!

— Reply to this email directly, view it on GitHub https://github.com/TuyaAPI/cli/issues/160#issuecomment-1620630623, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSZS5P3GSVWDRC3IIJ36DTXORSP5ANCNFSM6AAAAAAZETATFA . You are receiving this because you commented.Message ID: @.***>

murtazabasrai commented 1 year ago

Yep that's the one I'm using and here's the details of the fix that resolved the issue: https://github.com/iRayanKhan/homebridge-tuya/issues/409#issuecomment-1545078314

AlainKaim commented 1 year ago

This fix is working for me, thank you !!!I guess this will be modified in the next release of tuyalan….Have a great day !Le 5 juil. 2023 à 06:58, Murtaza Basrai @.***> a écrit : Yep that's the one I'm using and here's the details of the fix that resolved the issue: iRayanKhan/homebridge-tuya#409 (comment)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>