Repere des modules = pack x 10 + rang (11 = pack 1 module 1, 21 = pack 2 module 1)

Colonne cellule.pack deduite du nom du fichier de releve ; Grafana et
sensor.evcs_cellules l'affichent. Historique renseigne depuis le 24/09.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011uJ47NxgfpGnuuMr3f2n7Z
This commit is contained in:
Tallagrand Thierry
2026-09-26 01:05:54 +02:00
parent 7942577967
commit dd83727900
6 changed files with 44 additions and 12 deletions

View File

@@ -12,7 +12,7 @@
"refresh": 1,
"includeAll": false,
"multi": false,
"query": "SELECT DISTINCT ON (module) CASE WHEN rang IS NULL THEN module ELSE rang || ' · ' || module END AS __text, module AS __value FROM cellule ORDER BY module, ts DESC"
"query": "SELECT __text, __value FROM (SELECT DISTINCT ON (module) CASE WHEN pack IS NOT NULL AND rang IS NOT NULL THEN (pack * 10 + rang) || ' · ' || module WHEN rang IS NOT NULL THEN rang || ' · ' || module ELSE module END AS __text, module AS __value FROM cellule ORDER BY module, ts DESC) v ORDER BY __text"
}
]
},
@@ -91,7 +91,7 @@
"format": "table",
"rawQuery": true,
"editorMode": "code",
"rawSql": "WITH vivants AS (\n SELECT module FROM cellule GROUP BY module\n HAVING max(ts) > now() - interval '2 hours'),\ndernier AS (\n SELECT DISTINCT ON (module) module, ts, rang FROM cellule\n WHERE module IN (SELECT module FROM vivants)\n ORDER BY module, ts DESC),\nmaintenant AS (\n SELECT c.module, max(c.mv) - min(c.mv) AS ecart,\n max(c.mv) AS haute, min(c.mv) AS basse,\n max(c.courant_ma) AS ma, d.ts, d.rang\n FROM cellule c JOIN dernier d ON d.module = c.module AND d.ts = c.ts\n GROUP BY c.module, d.ts, d.rang),\nperiode AS (\n SELECT module, max(ecart) AS ecart_max FROM (\n SELECT module, ts, max(mv) - min(mv) AS ecart\n FROM cellule WHERE $__timeFilter(ts) GROUP BY module, ts) x\n GROUP BY module)\nSELECT m.rang AS \"Rang\", m.module AS \"Module\",\n m.ecart AS \"Ecart maintenant\",\n p.ecart_max AS \"Ecart max sur la periode\",\n m.haute AS \"Plus haute\", m.basse AS \"Plus basse\",\n round(m.ma / 1000.0, 1) AS \"Courant (A)\",\n to_char(m.ts, 'DD/MM HH24:MI') AS \"Dernier releve\"\n FROM maintenant m LEFT JOIN periode p USING (module)\n ORDER BY m.ecart DESC"
"rawSql": "WITH vivants AS (\n SELECT module FROM cellule GROUP BY module\n HAVING max(ts) > now() - interval '2 hours'),\ndernier AS (\n SELECT DISTINCT ON (module) module, ts,\n CASE WHEN pack IS NOT NULL AND rang IS NOT NULL THEN pack * 10 + rang\n ELSE rang END AS rang FROM cellule\n WHERE module IN (SELECT module FROM vivants)\n ORDER BY module, ts DESC),\nmaintenant AS (\n SELECT c.module, max(c.mv) - min(c.mv) AS ecart,\n max(c.mv) AS haute, min(c.mv) AS basse,\n max(c.courant_ma) AS ma, d.ts, d.rang\n FROM cellule c JOIN dernier d ON d.module = c.module AND d.ts = c.ts\n GROUP BY c.module, d.ts, d.rang),\nperiode AS (\n SELECT module, max(ecart) AS ecart_max FROM (\n SELECT module, ts, max(mv) - min(mv) AS ecart\n FROM cellule WHERE $__timeFilter(ts) GROUP BY module, ts) x\n GROUP BY module)\nSELECT m.rang AS \"Repere\", m.module AS \"Module\",\n m.ecart AS \"Ecart maintenant\",\n p.ecart_max AS \"Ecart max sur la periode\",\n m.haute AS \"Plus haute\", m.basse AS \"Plus basse\",\n round(m.ma / 1000.0, 1) AS \"Courant (A)\",\n to_char(m.ts, 'DD/MM HH24:MI') AS \"Dernier releve\"\n FROM maintenant m LEFT JOIN periode p USING (module)\n ORDER BY m.ecart DESC"
}
],
"gridPos": {

View File

@@ -49,3 +49,7 @@ services:
- "600"
- --modules
- "1,2,3,4,5"
# Fichiers ...-pack2-suivi.csv : l'ingestion en deduit le pack, et le
# repere affiche pack x 10 + rang (21..25 ici, 11..14 pour les US5000).
- --suffixe
- pack2