mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-28 16:52:33 +01:00
igate beacon over mqtt
This commit is contained in:
@@ -86,7 +86,8 @@
|
||||
"topic": "",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"port": 1883
|
||||
"port": 1883,
|
||||
"beaconOverMqtt": false
|
||||
},
|
||||
"ota": {
|
||||
"username": "",
|
||||
|
||||
@@ -1641,6 +1641,21 @@
|
||||
Default is <strong>1883</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="mqtt.beaconOverMqtt"
|
||||
id="mqtt.beaconOverMqtt"
|
||||
class="form-check-input"
|
||||
/>
|
||||
<label
|
||||
for="mqtt.beaconOverMqtt"
|
||||
class="form-label"
|
||||
>Send iGate Beacon to MQTT</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -207,12 +207,14 @@ function loadSettings(settings) {
|
||||
document.getElementById("mqtt.username").value = settings.mqtt.username;
|
||||
document.getElementById("mqtt.password").value = settings.mqtt.password;
|
||||
document.getElementById("mqtt.port").value = settings.mqtt.port;
|
||||
MqttCheckbox.checked = settings.mqtt.active;
|
||||
MqttServer.disabled = !MqttCheckbox.check;
|
||||
MqttTopic.disabled = !MqttCheckbox.check;
|
||||
MqttUsername.disabled = !MqttCheckbox.check;
|
||||
MqttPassword.disabled = !MqttCheckbox.check;
|
||||
MqttPort.disabled = !MqttCheckbox.check;
|
||||
document.getElementById("mqtt.beaconOverMqtt").value = settings.mqtt.beaconOverMqtt;
|
||||
MqttCheckbox.checked = settings.mqtt.active;
|
||||
MqttServer.disabled = !MqttCheckbox.check;
|
||||
MqttTopic.disabled = !MqttCheckbox.check;
|
||||
MqttUsername.disabled = !MqttCheckbox.check;
|
||||
MqttPassword.disabled = !MqttCheckbox.check;
|
||||
MqttPort.disabled = !MqttCheckbox.check;
|
||||
MqttBeaconOverMqtt.disabled = !MqttCheckbox.check;
|
||||
|
||||
// Reboot
|
||||
document.getElementById("other.rebootMode").checked = settings.other.rebootMode;
|
||||
@@ -380,12 +382,14 @@ const MqttTopic = document.querySelector('input[name="mqtt.topic
|
||||
const MqttUsername = document.querySelector('input[name="mqtt.username"]');
|
||||
const MqttPassword = document.querySelector('input[name="mqtt.password"]');
|
||||
const MqttPort = document.querySelector('input[name="mqtt.port"]');
|
||||
const MqttBeaconOverMqtt = document.querySelector('input[name="mqtt.beaconOverMqtt"]');
|
||||
MqttCheckbox.addEventListener("change", function () {
|
||||
MqttServer.disabled = !this.checked;
|
||||
MqttTopic.disabled = !this.checked;
|
||||
MqttUsername.disabled = !this.checked;
|
||||
MqttPassword.disabled = !this.checked;
|
||||
MqttPort.disabled = !this.checked;
|
||||
MqttBeaconOverMqtt.disabled = !this.checked;
|
||||
});
|
||||
|
||||
// Reboot Switches
|
||||
|
||||
@@ -158,6 +158,7 @@ public:
|
||||
String username;
|
||||
String password;
|
||||
int port;
|
||||
bool beaconOverMqtt;
|
||||
};
|
||||
|
||||
class Configuration {
|
||||
|
||||
@@ -131,6 +131,7 @@ bool Configuration::writeFile() {
|
||||
data["mqtt"]["username"] = mqtt.username;
|
||||
data["mqtt"]["password"] = mqtt.password;
|
||||
data["mqtt"]["port"] = mqtt.port;
|
||||
data["mqtt"]["beaconOverMqtt"] = mqtt.beaconOverMqtt;
|
||||
|
||||
data["ota"]["username"] = ota.username;
|
||||
data["ota"]["password"] = ota.password;
|
||||
@@ -323,13 +324,15 @@ bool Configuration::readFile() {
|
||||
!data["mqtt"].containsKey("topic") ||
|
||||
!data["mqtt"].containsKey("username") ||
|
||||
!data["mqtt"].containsKey("password") ||
|
||||
!data["mqtt"].containsKey("port")) needsRewrite = true;
|
||||
!data["mqtt"].containsKey("port") ||
|
||||
!data["mqtt"].containsKey("beaconOverMqtt")) needsRewrite = true;
|
||||
mqtt.active = data["mqtt"]["active"] | false;
|
||||
mqtt.server = data["mqtt"]["server"] | "";
|
||||
mqtt.topic = data["mqtt"]["topic"] | "aprs-igate";
|
||||
mqtt.username = data["mqtt"]["username"] | "";
|
||||
mqtt.password = data["mqtt"]["password"] | "";
|
||||
mqtt.port = data["mqtt"]["port"] | 1883;
|
||||
mqtt.beaconOverMqtt = data["mqtt"]["beaconOverMqtt"] | false;
|
||||
|
||||
if (!data["ota"].containsKey("username") ||
|
||||
!data["ota"].containsKey("password")) needsRewrite = true;
|
||||
@@ -476,6 +479,7 @@ void Configuration::setDefaultValues() {
|
||||
mqtt.username = "";
|
||||
mqtt.password = "";
|
||||
mqtt.port = 1883;
|
||||
mqtt.beaconOverMqtt = false;
|
||||
|
||||
ota.username = "";
|
||||
ota.password = "";
|
||||
|
||||
@@ -261,6 +261,7 @@ namespace WEB_Utils {
|
||||
Config.mqtt.username = getParamStringSafe("mqtt.username", Config.mqtt.username);
|
||||
Config.mqtt.password = getParamStringSafe("mqtt.password", Config.mqtt.password);
|
||||
Config.mqtt.port = getParamIntSafe("mqtt.port", Config.mqtt.port);
|
||||
Config.mqtt.beaconOverMqtt = request->hasParam("mqtt.beaconOverMqtt", true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user