Washing machine cycles counter on past power data

I just ran into this as well. I had setup cycle counters for several appliances based on power consumption, only to find that the counters don’t support long term statistics.

It seems like the issue is that counter entities do not allow setting a state_class, which is necessary for LTS. As a workaround, you can create a template sensor which mirrors the counter value, and that will support setting the state_class, so you can preserve the statistics. Once you have that setup, I assume you could manually edit the history as you were trying to do, although I have never tried this before.

Similar thread: Add counter/sensor to Long-term Statistics