-
Notifications
You must be signed in to change notification settings - Fork 50
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
Homebridge discovering device then crashing while trying to add #47
Comments
@AMoo-Miki can you have a look into this and try and see why it’s not working |
I looked at
Lemme know how it goes. |
Please give the latest A known issue is that the current state is not reported by some devices; they however work fine as soon as you interact with them. I have reached out to Tuya for a solution. The Setup Instructions have changed in case you need to obtain a fresh |
Ok, thanks. I will have a look at this know. Also, did i hear you say somewhere else that Tuya is currently working on Homekit intergration as standard. |
Just a quick update. I have just used the command that you provided and it has discovered the device however homebridge crashes not long after discovering the device and is giving an Key Error saying that my key is too long. I will try and get and updated key and id now and report back. |
@TheHomekitWayFinder, regarding Tuya and Homekit, that is what they told me. Let's hope it is not limited to Siri Shortcuts. Their implementation would save us from all these hoops. |
When I try to get the key for my air conditioner, tuya-lan-find starts to print out somethings and then crashes |
If it shows garbage, it is an indicator of a bad certificate. Delete any previous NodeMITMProxyCA certificates you might have on the phone before you start PS. I just noticed that you are doing this on Windows; I have not tested it on Windows. Lemme see if I can do it quickly. Regarding Homebridge crashing, can you get your hands on some logs to see what's causing it? |
I ran it on Windows and it didn't give me any trouble. It shows many "socket hang up" errors but those can be ignored. I will suppress them soon. |
Is it possible that you are adding the key and id inverted? Hold on, lemme add key length verification so that it wont crash! Gimme a min. |
No, as in the app id now shows the Virtual ID and i have compared the two and they are both the same so im presuming it's just that the key is wrong. |
Can you please update with |
I have just run tuya-lan-find again and it gives lots of socket hang up errors but it doesnt give the id or key of my air conditioner. I have also just today purchased a Arlec 4 outlet power strip and that uses the tuya protocol and therefore i need to get this working so that i can add that to homekit. I will run the update and give it another shot in a sec. |
The update still isnt working. Unfortunately |
It crashed? How long is your key? Is it possible that windows firewall is preventing node from opening the sockets? Also, can you please give me the outputs for these
|
yep it crashed again. in my config file my key is 16 characters long however it was 17 before so I believe that my key may be wrong. Version of i will check the firewall now - the firewall doesnt seem to be effecting homebridge or anything |
If you are using the native firewall of Windows, to add a rule allowing:
To remove it:
If you get an error from |
While these socket timeouts are shown, can you please kill the Tuya app on your phone and open it again? Please make sure you kill it and not just minimize it. You are using the Tuya Smart app right? The one with the red icon? PS, I just pushed v1.5.0-rc.5 to NPM to suppress the |
No, i am using the kogan smarterhome app. i am making sure that i kill the app by double clicking the home button and swiping up on the app |
This will only work with the Tuya Smart app to fetch the |
ok i will try that now. It wants me to reset the device which would involve removing it from the Kogan app. Would I still be able to acquire the key and id using the old method using anyproxy |
Oops, and I guess if you add it to Kogan, you will have to reset it again which most probably changes the id and key. Anyproxy doesn't work anymore. Lemme find a different way. Hold on a min. Let's get your hands dirty with some code changes. (if you find this hard, lemme know and I will send you a file)
This should give you the full body of the request which is gigantic. Look for |
there are 2 instances of the tuya.m.my.group.device.list do i change both of them |
yes please. |
it still isnt pulling the key and id |
Where was EADDRINUSE ? |
Can you delete the cert from your phone and scan the QR code from the Kogan.js script? |
I deleted the certificate from the cli.js script before I scanned the QR code from the Kogan.js script. But I can’t do anything at the moment as I have just gone out Sent with GitHawk |
I understand. I will think a bit to see what we can do about this and post back. |
Do you want me to see if I can source the signature some how? Sent with GitHawk |
The Also, if we could find a MITM proxy that has a GUI, we can see what the Kogan app is doing. |
What about MITMproxy that has a web interface like anyproxy did Sent with GitHawk |
You mean this? I just tested it on Windows and it is great. After you install it, change the proxy settings on your phone to your Windows IP and 8080. Then open |
I have just tried to reset the device and add it to the TuyaSmart app, however the device keeps timing out before the app has finished pairing. But when I go back into the Kogan SmarterHome app it pairs very quickly Sent with GitHawk |
I just tried using Mitmproxy after adding the air conditioner back to the Kogan SmarterHome app and it would pull up any details to do with it. It pulls up lots for websites but nothing for apps. The same happens when I try to get the id and key of my Arlec Grid Connect Power Strip. Sent with GitHawk |
Do u have a Mac? |
Yes I do Sent with GitHawk |
I guessing this is out of date as you said previously that anyproxy no-longer works but, https://gist.github.com/aceslick911/0cac96ab122fa9c6cd9ca18a696ea961 |
Thanks. Sadly it didn't provide much help. Can you follow these steps please: #53 (comment) ... but don't send me your PCAP as it would have way too much of information. A few comments below that, I have described how you can filter everything and send me only Tuya's data. Just one deviation: don't include My goal is to see what the Kogan app is telling the device and find my way from there. |
Ok will try that in a bit. Is there anyway of maybe asking if Tuya could present the local key in the app when connected to the same network as the devices as it would make it much easier for external integrations such as homebridge. The only thing would be security. Sent with GitHawk |
Here is the signature that I acquired from command prompt when running homebridge with the old key and that isn’t working. It shows up but then when controlling through HomeKit the device doesn’t respond to the commands but still appears online. I guessing this is because it has the wrong key. Sent with GitHawk |
The One way to check if the |
I just tried the pcap method but it was giving errors I don’t know whether I was doing it wrong orwhat Sent with GitHawk |
Do you know what error it gave you? Also can you check if the |
Also did you mean the UDID or the ECID |
@AMoo-Miki i have just sent through the 2 files that you requested from wireshark through to your email. I dont know my correct key so therefore i didnt provide it. If there is anything else you need just let me know. I hope that you are able to distinguish a key from that. |
I just ran thing that you asked me to do previously to check the key and it kept coming back with odd message from AC with command 8 Sent with GitHawk |
There wasn’t any error it was just that I was using the wrong device number. I was using the ECID rather than the UDID therefore it wasn’t working. Sent with GitHawk |
Silly me. I fixed the instructions. Thanks for pointing it out. I did get your email. Sadly without the Let's try and test your keys:
If it succeeds in decoding, the key is good. PS, that is exactly what I do with the file I get :) |
@AMoo-Miki sorry I have been so busy recently and when I have time I will try it and let you know |
Of course. Ping me whenever you get a chance. |
@AMoo-Miki I have just gotten round to trying some stuff out, and I bought a new powerboard the other week and i wanted to try and get that into home bridge so when I got it I loaded it into the tuya smart app and have just today been able to successfully retrieve the key from the device after following the instructions I realised that when I had been previously attempting to retrieve the key I hadn't been granting the certificate full trust settings, I have also been able to load the air conditioner into homebridge fully and I am now able to control it through HomeKit. However, do you know whether there is any way to separate the outlets on the powerboard as I am using the board in many different rooms however HomeKit won't allow me to separate them based on places and add each outlet to favourites instead of just the master board. |
@TheHomekitWayFinder that is good to know. I too found the grouping annoying and good news is that with the latest iOS, they have an option to separate the icons. I just saw it in my 13.3.1; give it a shot. Lemme know if I can help in any other way. |
I own a Kogan SmarterHome Air Conditioner that can both heat and cool. I have trued adding it to HomeKit through this plugin but then when it discovers the device my local area network it proceeds to crash homebridge. Here is the link to the air conditioner: https://www.kogan.com/au/buy/kogan-smarterhome-41kw-portable-air-conditioner-14000-btu-reverse-cycle/?openModal=2
Here is the log from homebridge:
`[5/12/2019, 8:32:13 PM] [TuyaLan] Discovered AC (71645600b4e62d215921)
C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\node_modules\node-forge\lib\aes.js:203
var len = tmp.length();
^
TypeError: tmp.length is not a function
at forge.aes.Algorithm.initialize (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\node_modules\node-forge\lib\aes.js:203:19)
at new forge.cipher.BlockCipher (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\node_modules\node-forge\lib\cipher.js:118:18)
at Object.forge.cipher.createCipher (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\node_modules\node-forge\lib\cipher.js:42:10)
at new TuyaAccessory (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\lib\TuyaAccessory.js:28:36)
at EventEmitter.TuyaAccessory.discover.on.config (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\index.js:77:32)
at EventEmitter.emit (events.js:182:13)
at Socket.server.on.msg (C:\Users\xxxxx\AppData\Roaming\npm\node_modules\homebridge-tuya-lan\lib\TuyaAccessory.js:343:24)
at Socket.emit (events.js:182:13)
at UDP.onMessage [as onmessage] (dgram.js:628:8)`
here is my config.json file:
`{
"bridge": {
"name": "Homebridge",
"username": "xx:xx:xx:xx:xx",
"port": 51826,
"pin": "xxx-xx-xxx"
},
"description": "This is an example configuration file.",
"platforms": [{
"platform": "TplinkSmarthome",
"name": "TplinkSmarthome"
},
{
"platform": "TuyaLan",
"devices": [{
],
"accessories": [{
"accessory": "Xbox",
"name": "Xbox",
"ipAddress": "xx.x.x.x",
"liveId": "xxxxxxxxxxxx"
}]
}`
The text was updated successfully, but these errors were encountered: