exactly.
add an integer counter. every time you send a notification increment the counter. stop sending notifications after the counter value is how many ever notifications you want. remember to reset the counter value to zero when the power did change, which is the else for the current if inside the timer.