Multiscrape Sensor data erased after 15 days

Hello everyone,

I just noticed that data from multiscrape is completely erased (not down samples) after 10 days even if it is declared as energy.

Is there a way to keep data for longer in the case of multiscrape?

Thank you!

The entity needs a valid state_class, either total_increasing or total to generate LTS.

Thank you for the quick and precise reply. I read the following page:

Foto the case of energy consumption I will try the total as it is reset to 0 every day.

On the other hand, I have a multiscrape sensor that gets the mortgage rate from a bank. I would like to keep the data longer than 15 day but it falls in the “measurement” state_class description. Any advice on how to properly manage this case?

Have a good day!

Never mind:

"
To opt-in for statistics, the sensor must have state_class set to one of the valid state classes: measurement, total or total_increasing
"

I thought that by default it set state_class as measurement, it seems not the case!

No, for that one you would use total_increasing. This is the one that can deal with periodic resets. Any decrease in value will be interpreted as a reset.

Yes, measurement for the mortgage sensor.

Very interesting thank you!

Little bonus question, for one of my scrape sensors I added the state class as you proposed, but I had to correct the device class (energy instead of power). What happened is that I lost all the history of that sensor. Is that normal? Is there a way to avoir that?

Thanks have a good day!