Auto detect state_class for water and electricity after period of time

When I didn’t set state_class, please suggest me to set it automatically, based on statistical data. As option, make a special section where Home Assistant will offer to improve itself based on the collected data.

No statistics are collected until you set a state class. So there are no statistics to base this decision on.

HA in any case writes something to the database

That is state data.

In the end, is it expensive to develop, since not enough statistics are written to the database?