mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
default MQTT qos to 0 and added Retain flag option
This commit is contained in:
@@ -226,6 +226,19 @@
|
||||
</span>
|
||||
<br>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Retain<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
|
||||
aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right"
|
||||
data-content="MQTT Retain Flag"></i></label>
|
||||
<div class="col-xs-9">
|
||||
<form>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="1" name="mqttretain">Enabled</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="0" name="mqttretain" checked>Disabled</label>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Username<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
|
||||
aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right"
|
||||
|
||||
@@ -27,6 +27,7 @@ var config = {
|
||||
"port": 1883,
|
||||
"qos": 1,
|
||||
"keepalive": 60,
|
||||
"retain": true,
|
||||
"base": "",
|
||||
"user": "",
|
||||
"password": "",
|
||||
@@ -173,6 +174,11 @@ function savemqtt() {
|
||||
config.mqtt.heartbeat = true;
|
||||
}
|
||||
|
||||
config.mqtt.retain = false;
|
||||
if (parseInt($("input[name=\"mqttretain\"]:checked").val()) === 1) {
|
||||
config.mqtt.retain = true;
|
||||
}
|
||||
|
||||
config.mqtt.ip = document.getElementById("mqttip").value;
|
||||
config.mqtt.port = parseInt(document.getElementById("mqttport").value);
|
||||
config.mqtt.qos = parseInt(document.getElementById("mqttqos").value);
|
||||
@@ -325,6 +331,10 @@ function listmqtt() {
|
||||
$("input[name=\"mqttheartbeat\"][value=\"1\"]").prop("checked", true);
|
||||
}
|
||||
|
||||
if (config.mqtt.retain) {
|
||||
$("input[name=\"mqttretain\"][value=\"1\"]").prop("checked", true);
|
||||
}
|
||||
|
||||
document.getElementById("mqttip").value = config.mqtt.ip;
|
||||
document.getElementById("mqttport").value = config.mqtt.port;
|
||||
document.getElementById("mqttqos").value = config.mqtt.qos;
|
||||
|
||||
Reference in New Issue
Block a user