Counter, How-To with an automation

I have searched for the past hour or so but I don’t follow on how to add a counter.

For example if I have an entity that has motion, I want to be able to increase a counter.

Action: Motion is counted.
Counter: Should increase a number

What is the best way to go about this?

Thanks in advance!

Use an input_number helper entity.

Have your automation trigger on the desired motion and then increase the value of that input_number appropriately (may require use of templates?).

Edit: or what finity said (sorry, had this post typed up but neglected to post it earlier.

Like the others mentioned, use a counter and an automation to increase whenever the event occurs. I have an example you can follow here - mine is for adding “points” when a chore is complete, but you should be able to follow it for your use case: https://smarthomepursuits.com/chore-tracking-with-point-system-in-home-assistant/