v1.10.0: intégration capteur CCS811 (TVOC/eCO2, I2C)
Nouveau capteur de qualité d'air CCS811 sur le bus I2C, calqué sur le pattern S88 (local-only, pas encore dans le payload de transmission). - CCS811/get_data.py (lecture live) + write_data.py (timer 10s, self-heal table) - table data_CCS811 (timestamp, eCO2, TVOC) dans create_db.py - config CCS811 (bool) + CCS811_address (0x5A/0x5B, défaut 0x5A) dans set_config.py - service+timer systemd nebuleair-ccs811-data (10s) + ajout boucle d'activation - admin.html: case d'activation + dropdown adresse I2C - sensors.html: carte Get Data (TVOC + eCO2) - database.html + launcher.php: consultation/export/stats data_CCS811 - lib adafruit-circuitpython-ccs811 dans installation_part1.sh - CCS811/README.md: câblage, adresses, warning clock-stretching I2C sur Pi - CLAUDE.md + changelog mis à jour Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -409,6 +409,62 @@
|
||||
});
|
||||
}
|
||||
|
||||
function getCCS811_values() {
|
||||
console.log("Data from CCS811 air-quality sensor:");
|
||||
$("#loading_ccs811").show();
|
||||
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=ccs811',
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
const tableBody = document.getElementById("data-table-body_ccs811");
|
||||
tableBody.innerHTML = "";
|
||||
$("#loading_ccs811").hide();
|
||||
|
||||
if (response.error) {
|
||||
$("#data-table-body_ccs811").append(`
|
||||
<tr>
|
||||
<td colspan="2" class="text-danger">
|
||||
⚠ ${response.error}
|
||||
</td>
|
||||
</tr>
|
||||
`);
|
||||
} else {
|
||||
if (response.TVOC !== undefined) {
|
||||
$("#data-table-body_ccs811").append(`
|
||||
<tr>
|
||||
<td>TVOC</td>
|
||||
<td>${response.TVOC} ppb</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
if (response.eCO2 !== undefined) {
|
||||
$("#data-table-body_ccs811").append(`
|
||||
<tr>
|
||||
<td>eCO2</td>
|
||||
<td>${response.eCO2} ppm</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
$("#loading_ccs811").hide();
|
||||
const tableBody = document.getElementById("data-table-body_ccs811");
|
||||
tableBody.innerHTML = `
|
||||
<tr>
|
||||
<td colspan="2" class="text-danger">
|
||||
⚠ Erreur de communication avec le capteur
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMHZ19_values() {
|
||||
console.log("Data from MH-Z19 CO2 sensor:");
|
||||
$("#loading_mhz19").show();
|
||||
@@ -675,6 +731,29 @@
|
||||
container.innerHTML += S88_HTML;
|
||||
}
|
||||
|
||||
//creates CCS811 air-quality (eCO2/TVOC) card
|
||||
if (config.CCS811) {
|
||||
const CCS811_HTML = `
|
||||
<div class="col-sm-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
I2C
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">CCS811 (TVOC / eCO2)</h5>
|
||||
<p class="card-text">Capteur de composés organiques volatils.</p>
|
||||
<button class="btn btn-primary mb-1" onclick="getCCS811_values()" data-i18n="common.getData">Get Data</button>
|
||||
<div id="loading_ccs811" class="spinner-border spinner-border-sm" style="display: none;" role="status"></div>
|
||||
<table class="table table-striped-columns">
|
||||
<tbody id="data-table-body_ccs811"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
container.innerHTML += CCS811_HTML;
|
||||
}
|
||||
|
||||
//Si on a des SONDES ENVEA connectée il faut faire un deuxième call dans la table envea_sondes_table
|
||||
//creates ENVEA debug card
|
||||
if (config.envea) {
|
||||
|
||||
Reference in New Issue
Block a user