On the Subject of The Very Annoying Button

Good luck trying to get anything done. No, seriously, Good luck.

This module consists of a hatch with a button behind it and a counter that resets approximately every ten seconds.

When the counter resets, there is a chance that the hatch will open, revealing a button in one of four colours.
The module does not give an audio indication when this occurs.

The button must be pressed before the module resets again.

When the button is pressed, the number of seconds remaining on the counter before the next reset is due is recorded.
When the counter resets, the recorded value is submitted and the hatch will close.

The validity of the submitted value depends on the colour of the button:

Button Color Safe Digit Interactions
(Arrows denote how much time left in seconds, rounded up)
1 2 3 4 5 6 7 8 9
Red
Yellow
Green
Blue

In addition, the module keeps track of the most recent valid submission for each colour which must also be avoided when the button is pressed.

Once the time remaining drops below one minute or this is one of the last modules on the bomb, this module becomes solvable on its next reset.
In this state, the hatch will not close and strikes cannot be incurred from resets without submission.
A valid submission in this state will solve the module.