This commit is contained in:
lorol
2020-03-12 13:04:59 -04:00
parent add0f30773
commit b541718588
5 changed files with 27 additions and 16 deletions

View File

@@ -2,12 +2,13 @@
## SmartSwitch
* Remote Temperature Control application with schedule (example car block heater or battery charger)
* Based on the ESP_AsyncFSBrowser example
* Based on ESP_AsyncFSBrowser example
* Wide browser compatibility, no extra server-side needed.
* HTTP server and WebSocket, single port
* Standalone, no JS dependencies for the browser from Internet (I hope), ace editor included
* Added ESPAsyncWiFiManager
* Real Time (NTP) w/ Time Zones
* Memorized settings to EEPROM
* Multiple clients can be connected at same time, they see each other requests
* Use latest ESP8266 core lib (from github)
* Multiple clients can be connected at same time, they see each other' requests
* Default credentials <b>smart:switch</b>
* Use latest ESP8266 core lib (from Github)

View File

@@ -14,6 +14,9 @@ Use latest ESP core lib (from github)
*/
#define USE_WFM // to use ESPAsyncWiFiManager
//#define DEL_WFM // delete Wifi credentials stored
//(use once then comment and flash again), also HTTP /erase-wifi can do the same live
#define USE_AUTH // .setAuthentication for all static
#include <ArduinoOTA.h>
@@ -44,7 +47,7 @@ Use latest ESP core lib (from github)
#define EECH 104 // fixed eeprom address to keep selected active channel, only for reference here
#define EEBEGIN EECH + 1
#define EEMARK 0x5A
#define MEMMAX 1 // 0,1,2... last max index (only 2 channels)
#define MEMMAX 2 // 0,1,2... last max index (only 3 channels)
#define EEALL 512
#define HYST 0.5 // C +/- hysteresis
@@ -140,8 +143,9 @@ void showTime()
Serial.printf("RTC: %02d:%02d\n", tm->tm_hour, tm->tm_min);
if (sched == 0) { // automatic
if ((tm->tm_wday > 0)&&(tm->tm_wday < 6)) tmpch = 0; //weekdays
else tmpch = 0; //weekend
if ((tm->tm_wday > 0)&&(tm->tm_wday < 6)) tmpch = 0; //Mon - Fri
else if (tm->tm_wday == 6) tmpch = 1; //Sat
else if (tm->tm_wday == 0) tmpch = 2; //Sun
} else { // manual
tmpch = sched - 1; //and stays
}
@@ -372,8 +376,10 @@ void setup(){
//Wifi
#ifdef USE_WFM
AsyncWiFiManager wifiManager(&server,&dns);
//wifiManager.resetSettings();
wifiManager.autoConnect("SmartSW");
#ifdef DEL_WFM
wifiManager.resetSettings();
#endif
wifiManager.autoConnect(hostName);
#else
//WiFi.mode(WIFI_AP_STA); // Core SVN 5179 use STA as default interface in mDNS (#7042)
//WiFi.softAP(hostName); // Core SVN 5179 use STA as default interface in mDNS (#7042)

View File

@@ -251,12 +251,14 @@
<tr align="center">
<td colspan=3>
<form name="sched">
<label class="container">Auto&nbsp;&nbsp;
<label class="container">Auto&nbsp;
<input type="radio" name="radio" onclick="handleClick(this);" value="Z0"><span class="checkmark"></span></label>
<label class="container">Mon-Fri&nbsp;&nbsp;
<label class="container">M-F&nbsp;
<input type="radio" name="radio" onclick="handleClick(this);" value="Z1"><span class="checkmark"></span></label>
<label class="container">Sat-Sun
<label class="container">Sat
<input type="radio" name="radio" onclick="handleClick(this);" value="Z2"><span class="checkmark"></span></label>
<label class="container">Sun
<input type="radio" name="radio" onclick="handleClick(this);" value="Z3"><span class="checkmark"></span></label>
</form>
</td>
</tr>
@@ -327,7 +329,7 @@
<script src="app.min.js"></script>
<script type="text/javascript">
const MYCORS = '192.168.0.55';
const MYCORS = '192.168.0.12';
var g1, g2;
var Analog0 = new Array();

View File

@@ -251,12 +251,14 @@
<tr align="center">
<td colspan=3>
<form name="sched">
<label class="container">Auto&nbsp;&nbsp;
<label class="container">Auto&nbsp;
<input type="radio" name="radio" onclick="handleClick(this);" value="Z0"><span class="checkmark"></span></label>
<label class="container">Mon-Fri&nbsp;&nbsp;
<label class="container">M-F&nbsp;
<input type="radio" name="radio" onclick="handleClick(this);" value="Z1"><span class="checkmark"></span></label>
<label class="container">Sat-Sun
<label class="container">Sat
<input type="radio" name="radio" onclick="handleClick(this);" value="Z2"><span class="checkmark"></span></label>
<label class="container">Sun
<input type="radio" name="radio" onclick="handleClick(this);" value="Z3"><span class="checkmark"></span></label>
</form>
</td>
</tr>
@@ -327,7 +329,7 @@
<script src="app.min.js"></script>
<script type="text/javascript">
const MYCORS = '192.168.0.55';
const MYCORS = '192.168.0.12';
var g1, g2;
var Analog0 = new Array();