Closed carsten-h closed 6 years ago
Can you please provide the output of node -v
?
Sure, this is: v11.1.0
Am 10.11.2018 um 16:52 schrieb Max Isom notifications@github.com:
Can you please provide the output of node -v?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/codetheweb/tuyapi/issues/108#issuecomment-437593390, or mute the thread https://github.com/notifications/unsubscribe-auth/AqTkfIEYASmNNTC5vHtevgQSsEcmnPYGks5utvYxgaJpZM4YX-Jo.
Ok, so it's up to date.
The error looks like the Raspberry Pi is running out of RAM. Are you able to try using it on Windows or macOS?
It is only a Pi zero W and I have homebridge and pi-hole running. Maybe this is too much?
I stopped pi-hole and now I get the QR-Code and the settings for the proxy. This is working. I can install the certificate in my iPhone and I can set the proxy to the given parameters (IP address of the Pi and port 8001).
If I try to reach anything on my iphone in the browser I am getting an error message, that there is no connection to this server. Also the Smartlife App is showing me a network error. So the process is not working. I will search what can be also wrong. I still can switch the tuya outlet with the Smartlife App.
It seems the proxy can not reach the outside world.
I saw the other issue where no data is send through the proxy. I did what you asked there:
[AnyProxy WARN][2018-11-11 10:16:44]: ROOT CA NOT INSTALLED YET [AnyProxy Log][2018-11-11 10:16:44]: The root CA file path is: /root/.anyproxy/certificates/rootCA.crt [AnyProxy Log][2018-11-11 10:17:00]: Http proxy started on port 8001 [AnyProxy Log][2018-11-11 10:17:00]: web interface started on port 8002 [AnyProxy Log][2018-11-11 10:17:22]: received https CONNECT request www.google.de [AnyProxy Log][2018-11-11 10:17:22]: will forward to local https server [AnyProxy Log][2018-11-11 10:17:22]: [internal https]proxy server for www.google.de established [AnyProxy Log][2018-11-11 10:17:22]: received https CONNECT request www.google.de [AnyProxy Log][2018-11-11 10:17:22]: will forward to local https server [AnyProxy Log][2018-11-11 10:17:22]: [internal https]proxy server for www.google.de established [AnyProxy Log][2018-11-11 10:17:22]: received https CONNECT request www.google.de [AnyProxy Log][2018-11-11 10:17:22]: will forward to local https server ^C[AnyProxy Log][2018-11-11 10:18:01]: destorying https connection : 127.0.0.1:38257 [AnyProxy Log][2018-11-11 10:18:01]: endding https cltSocket : 127.0.0.1:38257 [AnyProxy Log][2018-11-11 10:18:01]: clearing cache file... [AnyProxy Log][2018-11-11 10:18:01]: ==>>> clearing cache [AnyProxy Log][2018-11-11 10:18:01]: closing webserver...
This is what happen when using Smartlife App:
[AnyProxy WARN][2018-11-11 11:15:03]: ROOT CA NOT INSTALLED YET [AnyProxy Log][2018-11-11 11:15:03]: The root CA file path is: /root/.anyproxy/certificates/rootCA.crt [AnyProxy Log][2018-11-11 11:15:20]: Http proxy started on port 8001 [AnyProxy Log][2018-11-11 11:15:20]: web interface started on port 8002 [AnyProxy Log][2018-11-11 11:15:21]: received https CONNECT request a1.tuyaeu.com [AnyProxy Log][2018-11-11 11:15:21]: received https CONNECT request ios.bugly.qq.com [AnyProxy Log][2018-11-11 11:15:21]: will forward to local https server [AnyProxy Log][2018-11-11 11:15:21]: will forward to local https server [AnyProxy Log][2018-11-11 11:15:21]: [internal https]proxy server for a1.tuyaeu.com established [AnyProxy Log][2018-11-11 11:15:21]: [internal https]proxy server for ios.bugly.qq.com established [AnyProxy Log][2018-11-11 11:15:22]: received https CONNECT request a1.tuyaeu.com [AnyProxy Log][2018-11-11 11:15:22]: will forward to local https server [AnyProxy Log][2018-11-11 11:15:22]: [internal https]proxy server for a1.tuyaeu.com established [AnyProxy Log][2018-11-11 11:15:26]: received https CONNECT request a1.tuyaeu.com [AnyProxy Log][2018-11-11 11:15:26]: will forward to local https server [AnyProxy Log][2018-11-11 11:15:26]: [internal https]proxy server for a1.tuyaeu.com established [AnyProxy Log][2018-11-11 11:15:27]: received https CONNECT request a1.tuyaeu.com [AnyProxy Log][2018-11-11 11:15:27]: will forward to local https server [AnyProxy Log][2018-11-11 11:15:27]: [internal https]proxy server for a1.tuyaeu.com established [AnyProxy Log][2018-11-11 11:15:27]: received https CONNECT request gateway.icloud.com [AnyProxy Log][2018-11-11 11:15:28]: will forward to local https server [AnyProxy Log][2018-11-11 11:15:28]: [internal https]proxy server for gateway.icloud.com established
I don't know if this helps. When I call http://192.168.178.38:8001 from Safari on my iPhone I am getting: [ERROR]: Unable to parse results from queryads.php: Unhandled error message (Invalid domain!)
This seems to be something from pi-hole. I will search if I can switch it off completeley.
I switched all the services from pi-hole off completely and nothing changed. The messages I am getting are still the same.
Looks like AnyProxy is complaining that the root CA certificate isn't installed, which would result in the behavior you're experiencing. Did you run anyproxy-ca
to generate the certificate (may need to prefix that command with sudo
)?
I wrote in one message above this:
sudo anyproxy-ca detecting CA status... AnyProxy CA does not exist. ? Would you like to generate one ? Yes temp certs cleared rootCA generated PLEASE TRUST the rootCA.crt in /root/.anyproxy/certificates The cert is generated at /root/.anyproxy/certificates. Please trust the rootCA.crt.
I thought that this installed the root CA certificate. I read the QR-Code it with my iPhone and installed this certificate on it. Or do I also have to do one step more in the raspberry pi?
It looks like since you're using sudo
to install the root certificate it's going in the root user's directory. Try running sudo tuya-cli list-app
and see what happens.
Yes, I am using sudo because otherwise it was not working. I also used sudo for tuya-cli.
This is the certificate I installed on my iPhone:
I did a freah install of anyproxy:
sudo npm i anyproxy -g npm WARN deprecated clipboard-js@0.3.6: Please migrate to https://github.com/lgarron/clipboard-polyfill /usr/local/bin/anyproxy-ca -> /usr/local/lib/node_modules/anyproxy/bin/anyproxy-ca /usr/local/bin/anyproxy -> /usr/local/lib/node_modules/anyproxy/bin/anyproxy npm WARN svg-inline-react@1.0.3 requires a peer of react@^0.14.0 || ^15.0.0 but none is installed. You must install peer dependencies yourself.
+ anyproxy@4.0.12 removed 3 packages and updated 2 packages in 93.064s
Then this:
sudo anyproxy-ca detecting CA status... AnyProxy CA exists, but not be trusted ? Would you like to open the folder and trust it ? Yes
Then this:
sudo anyproxy -i [AnyProxy WARN][2018-11-12 15:27:43]: ROOT CA NOT INSTALLED YET [AnyProxy Log][2018-11-12 15:27:43]: The root CA file path is: /root/.anyproxy/certificates/rootCA.crt [AnyProxy Log][2018-11-12 15:27:59]: Http proxy started on port 8001 [AnyProxy Log][2018-11-12 15:27:59]: web interface started on port 8002 AnyProxy Log][2018-11-12 15:28:19]: received https CONNECT request www.google.de [AnyProxy Log][2018-11-12 15:28:19]: will forward to local https server [AnyProxy Log][2018-11-12 15:28:19]: [internal https]proxy server for www.google.de established [AnyProxy Log][2018-11-12 15:28:19]: received https CONNECT request www.google.de [AnyProxy Log][2018-11-12 15:28:19]: will forward to local https server ^C[AnyProxy Log][2018-11-12 15:29:16]: destorying https connection : 127.0.0.1:33499 [AnyProxy Log][2018-11-12 15:29:16]: endding https cltSocket : 127.0.0.1:33499 [AnyProxy Log][2018-11-12 15:29:16]: clearing cache file... [AnyProxy Log][2018-11-12 15:29:16]: ==>>> clearing cache [AnyProxy Log][2018-11-12 15:29:16]: closing webserver...
Then this:
sudo npm i @tuyapi/cli -g npm WARN deprecated clipboard-js@0.3.6: Please migrate to https://github.com/lgarron/clipboard-polyfill /usr/local/bin/tuya-cli -> /usr/local/lib/node_modules/@tuyapi/cli/cli.js npm WARN svg-inline-react@1.0.3 requires a peer of react@^0.14.0 || ^15.0.0 but none is installed. You must install peer dependencies yourself.
+ @tuyapi/cli@1.4.1 removed 3 packages and updated 3 packages in 131.518s
The strange thing is that anyproxy is telling this: "AnyProxy CA exists, but not be trusted" and this: "AnyProxy CA exists, but not be trusted" or is this normal?
Oh my god, I saw the thing in the other thread I was missing to do. I also didn't set the Certificate trust settings.
Now I am one step further. When I call google.de in Safari on my iPhone I am getting:
And the Smartlife App is still showing the same error.
Hmm, strange. I stiil get the error in the Smartlife App, but tuyapi-cli prints me out two id/key pairs. Is it normal that the id/key pair is also printed for devices that are not online?
And also I had it five times now that the call to "tuyapi-cli list-app" is showing me only this:
I had to kill the ssh connection as CTRL-C is not working.
Thank you for your help so far! I am so stupid, that I didn't see the trusting of the certificate in the instructions.
@carsten-h no problem.
It will show devices that are offline because it just intercepts the Tuya cloud response which includes all devices.
You should see key/ID pairs being printed out, then an error will pop up in the app because the proxy is killed. Sounds like it's working.
Ah, OK I see. Then this is clear.
Do you know why the tuya-cli output stops in the middle of the QR-code? Is this also a problem of too less RAM?
Not sure what you mean, are you saying that you don't see a spinner and the text "Waiting for request..." or something similar? If so, it could be a RAM issue but I'm not sure.
Yes, the output stops at this point. There is no more reaction in this SSH session.
But today I installed homebridge-tuya and both devices worked without any problem! Thank you for you great work and support!
One question at last: Is the plugin working completely in the local net to switch the outlets? So I can cut them off from internet?
Yes, it's completely local. It doesn't talk with Tuya's cloud servers at all.
I did all the things mentioned on https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md
This is what I got:
There was no QR-code printed out by tuya-cli list-app. What am I doing wrong?
I have it installed on a Raspberry Pi zero W with Rasbian Strech lite.
Thank you for help!