Implement Idle screen in prototype (after x seconds of no interaction)

Hi I’m using a mqtt broker and an arduino to change the visibility of groups. Although this is all working fine I would like to implement that after an x-amount of time, while there are no changes in the mqtt payload or no interactions within the prototype (you can press on buttons and stuff to read more about a certain subject) to hide all the groups except one and that as soon as the payload is changed again or the user has touched the screen (we’re using a touchscreen) to toggle back to the old state basically. Is there a way to implement this in my prototype or is noodl just not there yet?