The problem is that the script “script.switchmedia” is working on its own and the tap action work on its own.
When I put them together the navigate action works but the script is not running.
What I want to do is simply that, when I tap a button in the ui(lovelace), it will run a script and then navigate to another page.
Maybe someone has an idea for a different approach