Rasplex turn tv on when playing media?



Hello all,
finally got around to hooking up rasplex with my samsung tv (2014 model) and everything works as it should.
But now that I also have an alexa there is one little thing I am missing:
- Usually my TV is off
- Previously I would turn on my tv, then browse plex to select media to play..this is fine
- BUT, now I can tell Alexa to start playing something on rasplex before the tv is on

- Alexa starts playing the video (well,rasplex does) but the TV is not on

How can I make rasplex power on the tv using hdmi-cec anytime the tv is off and it wants to play media?


Well, found a workaround which is OK for now…
Basically I created an openhab thing that executes the cec-client on command and added this to my alexa movie routine.
So now I first say Alexa, movie time:
-turns on tv
-dims lighting etc
Then I can say Alexa, open plex etc to play movie…
But it should be possible to add a script that fires when movie starts…


progressing…using tautulli (previously plexpy) I can create a script trigger for when specifically the rasplex player starts to play media, this then triggers the same cec-client command to turn the tv on… probably as close to automated as I can get for now


hi DJElo
I understand the problem. Its easy to turn the tv on when you turn your rpi but not so easy to turn it on when you start playing something

Yes, you can do it running other programs like plexpy, but if you want to solve it from inside the rpi, you could potentially tail and grep the log file for the start of a stream and send the cec commands

something like
tail -F /storage/.plexht/temp/plexhometheater.log | grep --line-buffered 'NOTICE: Creating InputStream' | while read ; do my_command ; done

should do the trick

You get a lot of notice messages at the start of the stream you could grep for sending the CEC command


that is true, hadn’t thought about that…anyway, as I’ve started to use plexpy for a whole bunch of other items as well I’ll stick with it until I run into problems, but thanks for the log idea :slight_smile:


if it works for you, there is no reason to change it :slight_smile:

plus my code with --line-buffered doesnt work in rasplex, it was just to give you an idea


DJElo, would you mind sharing your plexpy script?