I have a device that mesure voltage on my eletric meter, I use Zigbee2Mqtt to get the data. Depite having added the device_class voltage and state_class measurement using customize in the config, Long Term Stats are still not working (I see no, problem in dev tools on the entity's stats but still have the data deleted after 10 day). Here is what I've added to the config :
homeassistant:
customize:
sensor.lixee_urms1:
state_class: measurement
device_class: voltage
It shows well in dev tools, state :