Skip to content

Commit d1979d3

Browse files
authored
Add files via upload
0 parents  commit d1979d3

File tree

8 files changed

+222
-0
lines changed

8 files changed

+222
-0
lines changed

README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ESPEGI
2+
Espegi is an alternative firmware for ESP8266 based devices like iTead Sonoff with web UI, OTA updates, and Blynk support.
3+
<br><br>
4+
<img src="https://static.tildacdn.com/tild3830-6364-4266-a638-356563636132/Blynk_logo_diamond.png" width="15%"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
5+
<img src="https://www.espressif.com/sites/all/themes/espressif/logo.svg" width="30%"/>
6+
7+
# Features
8+
Espegi is mainly focused on controlling a Sonoff, but with simple tweaks (in the config.h file) can be adapted to any ESP8266 based device.
9+
##### Web UI
10+
The first feature is the Web UI (insipred by the famous tasmota firmware). Is simple as possible, you just got the status of the relay, the temperature and humidity (if you have a sensor), a toggle button and the OTA upgrade button.<br>
11+
<img src="images/webUI.png" width="60%"/>
12+
13+
##### Blynk
14+
Obviously, since it has Blynk support you can controll it through the app (by default the relay pin is V0, but you can change it).
15+
16+
##### Scripting / Command line
17+
Another feature is the ease of control through scripting languages and/or command line:
18+
1. You can easily toggle the relay with ```<IP address>/togglecmd```
19+
2. You can get the current temperature by typing ```<IP address>/temperaturecmd```, in "text/plain" format<br> (ex. ```26.30°C, 42.10%```)
20+
21+
You can find examples in the "example scripts" folder.
22+
23+
# How to install
24+
Flashing is quite easy (if you need more information look up tasmota flashing on google):
25+
26+
1. Download the repo
27+
2. Edit the config.h file with your data (WiFi SSID, password, Blynk key, etc.); more information on this later.
28+
3. Open the Arduino IDE and install the required board/libraries
29+
30+
#### Install ESP8266 board software
31+
- Open Arduino IDE and select ```File``````Preferences``` (```Arduino``````Preferences``` on Mac) and add the following text for field Additional Boards Manager URLs: ```http://arduino.esp8266.com/stable/package_esp8266com_index.json``` and select OK.
32+
- ```Open Tools``````Boards..```. → ```Boards Manager...``` and scroll down and click on esp8266 by ESP8266 Community. Click the Install button to download and install the latest ESP8266 board software. Select Close.
33+
<br><br>
34+
4. Install the Blynk library (```Sketch``````#include library``````Manage libraries```), and if you need it, the DHT and Adafruit Unified Sensor library.
35+
5. Follow this flash settings, and upload the firmware (if you need to upload to a sonoff, before plugging it into the PC you have to put it in flash mode, by holding down the button while plugging it in). Surely the most important settings are: "Flash size", "Flash Mode" and "IwIP Variant". Set them right or the firmware might not work.<br><br>
36+
![alt text](images/upload_settings.png)
37+
6. Finished! Now look up on the router for the new IP address (Hostname: ESPEGI), type it in a browser, and you'll find the Web UI!
38+
39+
# Config file
40+
The configuration file (the only you have to change) is fairly easy:
41+
42+
If you want a DHT sensor, leave it like this, otherwise comment it out with ```//```<br>
43+
```#define DHT_SENSOR```
44+
45+
Blynk auth key:<br>
46+
```char auth[] = "";```
47+
48+
Thingspeak API key (only if you use a DHT sensor):<br>
49+
```String TS_API_KEY = "";```
50+
51+
Wi-Fi Details:<br>
52+
```
53+
char ssid[] = "";
54+
char wifiPassword[] = "";
55+
char HOSTNAME[] = "ESPEGI";
56+
57+
String ota_username = "admin";
58+
String ota_password = "admin";
59+
```
60+
61+
Finally you have the ESP8266 pins (RELAY_PIN, LED_PIN, etc...), and the Blynk's virtual pins (RELAY_VPIN, etc...)

example scripts/temperature.vbs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Dim o
2+
Set o = CreateObject("MSXML2.XMLHTTP")
3+
o.open "GET", "http://<IP Address>/temperaturecmd", False
4+
o.send
5+
x=msgbox(o.responseText ,0, "Indoor Temperature")

example scripts/toggle_relay.vbs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Dim o
2+
Set o = CreateObject("MSXML2.XMLHTTP")
3+
o.open "GET", "http://<IP Address>/togglecmd", False
4+
o.send

images/upload_settings.png

20.5 KB
Loading

images/webUI.png

8.49 KB
Loading

templates/index.html

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no' />
6+
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
7+
<meta http-equiv="Pragma" content="no-cache">
8+
<meta http-equiv="Expires" content="0">
9+
<style>
10+
body {
11+
text-align: center;
12+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
13+
}
14+
15+
div {
16+
padding: 5px;
17+
margin: auto;
18+
width: 30%;
19+
}
20+
21+
@media only screen and (max-width: 600px) {
22+
div {
23+
width: 100%;
24+
padding: 0;
25+
}
26+
}
27+
28+
table {
29+
margin: auto;
30+
padding: 1.5em 0 2.5em 0;
31+
width: 99.7%;
32+
}
33+
34+
button {
35+
border: 0;
36+
border-radius: 0.6rem;
37+
background-color: #1fb3ec;
38+
color: rgb(252, 252, 252);
39+
line-height: 2.4rem;
40+
font-size: 1.2rem;
41+
background-color: #008CBA;
42+
width: 100%;
43+
margin-bottom: 1em;
44+
}
45+
</style>
46+
<title>ESPEGI</title>
47+
48+
</head>
49+
50+
<body>
51+
<div>
52+
<h1 id='state' style='font-size: 3.5em;'>ON</h1>
53+
<table>
54+
<tr>
55+
<td style='text-align: left'><b>Temperature</b></td>
56+
<td style='text-align: right'>20.5&#xB0;C</td>
57+
</tr>
58+
<tr>
59+
<td style='text-align: left;'><b>Humidity</b></td>
60+
<td style='text-align: right'>45%</td>
61+
</tr>
62+
</table>
63+
<form action='/toggle' method='get'><button>Toggle</button></form>
64+
<form action='/update' method='get'><button>Firmware Update</button></form>
65+
66+
<p style='position: absolute; bottom: 1.5em; width: inherit;'>Hostname: ESPEGI</p>
67+
<p style='position: absolute; bottom: 0; width: inherit;'>
68+
<a style='color: black;' href='/forcereload'>force reload</a>&emsp;|&emsp;
69+
<a style='color: black;' href='/restart'>restart</a>
70+
</p>
71+
</div>
72+
</body>
73+
74+
</html>

templates/update.html

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<style>
6+
body {
7+
text-align: center;
8+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
9+
}
10+
11+
div {
12+
padding: 5px;
13+
margin: auto;
14+
width: 30%;
15+
}
16+
17+
@media only screen and (max-width: 600px) {
18+
div {
19+
width: 100%;
20+
padding: 0;
21+
}
22+
}
23+
24+
#b {
25+
border: 0;
26+
border-radius: 0.6rem;
27+
background-color: #1fb3ec;
28+
color: rgb(252, 252, 252);
29+
line-height: 2.4rem;
30+
font-size: 1.2rem;
31+
background-color: #008CBA;
32+
width: 100%;
33+
}
34+
</style>
35+
<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no' />
36+
<title>ESPEGI</title>
37+
</head>
38+
39+
<body>
40+
<div>
41+
<h1 style='font-size: 3.5em;'>Update</h1>
42+
<form method='POST' action='/startupdate' enctype='multipart/form-data' style='padding-top: 2em;'> <input
43+
type='file' name='update'><br /><br /> <input type='submit' value='Update' id='b'> </form>
44+
<p style='position: absolute; bottom: 0; width: inherit;'>Hostname: ESPEGI</p>
45+
</div>
46+
</body>
47+
48+
</html>

webpage.h

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/***************************************************
2+
Espegi - Sonoff (esp8266 based) control with Blynk and web interface
3+
Created by: regi18
4+
Version: Version: 3.5.0
5+
Github:
6+
7+
regi18.ml | regi18.github.io
8+
**************************************************/
9+
10+
const char* INDEX_START = "<!DOCTYPE html><html><head> <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'/> <meta http-equiv='Cache-Control' content='no-cache, no-store, must-revalidate'> <meta http-equiv='Pragma' content='no-cache'> <meta http-equiv='Expires' content='0'> <style>body{text-align: center; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;}div{padding: 5px; margin: auto; width: 30%;}@media only screen and (max-width: 600px){div{width: 100%; padding: 0;}}table{margin: auto; padding: 1.5em 0 2.5em 0; width: 99.7%;}button{border: 0; border-radius: 0.6rem; background-color: #1fb3ec; color: rgb(252, 252, 252); line-height: 2.4rem; font-size: 1.2rem; background-color: #008CBA; width: 100%; margin-bottom: 1em;}</style> <title>ESPEGI</title></head><body> <div> <h1 id='state' style='font-size: 3.5em;'>";
11+
// state
12+
const char* INDEX_PART1 = "</h1>";
13+
#ifdef DHT_SENSOR
14+
const char* INDEX_DHT_1 = " <table> <tr> <td style='text-align: left'><b>Temperature</b></td><td style='text-align: right'>";
15+
//temp
16+
const char* INDEX_DHT_2 = "&#xB0;C</td></tr><tr> <td style='text-align: left;'><b>Humidity</b></td><td style='text-align: right'>";
17+
//hum
18+
const char* INDEX_DHT_END = "%</td></tr></table> ";
19+
#endif
20+
const char* INDEX_PART2 = "<form action='/toggle' method='get'><button>Toggle</button></form> <form action='/update' method='get'><button>Firmware Update</button></form> <p style='position: absolute; bottom: 1.5em; width: inherit;'>Hostname: ";
21+
//hostname
22+
const char* INDEX_END = "</p><p style='position: absolute; bottom: 0; width: inherit;'> <a style='color: black;' href='/forcereload'>force reload</a>&emsp;|&emsp; <a style='color: black;' href='/restart'>restart</a> </p></div></body></html>";
23+
24+
25+
#define UPDATE_PAGE_PART1 "<!DOCTYPE html><html><head> <style>body{text-align: center; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;}div{padding: 5px; margin: auto; width: 30%;}@media only screen and (max-width: 600px){div{width: 100%; padding: 0;}}#b{border: 0; border-radius: 0.6rem; background-color: #1fb3ec; color: rgb(252, 252, 252); line-height: 2.4rem; font-size: 1.2rem; background-color: #008CBA; width: 100%;}</style> <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'/> <title>ESPEGI</title></head><body> <div> <h1 style='font-size: 3.5em;'>Update</h1> <form method='POST' action='/startupdate' enctype='multipart/form-data' style='padding-top: 2em;'> <input type='file' name='update'><br/><br/> <input type='submit' value='Update' id='b'> </form> <p style='position: absolute; bottom: 0; width: inherit;'>Hostname: "
26+
// hosname
27+
#define UPDATE_PAGE_PART2 "</p></div></body></html>"
28+
29+
#define UPDATE_MESSAGE "<p style='font-size: 2.5em; text-align: center; font-family: \"Segoe UI\", Tahoma, Geneva, Verdana, sans-serif;'>"
30+
#define END_UPDATE_MESSAGE "</p><br><br><br><br><p style='text-align: center; font-family: \"Segoe UI\", Tahoma, Geneva, Verdana, sans-serif;'><a href='/'>Homepage</a></p>"

0 commit comments

Comments
 (0)