updates
This commit is contained in:
@@ -79,49 +79,49 @@
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_NPM" onchange="update_config_scripts_sqlite('NPM/get_data_modbus_v3.py', this.checked)">
|
||||
<label class="form-check-label" for="check_NPM">
|
||||
Next PM
|
||||
Send Next PM data
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_NPM_5channels" onchange="update_config_sqlite('npm_5channel', this.checked)">
|
||||
<label class="form-check-label" for="check_NPM_5channels">
|
||||
Next PM send 5 channels (no script)
|
||||
Send Next PM 5 channels data
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_bme280" onchange="update_config_scripts_sqlite('BME280/get_data_v2.py', this.checked)">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_bme280" onchange="update_config_sqlite('BME280', this.checked)">
|
||||
<label class="form-check-label" for="check_bme280">
|
||||
Sonde temp/hum (BME280)
|
||||
Send temp/hum data (BME280)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_envea" onchange="update_config_scripts_sqlite('envea/read_value_v2.py', this.checked)">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_envea" onchange="update_config_sqlite('envea/read_value_v2.py', this.checked)">
|
||||
<label class="form-check-label" for="check_envea">
|
||||
Sonde Envea
|
||||
Send Envea sensor data
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_solarBattery" onchange="update_config_scripts_sqlite('MPPT/read.py', this.checked)">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_solarBattery" onchange="update_config_sqlite('MPPT', this.checked)">
|
||||
<label class="form-check-label" for="check_solarBattery">
|
||||
Solar / Battery MPPT
|
||||
Send Solar / Battery MPPT data
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_WindMeter" onchange="update_config_sqlite('windMeter', this.checked)">
|
||||
<label class="form-check-label" for="check_WindMeter">
|
||||
Wind Meter (no script -> systemd service)
|
||||
Senb Wind Meter data
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" value="" id="check_uSpot" onchange="update_config_sqlite('send_uSpot', this.checked)" disabled>
|
||||
<label class="form-check-label" for="check_uSpot">
|
||||
uSpot
|
||||
Send to uSpot
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -506,62 +506,6 @@ function update_config_sqlite(param, value){
|
||||
});
|
||||
}
|
||||
|
||||
function update_config_scripts_sqlite(param, value) {
|
||||
console.log("Updating scripts sqlite ", param, " : ", value);
|
||||
const toastLiveExample = document.getElementById('liveToast')
|
||||
const toastBody = toastLiveExample.querySelector('.toast-body');
|
||||
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=update_config_scripts_sqlite¶m=' + param + '&value=' + value,
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
cache: false,
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
// Format the response nicely
|
||||
let formattedMessage = '';
|
||||
|
||||
if (response.success) {
|
||||
// Success message
|
||||
toastLiveExample.classList.remove('text-bg-danger');
|
||||
toastLiveExample.classList.add('text-bg-success');
|
||||
|
||||
formattedMessage = `
|
||||
<strong>Success!</strong><br>
|
||||
Parameter: ${response.script_path || param}<br>
|
||||
Value: ${response.enabled !== undefined ? response.enabled : value}<br>
|
||||
${response.message || ''}
|
||||
`;
|
||||
|
||||
if (response.script_path == "envea/read_value_v2.py") {
|
||||
console.log("envea sondes activated");
|
||||
add_sondeEnveaContainer();
|
||||
|
||||
}
|
||||
} else {
|
||||
// Error message
|
||||
toastLiveExample.classList.remove('text-bg-success');
|
||||
toastLiveExample.classList.add('text-bg-danger');
|
||||
|
||||
formattedMessage = `
|
||||
<strong>Error!</strong><br>
|
||||
${response.error || 'Unknown error'}<br>
|
||||
Parameter: ${response.script_path || param}
|
||||
`;
|
||||
}
|
||||
|
||||
// Update the toast body with formatted content
|
||||
toastBody.innerHTML = formattedMessage;
|
||||
// Show the toast
|
||||
const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
|
||||
toastBootstrap.show()
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function update_config(param, value){
|
||||
console.log("Updating ",param," : ", value);
|
||||
|
||||
Reference in New Issue
Block a user