Can a automation detect if a "Media player" is already playing?

I am curious to use a test in a automation, if possible, to skip the next action, if a “Media player” is already playing something.

The actual device being a Sonos player, possibly playing music, audiobooks, etc. If playing, leave it alone, otherwise play a specific audiobook.

You can simply check the current state of the media player, it will show playing or similar. You can use the developer tools to check state and available attributes.

1 Like

There the main ‘condition:’ statement in the automation, there’s if, iif, choose, jinja if, lots of ways to branch.

Show us your code for real suggestions using the </> key in the editor here.

1 Like

You use a State condition.

against a Media Player