Save the value of millis() when the value has changed since the last time it was read. Next time you read the value if it has not changed then compare the current value of millis() with the previously saved (last change time) value and if it is longer that the required period then do what you want