LTS is for numbers, not on and off. You would have to create a template sensor that mirrors it as a 0 and 1, have a state class, and then it will store.
However after the timeout that defaults to 10 days, you only have hourly data there so not useful really.
If you push the button for more than a half hour at a time that hour will average to 1.
This is not an on/off situation.
The input_button entity holds the state of when it was last pressed as a timestamp, but it doesn’t carry it into the statistics - maybe because it doesn’t have a state class?
That would probably work, I’d just like to avoid creating another sensor because I have the timestamp in the input_number entity already - until the recorder throws previous values out.
LTS are an aggregation of numerical values.
It just doesn’t work for on/off or string (dates are string, really) values.
If you want, e.g., to monitor how many times the button was pressed during 1 hour (the actual resolution of LTS), you would have to create a numerical template sensor that increments each time you press the button.
Good point. LTS is lossy as it calcs stats (max, min, ave, etc.) for each time period which is why it tosses out the original timestamp.
Myself, I just keep things like this in the recorder and directly manage retention time for each entity. But that means setting up Postgres and creating retention scripts.