Long term statistics: sensors purged after 10 days although state_class set: attribute order a problem?

You overlooked to mention this important detail in your first post.

That trick works for Template Sensors configured using legacy format which don’t natively support the state_class option. It’s not known to (always) work for entities created by other integrations.

The state_class attribute you added via customize.yaml is being treated like any other attribute (i.e. not being used for long-term statistics).

Contact the author to add a proper state_class option to the entity.


FWIW, the same thing happens to users who attempt to add friendly_name to a sensor entity via customize.yaml. It appears in the entity’s list of attributes but it is not handled as the entity’s friendly name. EDIT See Ildar_Gabdullin’s post below.

2 Likes