CEC volume control of TV and AVR

  • Hi,

    this might be a topic for the Kodi Forum, but I have read more detailed technical CEC threads here, so I think this is the real home of CEC experts.

    I am running LE12 stable on a RPi 5.

    This is my HDMI setup:

    • The Pi is connected to my TV (LG G4)
    • The AVR (Yamaha) is connected to my TV as well
    • Sound is passed through from the Pi to the AVR using ARC

    This is the current CEC topology:

    Using the CEC Adapter add-on (Pulse-Eight) I can successfully control the volume of the AVR when it is on, although it seems like the add-on is sending the underlying CEC volume control message directly to the AVR. At least there is no OSD shown on the TV and I can't control the TV's volume when the AVR is turned off.

    This is the add-on's config:


    So my question is:

    Is it possible to have the CEC Adapter add-on send CEC volume control messages to the TV instead of the AVR?

  • Which remote control do you use?

    Normally CEC is intended to use the remote control o the TV (or an universal one) to control the other downstream devices via TV. Because the TV (HDMI sink) is the boss. It seems to me, that your TV has an issue to switch back to TV speaker mode or you must somethere enable it. Maybe a firmware update of the TV/AVR is needed to correct this, if it's not only a setting issue.
    The volume information up/down are send from TV to the AVR, not by the Pulse-Eight device. The Pulse-Eight device is in that case only a consumer.

    This may differ if you try to control KODI directly with a separate remote control. I never tried CEC in this direction, if that supported, besides some debug sessions with cec-client.

  • I am using an IR remote for the Pi and actually want it to be the boss ;)

    I might have found the culprit:

    From xbmc/peripherals/devices/PeripheralCecAdapter.cpp [Omega], line 499ff:

    with CECDEVICE_AUDIOSYSTEM = 5 from libcec's include/cectypes.h.

    So it is hardcoded in Kodi to always use the AVR as target, unfortunately. I wished the add-on used what is defined in <setting id="connected_device" value="36037"/>

    Any idea how to override this`? Do we need a pull request of someone fully understanding the code?

    Edited 4 times, last by MaxMustermann (June 21, 2024 at 9:04 PM).

  • Yes, I think we need a pull request. But you have made the first step in the right direction and pointing to the maybe problematic part. The most sources I found say "It will not work with a TV". Maybe they you use all KODI. ;)

    Can you please check if that work for you with the TV volume?

    echo volup | cec-client -s -b 0 -d 1

    echo voldown | cec-client -s -b 0 -d 1

    If yes, the sources I found until now, were wrong.

  • I am using cec-ctl for my scripts, so it would be

    cec-ctl --to 0 --user-control-pressed ui-cmd=0x41 and

    cec-ctl --to 0 --user-control-pressed ui-cmd=0x42

    Further commands I use:

    cec-ctl --to 5 --system-audio-mode-request phys-addr=0.0.0.0 to turn on the AVR and enable ARC

    cec-ctl --to 5 --standby to turn the AVR off

    cec-ctl --to 5 --give-audio-status to get the current volume of the AVR


    So, yes, it works.

  • I wished the add-on used what is defined in <setting id="connected_device" value="36037"/>

    As far as I know this setting in combination with cec_hdmi_port is to override the physical address. (But currently this also not persists, and is reset after a restart, because of libCECs auto-detection). It's not suitable for the volume device assigning.
    Would have to be an additional switch or some kind of dependency on the standby states of the TV and/or AVR.