Any made an automation to turn the tv off after the next episode

My wife and I regularly watch tv shows in bed waiting for the kids to sleep, or one of them to have some kind of issue that needs resolving, so we can’t sleep any earlier (as much as’d like to). I should say the hardest part in all this is putting the remote somewhere were it will show up quickly next time. The freaking Apple Remote gets everywhere - so I bought a little wall mount that charges it. Except after a few shows we’ll feel tired and the inevitable next step is turning to the other partner “just one more dear?” “Yes, love, just this one then I’m going to sleep”. Except you can’t put the remote away as you will need to turn off the tv after the one episode, which means someone will do that 1/2 asleep and the remote gets left in the bed again.
So is there an automation that one could create that when initiated by one’s voice, the assistant would receive the command “last episode” and then Google would trigger a HA automaton. It could have to capture what’s playing and then as soon as what’s playing is changed then turn the TV off.
Is this doable? I’ve only seen media_player attributes that list the source not the file name.

Any thoughts?

That’s possible if the media player integration supports detecting when playback stops. Many do. Can be as simple as enabling the automation that turns the tv off based on playback state.

Or use media_position (I believe that is what the attribute is called).
This shows where you are and if this value goes from high to low then a new episode has started.
Or you could set it to detect when it’s past 90% or so and any state change of the media player.

1 Like