Is there any way to count all state changes of a variable?
This is my situation: I have an input_button (pushed with an Alexa routine) and I want to count how many time it’s pushed in last 24 h
sensor:
- platform: history_stats
name: Pushes in 24h
entity_id: input_button.push_me
state: 'on'
type: count
end: "{{ now() }}"
duration:
hours: 24
But the state of an input_button is the timestamp (i.e. 2022-12-12T20:11:58.861550+00:00).
I can change the input_button with a toggle “turn on” + “turn off” but it’s an antiestetical workaround.