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

Connecting to 10.10.7.1:80... failed: Connection timed out. #12

Closed
NiekN opened this issue Feb 14, 2018 · 77 comments
Closed

Connecting to 10.10.7.1:80... failed: Connection timed out. #12

NiekN opened this issue Feb 14, 2018 · 77 comments

Comments

@NiekN
Copy link

NiekN commented Feb 14, 2018

i cannot succeed in connecting to the Sonoff, and need some help

im running the simple-sonoff-server(at putty screen 1)
1.set the sonoff basic into AP mode
2. find and logged into the sonoff (at chrome url)
3,. but when i used "wget -O- 10.10.7.1/device" (at putty screen 2)
i get...
Connecting to 10.10.7.1:80... failed: Connection timed out.
Retrying.

what im doing wrong here ??

@NiekN
Copy link
Author

NiekN commented Feb 14, 2018

how can i connect with my pi on the access point that will appear (SSID:ITEAD-10000xxxxx Password:12345678)??

@mdopp
Copy link
Owner

mdopp commented Feb 14, 2018

For me, I use my notebook for setting up the sonoff devices. Wasn't able to make it happen with my pi.

Questions:

  • does a ping work?
  • have you changed the route?

@NiekN
Copy link
Author

NiekN commented Feb 14, 2018

its nice you are willing to help, thx

i can connect with my laptop on the sonoff that works, so i think a ping will work
i opened 2 screens with putty , connected to my PI
one to run the server and the other for the commands
i added the command "sudo route change 0.0.0.0 mask 0.0.0.0 10.10.7.1"
image

@NiekN
Copy link
Author

NiekN commented Feb 14, 2018

how do you setting it up with a laptop? where do you add these commands?

@NiekN
Copy link
Author

NiekN commented Feb 14, 2018

1.connecting the laptop to the sonoff (I succeed)
2. adding http://10.10.7.1/device in the url at chrome(I succeed)
3. wget -O- --post-data='{"version":4,"ssid":"yourSSID","password":"yourSSID_PASSWORD","serverName":"n.n.n.n","port":1080}' --header=Content-Type:application/json "http://10.10.7.1/ap" (do not know?)

@mdopp
Copy link
Owner

mdopp commented Feb 14, 2018

I am using the sonoff.devicesetup.js

But I just realized that it will not work in the current version.
var serverIP = "0.0.0.0"
Must be the ip of your raspberry

Other than that it should work.

@NiekN
Copy link
Author

NiekN commented Feb 15, 2018

I changed the var serverIP = "0.0.0.0" in ip of my PI at sonoff.devicesetup.js

  1. start up sonoff-server
  2. sudo route change 0.0.0.0 mask 0.0.0.0 10.10.7.1
  3. node sonoff.devicesetup.js (on PI).
    image
    d

@NiekN
Copy link
Author

NiekN commented Feb 15, 2018

but do i have to connect with the PI to the sonoff AP?
Im using the PI remote, so i cannot connect it also to the sonoff AP.

@pevecyan
Copy link

Afaik, you should run sonof server on PI and then with your laptop start setup device script with ip and port pointing towards your PI

@NiekN
Copy link
Author

NiekN commented Feb 15, 2018

So this means, for my understanding

  1. start sonoff server on PI
  2. set sonoff in AP mode
  3. connect laptop to sonoff
  4. run scriptsonoff.devicesetup.js on my laptop( so i have to copy this file to my laptop?)

@NiekN
Copy link
Author

NiekN commented Feb 15, 2018

how to run scriptsonoff.devicesetup.js ?

@pevecyan
Copy link

Yeah, that is correct procedure, you should copy the whole repository to a laptop.
You will also need node installed on that laptop, before running setup you have to run cmd "npm install" in repository folder, which installs all dependencies .
To run setup you have to run "node scriptsonoff.devicesetup.js".

@NiekN
Copy link
Author

NiekN commented Feb 16, 2018

OK, i will try to install it

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

@NiekN were you able to make it work?

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

still not

-i installed nodejs on win10 pc
-runned nodejs command promt
-node sonoff.setupdevice.js
-set device in AP mode

image

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

I never used the node.js box. But I think you still have to write "node sonoff.server.js" to run it. You screenshot shows that windows tries to run it native.

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

i did run node sonoff.server.js at PI

when in switch manually my laptop to connect to AP of sonoff i get
image

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

it look like it is connected successfully . but it did not drop directly out off AP mode, but after a time out i get an error like it shows in teh screenshot

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

