I saw this code snippet in another thread:
- service: recorder.purge_entities
data:
keep_days: 5
target:
entity_id: sensor.your_entity
Haven’t tried it myself yet, but I’d appreciate your feedback in case you do - I assume it keeps the long-term stats for the entity, but it would be nice to get confirmation