Solution pour Apexcharts basé sur les statistiques long termes.
type: custom:apexcharts-card
graph_span: 100d
series:
- entity: AJOUTEZ N'IMPORTE-QUELLE-ENTITÉ-EXISTANTE
name: current
color: red
stroke_width: 1.3
data_generator: |
const stat_entity = 'gazpar:VOTRE_LTS_ENTITÉ_consumption_stat';
var statistics = await hass.callWS({
type: 'recorder/statistics_during_period',
start_time: new Date(start).toISOString(),
end_time: new Date(end).toISOString(),
statistic_ids: [stat_entity],
period: "hour",
});
var stats = statistics[stat_entity];
var result = [];
var len = stats.length;
for (let i = 0; i < len; i++) {
let stat = stats[i].state;
result.push([(new Date(stats[i].end).getTime()),stat]);
}
return result;