Grafana La nuit : voiture sur la batterie, budget contre donne ; historisation du budget et du compteur de la borne

This commit is contained in:
Tallagrand Thierry
2026-09-30 18:33:32 +02:00
parent 01c12345f3
commit baf62bb3d5
4 changed files with 272 additions and 8 deletions

View File

@@ -519,6 +519,200 @@
}
}
},
{
"type": "timeseries",
"title": "Voiture sur la batterie : budget contre donne",
"description": "Le budget est ce que la voiture peut prendre sur la batterie SANS EDF (profil prudent, plancher 22 %, la batterie tient jusqu'a la nuit suivante). Le controleur le FIGE a 01:24 : sa valeur a 01:24 est celle qui compte. « Donne depuis 01:24 » = compteur de la borne depuis l'ouverture des heures creuses. En « sans EDF », la charge doit s'arreter quand la courbe bleue atteint le budget ; en « charge complete », EDF finit le reste. Axe de droite : la batterie et son plancher prudent.",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "evcs-pg"
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "evcs-pg"
},
"format": "time_series",
"rawQuery": true,
"editorMode": "code",
"rawSql": "SELECT ts AS time, valeur AS \"Budget prevu (bilan)\"\nFROM mesure\nWHERE cle = 'input_number.evcs_balance_night_vehicle_budget_kwh'\n AND $__timeFilter(ts)\nORDER BY 1"
},
{
"refId": "B",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "evcs-pg"
},
"format": "time_series",
"rawQuery": true,
"editorMode": "code",
"rawSql": "SELECT m.ts AS time, m.valeur - b.valeur AS \"Donne depuis 01:24\"\nFROM mesure m\nJOIN LATERAL (\n SELECT valeur FROM mesure\n WHERE cle = m.cle\n AND ts <= ((((m.ts AT TIME ZONE 'Europe/Paris') - interval '84 minutes')::date\n + time '01:24') AT TIME ZONE 'Europe/Paris')\n ORDER BY ts DESC LIMIT 1) b ON true\nWHERE m.cle = 'sensor.evcs_hq2239dnt7p_total_energy'\n AND $__timeFilter(m.ts)\n AND (m.ts AT TIME ZONE 'Europe/Paris')::time BETWEEN time '01:24' AND time '09:00'\nORDER BY 1"
},
{
"refId": "C",
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "evcs-pg"
},
"format": "time_series",
"rawQuery": true,
"editorMode": "code",
"rawSql": "SELECT ts AS time,\n soc_pct AS \"SOC batterie\",\n soc_requis_prudent_pct AS \"Plancher prudent\"\nFROM bilan\nWHERE $__timeFilter(ts)\nORDER BY 1"
}
],
"gridPos": {
"x": 0,
"y": 24,
"w": 24,
"h": 9
},
"fieldConfig": {
"defaults": {
"unit": "kwatth",
"color": {
"mode": "palette-classic"
},
"custom": {
"lineWidth": 2,
"fillOpacity": 0,
"showPoints": "never",
"spanNulls": true
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Budget prevu (bilan)"
},
"properties": [
{
"id": "color",
"value": {
"mode": "fixed",
"fixedColor": "orange"
}
},
{
"id": "custom.lineInterpolation",
"value": "stepAfter"
},
{
"id": "custom.lineStyle",
"value": {
"fill": "dash",
"dash": [
8,
6
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Donne depuis 01:24"
},
"properties": [
{
"id": "color",
"value": {
"mode": "fixed",
"fixedColor": "blue"
}
},
{
"id": "custom.lineWidth",
"value": 3
},
{
"id": "custom.fillOpacity",
"value": 15
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "SOC batterie|Plancher prudent"
},
"properties": [
{
"id": "unit",
"value": "percent"
},
{
"id": "min",
"value": 0
},
{
"id": "max",
"value": 100
},
{
"id": "custom.axisPlacement",
"value": "right"
}
]
},
{
"matcher": {
"id": "byName",
"options": "SOC batterie"
},
"properties": [
{
"id": "color",
"value": {
"mode": "fixed",
"fixedColor": "green"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Plancher prudent"
},
"properties": [
{
"id": "color",
"value": {
"mode": "fixed",
"fixedColor": "red"
}
},
{
"id": "custom.lineStyle",
"value": {
"fill": "dash",
"dash": [
4,
4
]
}
}
]
}
]
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true,
"calcs": []
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}
},
{
"type": "table",
"title": "Journal des evenements",
@@ -542,7 +736,7 @@
],
"gridPos": {
"x": 0,
"y": 24,
"y": 33,
"w": 24,
"h": 8
},
@@ -654,7 +848,7 @@
},
"gridPos": {
"x": 0,
"y": 32,
"y": 41,
"w": 14,
"h": 11
},
@@ -878,7 +1072,7 @@
],
"gridPos": {
"x": 14,
"y": 32,
"y": 41,
"w": 10,
"h": 11
},
@@ -925,7 +1119,7 @@
],
"gridPos": {
"x": 0,
"y": 43,
"y": 52,
"w": 24,
"h": 9
},