The first link I sent you, it shows you in the examples. Here though, neither example does what you want but with a little thought you can use parts from both of them to create the automation you need.
This swaps pages like you want but not exactly. It does it on a 5s interval no matter what. So, you just need to add an if-else condition in it.
interval:
- interval: 5s
then:
- display.page.show_next: my_display
- component.update: my_display
If you scroll down a little bit on that documentation page there are more examples right under it that show you how to format an if-then condition.
Im not a fan of just writing people’s code for them to just copy/paste because I dont think it helps anyone.
Ill help you but, try to see if you can work it yourself now. Ive basically given you all the pieces, you just need to put it together.

