Automation is not getting triggered for the subsequent change in virtual pin after invalidation

Hi,
There are two buttons (ON - v1 and OFF - v0) and an LED (v2) in my project. When I press the ON button, ESP board writes ‘1’ at v2 which turns on the LED. A similar change of state takes place with OFF button.

Automation triggers a notification when v2 turns on. It works well with ON and OFF buttons.

I set an invalidation rule for v2. It should go to its default state (which is ‘0’) after 5 seconds. This also works fine.

But if I press ON button after invalidation, then notification is not getting triggered though the LED change in state. I need to press OFF button before pressing ON button to get the notification. Am I doing something wrong?