#Optimize the chart for past 7 days consumption usage

1 messages · Page 1 of 1 (latest)

tepid cape
#

I have an utility helper set as 1 day, which resets at midnight. Its daily max value is the daily consumption of the electricity.
I would like to display a histogram-based chart with Apex Chart extension. I managed to get the data visible on the chart, but it seems that sometimes it takes several seconds to display them.

That gives me an impression that there are plently of data to be loaded from backend which are then frontend processed.
Ultimate question is, should this be optimized to have a new entity that has 1 value per day only?

My YAML code looks like this, and it properly displays what I want, just sometimes takes a bit of time.

  • Get data for past 7 days
  • Create columns, gruped, with max function with duration of 1 day
type: custom:apexcharts-card
graph_span: 7d
header:
  show: true
  title: Daily energy consumption
  show_states: true
  colorize_states: true
apex_config:
  chart:
    height: 250px
series:
  - entity: sensor.utility_meter_1d
    type: column
    group_by:
      func: max
      duration: 1d
    color: "#ABCDEF"
    opacity: 0.6
#

This is the history of the utility meter:

tepid tusk
#

You can do this without apex with statistics graph card.

#

If your entity records statistics correctly.

#

It should be much more optimized

tepid cape
# tepid tusk If your entity records statistics correctly.

How would you advice the best way to make sure it is set correctly?
I have an underlying entity with energy TOTAL and utility meter that resets the value and (max(day_val)) is the daily consumption.

Which statistic entity would be the best, to properly optimize the displayed data?

tepid tusk
#

You probably don't even need the utility meter.

#

Just make a statistics graph card with the total entity, select change type, and daily period.