How to effectively switch between TV and Projector?

In my understanding power state toggling is not possible via CEC and there is no such function in the standard, nor in libcec (just have look at the documentation of cec-client).

CECToggleState is a Kodi in-built function which I believe supposed to check the current power state of devices on the CEC bus and following that return the corresponding dedicated on/off commands. I.e. CECActivateSource if the devices on the CEC bus are powered down and CECStandby if the power on state is valid.

So I am not fully convinced about the TV is to blame. Are you sure?

according to the CEC 1.3a spec book

0x6B | Power Toggle Function | Toggles the device’s power state (On / Standby)

No, but I have read that it does work with some TV’s and doesn’t with others. As all CEC devices decide for themselves what commands they ignore, and what exactly they do with the ones they decide to respond to this is the logical conclusion I have come to. There may be a terminal command that works for your TV to provide that function, but afaik Kodi only has the three CEC commands that can be key-mapped. On my main system the toggle does not work with my TV, but the other two commands do.

Woops, I wasn’t aware of this. You’re right there!

…however, I don’t think libcec supports this and if I am right, then Kodi cannot utilize this function either. Subsequently I still think Kodi’s CECToggleState function works in the way I described: checking the current power state and issuing dedicated power on/off commands (I have very limited coding skills, but looking at the code also leads me towards this logic). I found a few reports in some forums describing the same - only power off and no power on.

I will try to find someone at Team Kodi who could look after that.

Probably it wouldn’t help me anyway, because it were putting all devices (including AVR) in standby in this case (while I only need to toggle the TV).

Well, it is possible to handle all that via a python script - checking power state and issue the right command via cec-client corresponding to the current state, but calling cec-client from script is really slow :frowning:

Since you have it almost completely working with ir it may make more sense to just add an ir repeater to the mix to take care of the screen blocking the signal problem.

No space for that. Flirc is about half centimeter from the screen :slight_smile:

If I am thinking IR (but I would’ve preferred CEC), I could actually try to add a second IR transmitter to control the screen so I can bring that up to unblock the signal from flirc to the projector.

Or, as the screen can be controller both RF and IR, an RF transmitter would be even better, but I don’t think such universal/ teachable RF transmitter exists, is it?

I’ve not played with rf but the ir repeater I was thinking of was just something like this…

Thanks for tips @darwindesign :slight_smile:

1 Like

Still battling with this. Turned out that the screen remote has a special ir signal/ range that neither flirc, nor my ms mce receiver cannot learn :sweat_smile:

I am now trying to look for some kind of a (potentially USB) device which would enable the Vero 4k to control the screen via the controller’s 12V trigger. Would you have any experience/ idea in this?

Nope, sorry.

I solved this!

One button switching between projector and TV (…and vice versa) is working now on the way how I wanted.

A single longpress on osmc remote executes a python script from within Kodi which does the following when switching from TV to Projector:

  • Turns off the TV via HDMI CEC (I had to use the command line cec-client, because there is no internal Kodi command controlling only the display)
  • Switch the HDMI output on the AVR from HDMI1 (connected to the TV) to HDMI2 (connected to the Projector) by executing the switch command via http API available in my Denon AVR
  • I set the AVR to trigger its 12v trigger out when using only HDMI2
  • Projector screen comes down automatically when detecting the 12v on its 12v trigger in (I had to build a custom cable to connect the screen controller to the AVR - RJ10 on one end and jack plug on the other end)
  • Turning on the Projector via infrared using a Flirc adapter - yes, I can confirm the the IR transmitter is working (although it is a bit weak) - thanks again for the tip to @fzinken

In case someone would like to solve this, but his/ her AVR has no http api or 12v trigger out, then 12v triggering can be resolved by using a Sonoff SV (very cheap) or a Shelly 1.

…working perfectly!
Now I am in the process of buying some Shelly 1 Relay in order to control the lights in the room as well during the switch :wink:

2 Likes