Fix Grafana dashboard (FM datasource), update logo in FM UI

- Create PostgreSQL-FlexMeasures datasource in Grafana (id: 31)
- Update dashboard queries to read from FlexMeasures DB (timed_belief)
- Replace FlexMeasures logo in navbar template with Cariflex logo
- Dashboard now shows real data from Cariflex simulator
This commit is contained in:
Eric F
2026-06-08 11:40:09 -04:00
parent 1d4a9cf8aa
commit 23ab00cf64

View File

@@ -13,9 +13,9 @@
"title": "Production PV (kW) - 10 panneaux", "title": "Production PV (kW) - 10 panneaux",
"type": "timeseries", "type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 0, "y": 0}, "gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
"datasource": {"type": "influxdb", "uid": "influxdb-v2"}, "datasource": {"type": "postgres", "uid": "31"},
"targets": [{ "targets": [{
"query": "from(bucket:\"smartcity\") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r[\"_measurement\"] == \"mqtt_consumer\") |> filter(fn: (r) => r[\"topic\"] =~ /pv_/) |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)", "rawSql": "SELECT event_start as time, SUM(event_value) as power_kw FROM timed_belief WHERE sensor_id BETWEEN 41 AND 50 AND event_start > NOW() - INTERVAL '24 hours' GROUP BY event_start ORDER BY event_start",
"refId": "A" "refId": "A"
}], }],
"fieldConfig": {"defaults": {"unit": "kW", "min": 0, "max": 50}} "fieldConfig": {"defaults": {"unit": "kW", "min": 0, "max": 50}}
@@ -25,49 +25,45 @@
"title": "Consommation Bornes VE (kW) - 10 bornes", "title": "Consommation Bornes VE (kW) - 10 bornes",
"type": "timeseries", "type": "timeseries",
"gridPos": {"h": 8, "w": 12, "x": 12, "y": 0}, "gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
"datasource": {"type": "influxdb", "uid": "influxdb-v2"}, "datasource": {"type": "postgres", "uid": "31"},
"targets": [{ "targets": [{
"query": "from(bucket:\"smartcity\") |> range(start: v.timeRangeStart, stop: v.timeRangeStop) |> filter(fn: (r) => r[\"_measurement\"] == \"mqtt_consumer\") |> filter(fn: (r) => r[\"topic\"] =~ /chg_/) |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)", "rawSql": "SELECT event_start as time, SUM(event_value) as power_kw FROM timed_belief WHERE sensor_id BETWEEN 61 AND 70 AND event_start > NOW() - INTERVAL '24 hours' GROUP BY event_start ORDER BY event_start",
"refId": "A" "refId": "A"
}], }],
"fieldConfig": {"defaults": {"unit": "kW", "min": 0, "max": 220}} "fieldConfig": {"defaults": {"unit": "kW", "min": 0, "max": 220}}
}, },
{ {
"id": 3, "id": 3,
"title": "Batteries - État de Charge (kWh) - 10 batteries", "title": "Batteries - État de Charge (kWh)",
"type": "gauge", "type": "timeseries",
"gridPos": {"h": 8, "w": 8, "x": 0, "y": 8}, "gridPos": {"h": 8, "w": 8, "x": 0, "y": 8},
"datasource": {"type": "influxdb", "uid": "influxdb-v2"}, "datasource": {"type": "postgres", "uid": "31"},
"targets": [{ "targets": [{
"query": "from(bucket:\"smartcity\") |> range(start: -5m) |> filter(fn: (r) => r[\"_measurement\"] == \"mqtt_consumer\") |> filter(fn: (r) => r[\"topic\"] =~ /bat_/) |> mean()", "rawSql": "SELECT event_start as time, AVG(event_value) as soc_kwh FROM timed_belief WHERE sensor_id BETWEEN 51 AND 60 AND event_start > NOW() - INTERVAL '24 hours' GROUP BY event_start ORDER BY event_start",
"refId": "A" "refId": "A"
}], }],
"fieldConfig": { "fieldConfig": {"defaults": {"unit": "kWh", "min": 0, "max": 100}}
"defaults": {"unit": "kWh", "min": 0, "max": 100, "thresholds": {"steps": [{"color": "red", "value": 0}, {"color": "yellow", "value": 20}, {"color": "green", "value": 50}]}}
}
}, },
{ {
"id": 4, "id": 4,
"title": "VE V2G - État de Charge (kWh) - 10 véhicules", "title": "VE V2G - État de Charge (kWh)",
"type": "gauge", "type": "timeseries",
"gridPos": {"h": 8, "w": 8, "x": 8, "y": 8}, "gridPos": {"h": 8, "w": 8, "x": 8, "y": 8},
"datasource": {"type": "influxdb", "uid": "influxdb-v2"}, "datasource": {"type": "postgres", "uid": "31"},
"targets": [{ "targets": [{
"query": "from(bucket:\"smartcity\") |> range(start: -5m) |> filter(fn: (r) => r[\"_measurement\"] == \"mqtt_consumer\") |> filter(fn: (r) => r[\"topic\"] =~ /ev_/) |> mean()", "rawSql": "SELECT event_start as time, AVG(event_value) as soc_kwh FROM timed_belief WHERE sensor_id BETWEEN 71 AND 80 AND event_start > NOW() - INTERVAL '24 hours' GROUP BY event_start ORDER BY event_start",
"refId": "A" "refId": "A"
}], }],
"fieldConfig": { "fieldConfig": {"defaults": {"unit": "kWh", "min": 0, "max": 75}}
"defaults": {"unit": "kWh", "min": 0, "max": 75, "thresholds": {"steps": [{"color": "red", "value": 0}, {"color": "yellow", "value": 15}, {"color": "green", "value": 40}]}}
}
}, },
{ {
"id": 5, "id": 5,
"title": "Flexibilité Disponible (kW)", "title": "Flexibilité Totale (kW)",
"type": "stat", "type": "stat",
"gridPos": {"h": 8, "w": 8, "x": 16, "y": 8}, "gridPos": {"h": 8, "w": 8, "x": 16, "y": 8},
"datasource": {"type": "influxdb", "uid": "influxdb-v2"}, "datasource": {"type": "postgres", "uid": "31"},
"targets": [{ "targets": [{
"query": "from(bucket:\"smartcity\") |> range(start: -5m) |> filter(fn: (r) => r[\"_measurement\"] == \"mqtt_consumer\") |> filter(fn: (r) => r[\"topic\"] =~ /bat_|ev_/) |> mean()", "rawSql": "SELECT SUM(event_value) as flex_kw FROM timed_belief WHERE sensor_id BETWEEN 51 AND 80 AND event_start > NOW() - INTERVAL '1 hour' GROUP BY sensor_id ORDER BY event_start DESC LIMIT 1",
"refId": "A" "refId": "A"
}], }],
"fieldConfig": {"defaults": {"unit": "kW", "min": 0}} "fieldConfig": {"defaults": {"unit": "kW", "min": 0}}
@@ -77,9 +73,9 @@
"title": "Carte des Actifs Cariflex", "title": "Carte des Actifs Cariflex",
"type": "geomap", "type": "geomap",
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 16}, "gridPos": {"h": 10, "w": 24, "x": 0, "y": 16},
"datasource": {"type": "postgres", "uid": "PostgreSQL-SmartCity"}, "datasource": {"type": "postgres", "uid": "31"},
"targets": [{ "targets": [{
"rawSql": "SELECT g.name, g.latitude, g.longitude, gt.name as type FROM generic_asset g JOIN generic_asset_type gt ON g.generic_asset_type_id = gt.id WHERE g.account_id = 1 ORDER BY gt.id, g.id", "rawSql": "SELECT g.name, g.latitude, g.longitude, gt.name as type FROM generic_asset g JOIN generic_asset_type gt ON g.generic_asset_type_id = gt.id ORDER BY gt.id, g.id",
"refId": "A" "refId": "A"
}], }],
"options": {"view": {"center": [14.6, -61.2], "zoom": 10}} "options": {"view": {"center": [14.6, -61.2], "zoom": 10}}