Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not a valid key #285

Open
wormpy001 opened this issue Jun 25, 2023 · 5 comments
Open

not a valid key #285

wormpy001 opened this issue Jun 25, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@wormpy001
Copy link

wormpy001 commented Jun 25, 2023

When I try to add the pasword for a tuna device I get an error about that the key is not valid
Previosly I get a key like "397a16f2689cf1f6" and now the key is like "ylAf_1TD'r44@&?>" but homebridge gives an error "[25/6/2023 09:43:58] [TuyaLan] ylAf_1TD'r44****, key for Lightstrip Radio (bf8ee5bf9391cbcab8og8s), is not a valid key."
I tried to delete the device and install the device again but it always gives a pasword with strange combinations.
Is there a work-around?

@wormpy001 wormpy001 added the bug Something isn't working label Jun 25, 2023
@Akury83
Copy link

Akury83 commented Jun 29, 2023

Are you using HOOBS? If so,

  1. Head to /var/lib/hoobs/tuyalanbridge/node_modules/homebridge-tuya-lan
  2. edit your index.js file at line 76 and comment out the statement if (!/^[0-9a-f]+$/i.test(device.key)) return this.log.error('%s, key for %s (%s), is not a valid key.', device.key.replace(/.{4}$/, '****'), device.name || 'unnamed device', device.id); by putting a // in front of the line.

Or you could use this solution if you're running homebridge: https://github.com/iRayanKhan/homebridge-tuya/issues/409

@wormpy001
Copy link
Author

Thanks It works again

@beze
Copy link

beze commented Jul 17, 2023

@Akury83 , the homebridge solution link is broken, can you tell me what is the solution for homebridge?

@thordnel
Copy link

@Akury83 , the homebridge solution link is broken, can you tell me what is the solution for homebridge?

I think you have to copy the link and paste it in the browser address. Because when i tried to click the link above it goes into a different page.

@RoboChopp
Copy link

RoboChopp commented Aug 13, 2023

Another Tuya Lan plugin has the same issue with the new key formats. Commenting out the line that checks for the invalid key character errors lets the plugin continue processing the command, but fails silently as it can't understand certain characters in the key e.g. '

Here was jconsolatti's finding, quoted:

"Little python debugging and it seems to confirm the parsing issue..

Orginal and broken:

d = tinytuya.OutletDevice('12345eb1f71e050cetfww', '100.88.55.77', '12345%$A'hACm:ts')

Working:
local_key = "12345%$A'hACm:ts"

d = tinytuya.OutletDevice('12345eb1f71e050cetfww', '100.88.55.77', str(local_key))"

Basically creating a string that contains the key and then calling that. Could this be rolled out or tested on this plugin?

link to other thread:

iRayanKhan/homebridge-tuya#409

Scaletta pushed a commit to Scaletta/homebridge-tuya-lan that referenced this issue Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants