mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
web improvements
This commit is contained in:
@@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Merged with @susisstrolch's TxMode2 branch for improved support for sending EMS packages, and removed tx_mode command
|
||||
- Renamed heartbeat to mqtt_heartbeat
|
||||
- Renamed MQTT topic "wwactivated" to "boiler_cmd_wwactivated"
|
||||
|
||||
## [1.9.0b1_web] 2019-08-02
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ MyESP::MyESP() {
|
||||
_general_hostname = strdup("myesp");
|
||||
_app_name = strdup("MyESP");
|
||||
_app_version = strdup(MYESP_VERSION);
|
||||
_app_helpurl = nullptr;
|
||||
_app_url = nullptr;
|
||||
_app_updateurl = nullptr;
|
||||
|
||||
// general
|
||||
@@ -351,7 +351,6 @@ void MyESP::_mqttOnMessage(char * topic, char * payload, size_t len) {
|
||||
}
|
||||
|
||||
// MQTT subscribe
|
||||
// to MQTT_BASE/app_hostname/topic
|
||||
void MyESP::mqttSubscribe(const char * topic) {
|
||||
if (mqttClient.connected() && (strlen(topic) > 0)) {
|
||||
unsigned int packetId = mqttClient.subscribe(_mqttTopic(topic), _mqtt_qos);
|
||||
@@ -360,7 +359,6 @@ void MyESP::mqttSubscribe(const char * topic) {
|
||||
}
|
||||
|
||||
// MQTT unsubscribe
|
||||
// to MQTT_BASE with app_hostname/topic
|
||||
void MyESP::mqttUnsubscribe(const char * topic) {
|
||||
if (mqttClient.connected() && (strlen(topic) > 0)) {
|
||||
unsigned int packetId = mqttClient.unsubscribe(_mqttTopic(topic));
|
||||
@@ -1224,7 +1222,15 @@ void MyESP::showSystemStats() {
|
||||
uint32_t rem = t % 3600L;
|
||||
uint8_t m = rem / 60;
|
||||
uint8_t s = rem % 60;
|
||||
myDebug_P(PSTR(" [APP] Uptime: %d days %d hours %d minutes %d seconds"), d, h, m, s);
|
||||
myDebug_P(PSTR(" [APP] Uptime: %d day%s %d hour%s %d minute%s %d second%s"),
|
||||
d,
|
||||
(d == 1) ? "" : "s",
|
||||
h,
|
||||
(h == 1) ? "" : "s",
|
||||
m,
|
||||
(m == 1) ? "" : "s",
|
||||
s,
|
||||
(s == 1) ? "" : "s");
|
||||
|
||||
myDebug_P(PSTR(" [APP] System Load: %d%%"), getSystemLoadAverage());
|
||||
|
||||
@@ -2311,7 +2317,7 @@ void MyESP::_sendCustomStatus() {
|
||||
root["command"] = "custom_status";
|
||||
root["version"] = _app_version;
|
||||
root["customname"] = _app_name;
|
||||
root["helpurl"] = _app_helpurl;
|
||||
root["appurl"] = _app_url;
|
||||
root["updateurl"] = _app_updateurl;
|
||||
|
||||
// add specific custom stuff
|
||||
@@ -2368,7 +2374,7 @@ void MyESP::_sendStatus() {
|
||||
uint32_t rem = t % 3600L;
|
||||
uint8_t m = rem / 60;
|
||||
uint8_t sec = rem % 60;
|
||||
sprintf(uptime, "%d days %d hours %d minutes %d seconds", d, h, m, sec);
|
||||
sprintf(uptime, "%d day%s %d hour%s %d minute%s %d second%s", d, (d == 1) ? "" : "s", h, (h == 1) ? "" : "s", m, (m == 1) ? "" : "s", sec, (sec == 1) ? "" : "s");
|
||||
root["uptime"] = uptime;
|
||||
|
||||
char buffer[400];
|
||||
@@ -2579,11 +2585,11 @@ void MyESP::_bootupSequence() {
|
||||
}
|
||||
|
||||
// setup MyESP
|
||||
void MyESP::begin(const char * app_hostname, const char * app_name, const char * app_version, const char * app_helpurl, const char * app_updateurl) {
|
||||
void MyESP::begin(const char * app_hostname, const char * app_name, const char * app_version, const char * app_url, const char * app_updateurl) {
|
||||
_general_hostname = strdup(app_hostname);
|
||||
_app_name = strdup(app_name);
|
||||
_app_version = strdup(app_version);
|
||||
_app_helpurl = strdup(app_helpurl);
|
||||
_app_url = strdup(app_url);
|
||||
_app_updateurl = strdup(app_updateurl);
|
||||
|
||||
_telnet_setup(); // Telnet setup, called first to set Serial
|
||||
|
||||
@@ -285,7 +285,7 @@ class MyESP {
|
||||
// general
|
||||
void end();
|
||||
void loop();
|
||||
void begin(const char * app_hostname, const char * app_name, const char * app_version, const char * app_helpurl, const char * app_updateurl);
|
||||
void begin(const char * app_hostname, const char * app_name, const char * app_version, const char * app_url, const char * app_updateurl);
|
||||
void resetESP();
|
||||
int getWifiQuality();
|
||||
void showSystemStats();
|
||||
@@ -373,7 +373,7 @@ class MyESP {
|
||||
char * _general_hostname;
|
||||
char * _app_name;
|
||||
char * _app_version;
|
||||
char * _app_helpurl;
|
||||
char * _app_url;
|
||||
char * _app_updateurl;
|
||||
bool _suspendOutput;
|
||||
bool _general_serial;
|
||||
|
||||
@@ -163,7 +163,9 @@
|
||||
<caption>EMS Bus stats</caption>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<b><div id="msg" role="alert"></div></b>
|
||||
<b>
|
||||
<div id="msg" role="alert"></div>
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -189,11 +191,18 @@
|
||||
<th>Central Heating:</th>
|
||||
<td id="b2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Selected Flow Temperature:</th>
|
||||
<td id="b3"></td>
|
||||
<th>Boiler Temperature:</th>
|
||||
<th>Current Flow Temperature:</th>
|
||||
<td id="b4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Boiler Temperature:</th>
|
||||
<td id="b5"></td>
|
||||
<th>Return Temperature:</th>
|
||||
<td id="b6"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -112,6 +112,8 @@ function listCustomStats() {
|
||||
document.getElementById("b2").innerHTML = ajaxobj.boiler.b2;
|
||||
document.getElementById("b3").innerHTML = ajaxobj.boiler.b3 + " ℃";
|
||||
document.getElementById("b4").innerHTML = ajaxobj.boiler.b4 + " ℃";
|
||||
document.getElementById("b5").innerHTML = ajaxobj.boiler.b5 + " ℃";
|
||||
document.getElementById("b6").innerHTML = ajaxobj.boiler.b6 + " ℃";
|
||||
} else {
|
||||
document.getElementById("boiler_show").style.display = "none";
|
||||
}
|
||||
|
||||
@@ -1522,18 +1522,20 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
if (type == MQTT_CONNECT_EVENT) {
|
||||
myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_TEMP);
|
||||
myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_MODE);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_WWACTIVATED);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWTEMP);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_COMFORT);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_FLOWTEMP);
|
||||
myESP.mqttSubscribe(TOPIC_SHOWER_TIMER);
|
||||
myESP.mqttSubscribe(TOPIC_SHOWER_ALERT);
|
||||
myESP.mqttSubscribe(TOPIC_SHOWER_COLDSHOT);
|
||||
myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_HC);
|
||||
myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_DAYTEMP);
|
||||
myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_NIGHTTEMP);
|
||||
myESP.mqttSubscribe(TOPIC_THERMOSTAT_CMD_HOLIDAYTEMP);
|
||||
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWACTIVATED);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWTEMP);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_COMFORT);
|
||||
myESP.mqttSubscribe(TOPIC_BOILER_CMD_FLOWTEMP);
|
||||
|
||||
myESP.mqttSubscribe(TOPIC_SHOWER_TIMER);
|
||||
myESP.mqttSubscribe(TOPIC_SHOWER_ALERT);
|
||||
myESP.mqttSubscribe(TOPIC_SHOWER_COLDSHOT);
|
||||
|
||||
// publish the status of the Shower parameters
|
||||
myESP.mqttPublish(TOPIC_SHOWER_TIMER, EMSESP_Status.shower_timer ? "1" : "0");
|
||||
myESP.mqttPublish(TOPIC_SHOWER_ALERT, EMSESP_Status.shower_alert ? "1" : "0");
|
||||
@@ -1597,7 +1599,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
|
||||
}
|
||||
|
||||
// wwActivated
|
||||
if (strcmp(topic, TOPIC_BOILER_WWACTIVATED) == 0) {
|
||||
if (strcmp(topic, TOPIC_BOILER_CMD_WWACTIVATED) == 0) {
|
||||
if ((message[0] == '1' || strcmp(message, "on") == 0) || (strcmp(message, "auto") == 0)) {
|
||||
ems_setWarmWaterActivated(true);
|
||||
} else if (message[0] == '0' || strcmp(message, "off") == 0) {
|
||||
@@ -1678,13 +1680,13 @@ void WebCallback(JsonObject root) {
|
||||
if (ems_getBusConnected()) {
|
||||
if (ems_getTxDisabled()) {
|
||||
emsbus["ok"] = false;
|
||||
emsbus["msg"] = "EMS Bus Connected, Rx active but Tx has been disabled (listen mode)";
|
||||
emsbus["msg"] = "EMS Bus Connected with Rx active but Tx has been disabled (in listen only mode).";
|
||||
} else if (ems_getTxCapable()) {
|
||||
emsbus["ok"] = true;
|
||||
emsbus["msg"] = "EMS Bus Connected, Rx and Tx active";
|
||||
emsbus["msg"] = "EMS Bus Connected with both Rx and Tx active.";
|
||||
} else {
|
||||
emsbus["ok"] = false;
|
||||
emsbus["msg"] = "EMS Bus Connected, Tx is not working";
|
||||
emsbus["msg"] = "EMS Bus Connected but Tx is not working.";
|
||||
}
|
||||
} else {
|
||||
emsbus["ok"] = false;
|
||||
@@ -1760,8 +1762,14 @@ void WebCallback(JsonObject root) {
|
||||
if (EMS_Boiler.selFlowTemp != EMS_VALUE_INT_NOTSET)
|
||||
boiler["b3"] = EMS_Boiler.selFlowTemp;
|
||||
|
||||
if (EMS_Boiler.curFlowTemp != EMS_VALUE_INT_NOTSET)
|
||||
boiler["b4"] = EMS_Boiler.curFlowTemp / 10;
|
||||
|
||||
if (EMS_Boiler.boilTemp != EMS_VALUE_USHORT_NOTSET)
|
||||
boiler["b4"] = (double)EMS_Boiler.boilTemp / 10;
|
||||
boiler["b5"] = (double)EMS_Boiler.boilTemp / 10;
|
||||
|
||||
if (EMS_Boiler.retTemp != EMS_VALUE_USHORT_NOTSET)
|
||||
boiler["b6"] = (double)EMS_Boiler.retTemp / 10;
|
||||
|
||||
} else {
|
||||
boiler["ok"] = false;
|
||||
@@ -1888,7 +1896,7 @@ void setup() {
|
||||
myESP.setSettings(LoadSaveCallback, SetListCallback, false); // default is Serial off
|
||||
myESP.setWeb(WebCallback); // web custom settings
|
||||
myESP.setOTA(OTACallback_pre, OTACallback_post); // OTA callback which is called when OTA is starting and stopping
|
||||
myESP.begin(APP_HOSTNAME, APP_NAME, APP_VERSION, APP_HELPURL, APP_UPDATEURL);
|
||||
myESP.begin(APP_HOSTNAME, APP_NAME, APP_VERSION, APP_URL, APP_UPDATEURL);
|
||||
|
||||
// at this point we have all the settings from our internall SPIFFS config file
|
||||
// fire up the UART now
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#define TOPIC_THERMOSTAT_CMD_TEMP "thermostat_cmd_temp" // for received thermostat temp changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_MODE "thermostat_cmd_mode" // for received thermostat mode changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_HC "thermostat_cmd_hc" // for received thermostat hc number changes via MQTT
|
||||
#define TOPIC_THERMOSTAT_CMD_DAYTEMP "thermostat_daytemp" // RC35 specific
|
||||
#define TOPIC_THERMOSTAT_CMD_NIGHTTEMP "thermostat_nighttemp" // RC35 specific
|
||||
#define TOPIC_THERMOSTAT_CMD_HOLIDAYTEMP "thermostat_holidayttemp" // RC35 specific
|
||||
#define TOPIC_THERMOSTAT_CMD_DAYTEMP "thermostat_daytemp" // for received thermostat day temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD_NIGHTTEMP "thermostat_nighttemp" // for received thermostat night temp (RC35 specific)
|
||||
#define TOPIC_THERMOSTAT_CMD_HOLIDAYTEMP "thermostat_holidayttemp" // for received thermostat holiday temp (RC35 specific)
|
||||
#define THERMOSTAT_CURRTEMP "thermostat_currtemp" // current temperature
|
||||
#define THERMOSTAT_SELTEMP "thermostat_seltemp" // selected temperature
|
||||
#define THERMOSTAT_HC "thermostat_hc" // which heating circuit number
|
||||
@@ -32,7 +32,7 @@
|
||||
#define TOPIC_BOILER_DATA "boiler_data" // for sending boiler values to MQTT
|
||||
#define TOPIC_BOILER_TAPWATER_ACTIVE "tapwater_active" // if hot tap water is running
|
||||
#define TOPIC_BOILER_HEATING_ACTIVE "heating_active" // if heating is on
|
||||
#define TOPIC_BOILER_WWACTIVATED "wwactivated" // for receiving MQTT message to change water on/off
|
||||
#define TOPIC_BOILER_CMD_WWACTIVATED "boiler_cmd_wwactivated" // for received message to change water on/off
|
||||
#define TOPIC_BOILER_CMD_WWTEMP "boiler_cmd_wwtemp" // for received boiler wwtemp changes via MQTT
|
||||
#define TOPIC_BOILER_CMD_COMFORT "boiler_cmd_comfort" // for received boiler ww comfort setting via MQTT
|
||||
#define TOPIC_BOILER_CMD_FLOWTEMP "boiler_cmd_flowtemp" // for received boiler flowtemp value via MQTT
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
#define APP_NAME "EMS-ESP"
|
||||
#define APP_VERSION "1.9.0b2_web"
|
||||
#define APP_HOSTNAME "ems-esp"
|
||||
#define APP_HELPURL "https://github.com/proddy/EMS-ESP/wiki"
|
||||
#define APP_URL "https://github.com/proddy/EMS-ESP"
|
||||
#define APP_UPDATEURL "https://api.github.com/repos/proddy/EMS-ESP/releases/latest"
|
||||
|
||||
@@ -72,12 +72,28 @@
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs">
|
||||
<li>
|
||||
<a id="helpurl" href="https://github.com/proddy" class="download">Help</a>
|
||||
<a id="helpurl" target="_blank" class="download">Help</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="article" onclick="logout();">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div style="position:fixed; top:0; bottom:40px; overflow-y:scroll; float:none;">
|
||||
<hr>
|
||||
</hr>
|
||||
<footer style="position:fixed; bottom: 0; height:40px;"><a id="appurl"
|
||||
href="https://github.com/proddy" target="_blank">
|
||||
<h6 id="appurl2"></h6>
|
||||
</a></footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
<!-- Page Content Holder -->
|
||||
@@ -142,7 +158,7 @@
|
||||
<div class="alert alert-warning">
|
||||
<h5><b>Warning!</b> This action <strong>cannot</strong> be undone. This will permanently
|
||||
delete <strong>all
|
||||
the settings and logs.</strong> Please make sure you've made a backup first.</h5>
|
||||
the settings and logs.</strong> Please make sure you've made a backup before resetting!</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5>Please type in the hostname of the device to confirm.</h5>
|
||||
@@ -222,7 +238,7 @@
|
||||
<h4 class="modal-title">Update Firmware</h4>
|
||||
</div>
|
||||
<div class="alert alert-warning">
|
||||
<strong>Warning!</strong> Please make sure you've made a backup first
|
||||
<strong>Warning!</strong> Please make sure you've made a backup first before updating
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div>
|
||||
@@ -267,9 +283,7 @@
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div id="commit" class="container">
|
||||
<h6 class="text-muted">(running on <a href="https://github.com/proddy/MyESP">MyESP</a>)</h6>
|
||||
</div>
|
||||
<div id="commit" class="container"></div>
|
||||
</footer>
|
||||
<div class="overlay"></div>
|
||||
<script src="js/required.js"></script>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<legend>Backup</legend>
|
||||
<h6 class="text-muted">Please make sure that you have made a backup on regular basis.</h6>
|
||||
<h6 class="text-muted">Please make sure that you make regular backups.</h6>
|
||||
<div>
|
||||
<button class="btn btn-link btn-sm" onclick="backupset();">Backup System Settings</button>
|
||||
<a id="downloadSet" style="display:none"></a>
|
||||
|
||||
@@ -419,8 +419,20 @@ function getContent(contentname) {
|
||||
$("#customname").text(ajaxobj.customname);
|
||||
var customname2 = " " + ajaxobj.customname;
|
||||
$("#customname2").text(customname2);
|
||||
|
||||
if (config.network.wmode === 0) {
|
||||
var elem = document.getElementById("helpurl");
|
||||
elem.setAttribute("href", ajaxobj.helpurl);
|
||||
var helpurl = ajaxobj.appurl + "/wiki"
|
||||
elem.setAttribute("href", helpurl);
|
||||
document.getElementById("helpurl").style.display = "block";
|
||||
} else {
|
||||
document.getElementById("helpurl").style.display = "none";
|
||||
}
|
||||
|
||||
var elem = document.getElementById("appurl");
|
||||
elem.setAttribute("href", ajaxobj.appurl);
|
||||
$("#appurl2").text(ajaxobj.appurl);
|
||||
|
||||
updateurl = ajaxobj.updateurl;
|
||||
listCustomStats();
|
||||
break;
|
||||
|
||||
@@ -70,7 +70,7 @@ var configfile = {
|
||||
"command": "configfile",
|
||||
"network": {
|
||||
"ssid": "myssid",
|
||||
"wmode": "0",
|
||||
"wmode": 0,
|
||||
"password": "password"
|
||||
},
|
||||
"general": {
|
||||
@@ -145,7 +145,7 @@ function sendCustomStatus() {
|
||||
"command": "custom_status",
|
||||
"version": "1.9.0b",
|
||||
"customname": "ems-esp",
|
||||
"helpurl": "https://github.com/proddy/EMS-ESP/wiki",
|
||||
"appurl": "https://github.com/proddy/EMS-ESP",
|
||||
"updateurl": "https://api.github.com/repos/proddy/EMS-ESP/releases/latest",
|
||||
|
||||
"emsbus": {
|
||||
@@ -174,8 +174,10 @@ function sendCustomStatus() {
|
||||
"bm": "mode boiler",
|
||||
"b1": "on",
|
||||
"b2": "off",
|
||||
"b3": 5.8,
|
||||
"b4": 61.5
|
||||
"b3": 15.8,
|
||||
"b4": 61.5,
|
||||
"b5": 35.8,
|
||||
"b6": 47.1
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user