Closed NiekN closed 6 years ago
how can i connect with my pi on the access point that will appear (SSID:ITEAD-10000xxxxx Password:12345678)??
For me, I use my notebook for setting up the sonoff devices. Wasn't able to make it happen with my pi.
Questions:
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"
how do you setting it up with a laptop? where do you add these commands?
1.connecting the laptop to the sonoff (I succeed)
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.
I changed the var serverIP = "0.0.0.0" in ip of my PI at sonoff.devicesetup.js
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.
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
So this means, for my understanding
how to run scriptsonoff.devicesetup.js ?
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".
OK, i will try to install it
@NiekN were you able to make it work?
still not
-i installed nodejs on win10 pc -runned nodejs command promt -node sonoff.setupdevice.js -set device in AP mode
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.
i did run node sonoff.server.js at PI
when in switch manually my laptop to connect to AP of sonoff i get
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
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.
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.
i had already changed it to ip of raspbarry var serverIP = "my ip of raspberry "
in file :sonoff.setupdevice.js
do i have to install NetworkManager??
should not be nessesary on windows (at least 10)
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.
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
version 1.5.5 ??? is that the hardware version
my sonoff basic is TH 1.0
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
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
I wil check the logs, but i do not know where searching for
Environment variables of the sonoff device, where do I have to set them ?
try again, now with the lates simple-sonoff-server 1.1.2 and a different PC (win7) same results
on your windows PC, pls set
set WIFI_SSID={yourSSID}
set WIFI_PASSWORD={yourPassword}
set HTTPS_PORT=1080
About the log on the raspberry: I mean the consol output of the server. Does it show anything about a connecting device?
Since the last merge, the sonoff.setupdevice.js was not reading the sonoff.config.json anymore, but looking for environment variables instead. This make the change of the serverIP in the code obsolete again as it will read if from the config. I just changed it again to look first for sonoff.config.json, then overwrite parameters with environment variables for docker. And if they are still unset, it is shown in the console output to identify this as an problem.
Maybe you can use this version for tracing your error?
i edit sonoff.setupdevice.js on my laptop
var wifiSSID = "mySSID" var wifiPassword = "my password" var httpsPort = 1080
start the server run sonoff.setupdevice.js set sonoff in AP mode
the sonoff drops out of AP mode
at my router i cannot see it that it is connected when i used the FING app, i see it has a IP adress in my range the led is still blinking (not like AP mode, but 2x fast blinks
i see nothing happening on the sonoff- server
Ok. But that it how it should look like on this script.
Few things I can imagine: wrong password, wrong ssid or, what happens to me most of the time: router is set to not allow new connections for security reasons. This would be a thing that you have to check on your router.
And are you sure that it's port 1080 for https?
i also cannot control it by using http://127.0.0.1:1080/devices/deviceID/on
i also cannot do this procedure again i think. it does not send a AP when it is in AP-mode is there a way to log in this device . or is it now useless???
i also made a dummy switch with http://127.0.0.1:1080/devices/deviceID/on http://127.0.0.1:1080/devices/deviceID/off
the sonof server comes with a message GET | GET | /devices/100031xxxx/on
at sonof.config,json
"httpPort": 1080,
"httpsPort": 1081,
"websocketPort": 1443
}
}
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
but should the sonoff not stopping with blinking?
ok i can access the AP-mode again and tested the new file "sonoff.setupdevice.js"
the same results, also connected like the last image. it drops directly outoff AP-mode but still blinking 2x fast ?
double check SSID and password. they are OK router blocking the new connection, i hsvr s dimple modem/router from ziggo supplier. I cannot file anything what should block it
You can repeat this procedure as often as you want. It should not be possible to brick the device this way.
The port is just the 2nd part. First the sonoff device must be shown on your router. But it will only frequently. Just every few seconds for a few seconds. For me it seams that the times between connecting retries are getting longer over time.
Can you open a telnet session to the pi from your windows PC?
Telnet 192.???.???.??? 1081
But being honest: I am getting lost here... It's very difficult to debug with this little input (not knowing all your configuration)
I appreciate your help, but im not familaire with this, sorry
When i check my router i cannot see that it at connect devices . But my FING app , shows it is present. And it is a IP in my range. So the router did give a IP adress to the sonoff. I also can change te last number op the IP adress of the sonoff in my router, so it's now fixed in my router at :192.168.178.240
So actually i think it is connected to my router . but you wrote :requently. Just every few seconds for a few seconds. so it is not always active ?
About the blinking of the LED , it this normall ? i have also a device connected to ewelink , and there the LED is only on when the relay of this device is on
i can open a telnet session with putty , but telnet has a fix port :23 i think
The blinking lights shows that it is searching the server. Telnet works with every port, just like putty. You just have to specify it. This way you can check if the server is listening on the expected port, and make sure there is no network rule blocking the connection.
OK , clear but if now the sonoff has a IP, could i not just easily controll in with a url in chrome to test it? somethning like so: 192.168.178.240/on( without server)
Sadly with stock firmware on it you could not. It uses websockets for communication with server and not plain http requests.
Correct.
OK .. clear. firmware 1.6 .. is it possible to check which version is on the sonoff
this one is an old type TH1.0 . So point 3 and/or 4 is not working at my side
If it would be the firmware, it still should show something on the server side. Can you please!! send some config and logs from there? I can not continue like this
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