Determine TV state

  • Hi

    I'm using Libreelec on a RPi3.
    My TV backend (TVHeadend) is running on my HTPC.
    Therefore my RPi connetcs to the HTPC to watch TV.
    Due the fact that the HTPC is not turned on all the time, I would like to do the following:

    When I turn on my Philips TV, which is connected to the RPI, Libreelec should recognize this and turn on the HTPC via WoL.
    Scripting this is no problem, but I wasn't able to find a file where I could find the TV connection state.
    Something like connected/disconnected or on/off.
    Additionally this state should also turn to the opposite when I turn off the TV.

    If I could find a file which offers this information. I could run a cronjob for that.

    Thanks in advance for help.

  • Some TVs will assert hotplug when powered on and deassert it when powered off (but some leave it always asserted).
    Run "tvservice -s" (e.g. from ssh) with TV powered and unpowered and check if the number after "state" changes.

    If that doesn't work you may be able to monitor events. Run "tvservice -M" and then power off and on. Does it report anything?