Skip to content

Statistics uses the wrong timestamp column #557

@georgh

Description

@georgh

Describe the bug
Plotted statisitc values (5minute and hourly) are shifted on the x-axis for state-statistics.

The value listed for example at 23:10 uses the entry collected at 23:14:43.
I would have expected plotly to show the value at 23:15.

I think that is due to using the start_ts-column in statistics_short_term instead of the created_ts column.

Naming is a bit confusing and I dont see much in the offical docu about it (https://data.home-assistant.io/docs/statistics/). I am not sure why you would dump start and end of the period into the db if its always 5 min?

Screenshots

Image

Image

Image

yaml

type: custom:plotly-graph
title: Verschiedene EnergieQuellen
hours_to_show: 4h
autorange_after_scroll: false
refresh_interval: auto
ha_theme: true
grid_options:
  columns: 48
  rows: 8
entities:
  - entity: sensor.total_energy
    name: normal db
  - entity: sensor.total_energy
    name: statistics db - state / hour
    statistic: state
    period: hour
    line: true
  - entity: sensor.total_energy
    name: statistics db - state / 5 min
    statistic: state
    period: 5minute
    line: true

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions