A vacuum routine can check how often cleaning ran during the past week before deciding to start again. Home Assistant adds recorder.get_history, making the stored sequence of entity states available inside automations and scripts instead of requiring an external history request.
The result gives each state a start and end time within the requested period. It excludes attributes and repeated records whose state did not change. Queries remain limited by what the recorder retains and by the record limit per entity; they do not recover history that has already been removed.