If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Rasplex turn tv on when playing media?

DJEloDJElo Posts: 7Members

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?
Tagged:

Best Answers

  • DJEloDJElo Posts: 7Members
    Accepted Answer

    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

  • videotecaCNSUvideotecaCNSU Posts: 368Validating, Plex Pass Plex Pass
    Accepted Answer

    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

    https://unix.stackexchange.com/questions/12075/best-way-to-follow-a-log-and-execute-a-command-when-some-text-appears-in-the-log

Answers

  • DJEloDJElo Posts: 7Members

    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..

  • DJEloDJElo Posts: 7Members
    Accepted Answer

    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

  • videotecaCNSUvideotecaCNSU Posts: 368Validating, Plex Pass Plex Pass
    Accepted Answer

    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

    https://unix.stackexchange.com/questions/12075/best-way-to-follow-a-log-and-execute-a-command-when-some-text-appears-in-the-log

  • DJEloDJElo Posts: 7Members

    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 :)

  • videotecaCNSUvideotecaCNSU Posts: 368Validating, Plex Pass Plex Pass

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

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

Sign In or Register to comment.