I will check the code once again if i see something strange after the last commit.

About the "did not drop directly out of AP mode" => this seams to be an Windows thing (at least on my windows 10 mashine). It is just scanning when the list of wifi networks is open. Otherwise it will just scan every now and then.

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

OK, that could be a simple problem in the code => can you please try to change

var serverIP = "0.0.0.0"

to the ip-adress of your raspberry pi with an editor (notepad will do), and re-run the code? If that works, I will change the code to solve this for others to.

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

i had already changed it to ip of raspbarry
var serverIP = "my ip of raspberry "

in file :sonoff.setupdevice.js

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

do i have to install NetworkManager??

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

should not be nessesary on windows (at least 10)

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

just double checked everything, and i do not see any reasons why it should not work. As you can connect from windows everything should work fine. I will get a device tomorrow and try again. Only if you have a new device with a version > 1.5.5 it should not work.

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

ok.
but it pairs with sonoff . but it looks like the Sonoff it changing to the SSID/password of my network
and connecting to the sonoff server, which is running

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

version 1.5.5 ??? is that the hardware version

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

my sonoff basic is TH 1.0

@NiekN
Copy link
Author

NiekN commented Feb 17, 2018

mmh i did not use the ewelink app to this device, should i do that ? I do not know if it will send the ID and API anymore .
Double checked .

-Server still running on PI
-sonoff.setupdevice.js IP of raspberry was added correctly (at win10)
-sonoff.config,json my SSID, pasword, IP of raspberry port http1080,https1081 socket1443 was added correctly(at win10)
-installed nodejs(at win10)
-runned node sonoff.setupdevice.js(at win10)
-set sonoff in AP mode and connect with laptop

@mdopp
Copy link
Owner

mdopp commented Feb 17, 2018

Did you see anything on the log files of the pi? Otherwise it is not connecting there.
Also: this tool uses environment variables for the said, pwd, ... Not the config files

@NiekN
Copy link
Author

NiekN commented Feb 18, 2018

I wil check the logs, but i do not know where searching for

@NiekN
Copy link
Author

NiekN commented Feb 20, 2018

putty
sonoff config js

@NiekN
Copy link
Author

NiekN commented Feb 20, 2018

starting server at putty
then try to setup telnet with putty(first had to close SSH connection, without stopping server)
192.168.178,---:1080
192.168.178.---:1081

both give an an putty output
Network error: connection refused
image

@mdopp
Copy link
Owner

mdopp commented Feb 20, 2018

When you close putty, the console will be closed, hence the server is not running anymore.

@mdopp
Copy link
Owner

mdopp commented Feb 20, 2018

Also: your https and http port are mixed up between server and setup (pls see your comments above!) Make sure to use https=1081 also for the device setup

@NiekN
Copy link
Author

NiekN commented Feb 20, 2018

ports are mixed up?
only the config file has the ports numbers
at PC and Pi they are the same
standard https 1081, http 1080. (i copied the file)

@NiekN
Copy link
Author

NiekN commented Feb 20, 2018

i cannot open a SSH and a telnet at the same time, even if i open them both on a different PC. And yes i see now closing the putty console will stop server

@NiekN
Copy link
Author

NiekN commented Feb 20, 2018

ok installed mp2 , so it can run in the background. after closing putty console, and starting putty again.
I could checked if sonoff server is still running .. pm2 log sonoff.server
And it is still running .

But for some reason i cannot open a telnet connection with the server . it directly closses putty after opening

@mdopp
Copy link
Owner

mdopp commented Feb 21, 2018

You wrote that you changed the value in the JavaScript code. Also, I see from this little bit of log that you use an old version.

Your comments:

at sonoff.setupdevice.js
var httpsPort = 1080

so there is a mis match

so i stopped the server
edit at sonof.config,json

"httpPort": 1081,
"httpsPort": 1080,

still nothing is happons

@NiekN
Copy link
Author

NiekN commented Feb 21, 2018

Yes correct . Before you changed the devicesetup I had the mismatch. After that i use the latest devicesetup on my pc. And that uses the config file.
So pi and pc are using the same files now

@NiekN
Copy link
Author

NiekN commented Feb 21, 2018

I have no idea what is really wrong.
I hoped it was not so complicated. Before this I tried erasing it with a espeasy. I followed some video stream/forums. But somehow I did not succeed. Flashing was ok but no Wi-Fi started. Also a college did the same, no Wi-Fi. Maybe it's a problem when connecting it to ewelink before. So with a new device I hoped the simple-server will work.

@mdopp
Copy link
Owner

mdopp commented Feb 21, 2018

What's complicated is the fact that you are doing things without telling what you have done. This way it is nearly impossible for me, to find the root cause of your problem.

BTW: telnet is a tool, that opens just a basic TCP socket. So it is possible to open a telnet session to port 1081 and still keep the SSH session open. You can even open multiple SSH sessions at the same time.
If I find a little time during the next day's I will create a test script so you see your server is running and accessable. I guess I will add this to the device-setup, to use the same config and see that everything is working on the config and network side, and that the only variable is the sonoff device

@NiekN
Copy link
Author

NiekN commented Feb 21, 2018

OK, that will be very nice. Thanks

About the telnet, what would you advice how to setup at PC, different program or?
And do i have to install telnet on the PI ?

@mdopp
Copy link
Owner

mdopp commented Feb 21, 2018

For telnet: you do not need to install it on the pi. On the pc, you can simply start putty twice, or use the cmd-line tool(that you might have to install first, it's not part of every windows version)

@NiekN
Copy link
Author

NiekN commented Feb 21, 2018

OK.. but i test it with putty..
I can startup multiple putty sessions(SSH) thats no problem
But i cannot open a telnet session when the SSH session with putty is already opened.
I even tried to open the telnet session with putty at a different PC , when the SSH session was running on a other PC.

I will try to open a telnet session with windows application
image

@NiekN
Copy link
Author

NiekN commented Feb 21, 2018

startup sonoff-server at putty
at PC installled telnet
Microsoft Telnet> open 192.168.178.xxx [1080]

try to make connection to 192.168.178.xxx...Cannnot make a connection with host, at port {1081]: Making a connection has failed
Microsoft Telnet>

@mdopp
Copy link
Owner

mdopp commented Feb 21, 2018

OK, now we know its not the device setup, but something with the server / network

when you use netstat, you can see the open ports on the raspberry.

netstat -all |grep 108

this should show something like

tcp 0 0 0.0.0.0:1080 0.0.0.0:* LISTEN
tcp6 0 0 [::]:1081 [::]:* LISTEN

if not, the server is not running. If yes, there seams to be a problem with the network

@mdopp
Copy link
Owner

mdopp commented Feb 22, 2018

Ohh...i just realized that you really wrote [1080] and [1081] to open the connection.

it should not be [1080] but simply 1080. The [] are only there to show that it is an optional parameter.

So it must be something like this

Microsoft Telnet> open 192.168.178.xxx 1080

@NiekN
Copy link
Author

NiekN commented Feb 22, 2018

image

@mdopp
Copy link
Owner

mdopp commented Feb 25, 2018

I have now added to check if the server is reachable while setting up new devices. If you now use the latest version (server and client), you can see if the server is reachable, ans maybe even, why it is not reachable.

About your screenshot => it is strange that 1080 is not listed! there seams to be something wrong.

@NiekN
Copy link
Author

NiekN commented Feb 25, 2018

Hi mdopp
ok thx

i used the latest version now on my PI and PC(added my SSID, password and server IP on both devices)
run server on pi
run device on PC
set sonoff in AP mode
connect PC to sonoff

on PC it looks ok, paired and connected , like previous version (like 6days ago)

but on server it is different: (see in bold, is new )
pi@raspberrypi:~/simple-sonoff-server $ node sonoff.server.js
SONOFF Server Started On Port 1081
API Server Started On Port 1080
REQ | GET | /

@mdopp
Copy link
Owner

mdopp commented Feb 25, 2018

There should be additional logs on the pc.
But all in all we now know that the server is up and running. Also the port is not blocked in your network. Everything works as expected, but the devices are not connecting. Hence I would blame the sonoff devices you are using. Maybe the rom version as shown in the other open issue. Maybe if you work your way through that documentation, you can leave me a hint how to solve it.

Sorry, I am not able to help you.

@NiekN
Copy link
Author

NiekN commented Feb 25, 2018

OK.. where can i find this log?
in the directory where the device was started at PC?

@mdopp
Copy link
Owner

mdopp commented Feb 25, 2018

just the console-log

@mdopp
Copy link
Owner

mdopp commented Mar 8, 2018

@NiekN
any updates? otherwise i would like to close this issue.

@NiekN
Copy link
Author

NiekN commented Mar 8, 2018

hi mdopp

no updates . i try to used Tasmota
you my close it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@pevecyan @mdopp @NiekN and others