Skip to content

Commit 42de5fd

Browse files
authored
setup with wget
Add a description to setup with wget instead of sonoff.setupdevice.js This helps to make it run on an respberry pi without installing the network manager. (thanks to @andrewerrington for the description)
1 parent 4c0413a commit 42de5fd

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Simple SONOFF Server
2-
========================
3-
Current State => Not finished yet.
2+
Current State => Not finished yet, but works.
43

54
A lot of this code is based on the findings in this blog
65
http://blog.nanl.de/2017/05/sonota-flashing-itead-sonoff-devices-via-original-ota-mechanism/
@@ -14,11 +13,12 @@ Change the sonoff.config.json to fit your environment.
1413

1514
The "server" is the device, which should stay in contact with the SONOFF devices. In my case it was the Raspverry Pi, which also runs Openhab.
1615

17-
"httpsPort" can be any port.
18-
"websocketPort" can be any port.
16+
* "httpsPort" can be any port.
17+
* "websocketPort" can be any port.
18+
1919
But make sure, that your router is allowing communication between devices.
2020

21-
```javascript
21+
```json
2222
{
2323
"router": {
2424
"SSID": "#############",
@@ -34,13 +34,28 @@ But make sure, that your router is allowing communication between devices.
3434
```
3535

3636
# Setup a new device
37+
There are two ways of setting up the devices. Either with the sonoff.setupdevice.js script, or with wget (or anything else that can post an http request to a specific server).
38+
39+
### sonoff.setupdevice.js
3740
Start sonoff.setupdevice.js on a computer you like. It will connect to the SONOFF device, so you will lose internet connection. When the scripts runs, you must long-click the black button on the device, and it will be configured to use the "server" as its cloud. Which now runs in your own network.
3841

42+
To run this on a linux device, the network manager must be installed. On an raspberry pi I would suggest to do the setup process manually with wget.
43+
44+
### wget
45+
(thanks @andrewerrington)
46+
1. Put the SonOff/Wemos device in AP mode (press and hold button for 5s)
47+
1. Find the device and connect to it (SSID: ITEAD-10000xxxxx Password: 12345678)
48+
1. Add route if necessary `sudo route change 0.0.0.0 mask 0.0.0.0 10.10.7.1`
49+
1. (optional) use wget to read device info `wget -O- 10.10.7.1/device`
50+
1. use wget to send local WiFi settings to device `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"`
51+
52+
The device will automatically drop out of AP mode and tries to connect to WiFi and server.
53+
3954
# running the server
4055
Start sonoff.server.js
4156
This Server keeps the connection to the sonoff devices, and must run permanently.
4257

43-
> /devices => list off all devices that are currently known to the server.
44-
> /devices/:deviceId => shows the status of the device
45-
> /devices/:deviceId/on => turns the device "on"
46-
> /devices/:deviceId/off => turns the device "on"
58+
* /devices => list off all devices that are currently known to the server.
59+
* /devices/:deviceId => shows the status of the device
60+
* /devices/:deviceId/on => turns the device "on"
61+
* /devices/:deviceId/off => turns the device "on"

0 commit comments

Comments
 (0)