mdopp / simple-sonoff-server

Emulates the original sonoff-cloud-servers within your local network.
BSD 2-Clause "Simplified" License
144 stars 47 forks source link

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

Closed NiekN closed 6 years ago

NiekN commented 6 years ago

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

  1. 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 commented 6 years ago

i will send the config file and the log today. by log you mean, the consol output of putty when starting the server correct?

mdopp commented 6 years ago

not only "when starting the server" but the whole time after the device was set up. But yes, thats what I would like to see.

NiekN commented 6 years ago

putty sonoff config js

NiekN commented 6 years ago

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 commented 6 years ago

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

mdopp commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

image

mdopp commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

mdopp commented 6 years ago

just the console-log

mdopp commented 6 years ago

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

NiekN commented 6 years ago

hi mdopp

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