Messed up stat: template with last_period

Hi all,

I have following template sensor:

  solar_yield_last_year:
    friendly_name: Solar Yield Last Year
    unique_id: solar_yield_last_year
    unit_of_measurement: kWh
    icon_template: "mdi:counter"
    value_template: "{{ state_attr('sensor.solar_yield_this_year','last_period') }}"

I must admit it’s been a while since I looked at that one.
Seems like last year there was at least one bad reading, because the stat now has a value of… 1.747.592.396.928.103.700.000.000.000.000.000.000,0000000000000000000000000000000 kWh
To be clear, I do not run a nuclear fusion plant in my basement…

I use the SQLite plugin, but can’t find where to remove the data that is causing this.

Spiffo

Might be coincidence, but the first ten digits of that number represents a UNIX time stamp for just over one month from now.

wow, that’s a special kind of brain you have :smile:

Still hoping to get this cleared up, it messes with the dashboard page on which I show the stats…