libcec integration with something like this:
Control your TV, Amplifier and/or Blu-ray Player from Kodi!
www.pulse-eight.com
So CEC volune up/down, mute and on+off from HDMI CEC to GLM.
I've also been wanting to integrate CEC, so all my physical remote controls (projector's remote, and Apple TV, Chromecast in my case) do the same thing, and control the same volume/mute: my Genelec's volume setting.
Your message reminded me that I still had a very old Pulse Eight CEC USB adapter lying around. It was from their very first batch of products I think, from when they were first introduced, ~2010 or so. It seems to be the same as the device they still sell today, although the firmware on it is likely older. It was a very cool solution at the time.
However, after playing around a bit with libcec this weekend, I've concluded I don't really want to build off of that. It seems the library interface is still not stable, even after 15 years. E.g. the version now used in Debian Trixie (and Raspbian) is 7.x, and looks to be breaking compatibility again with version 8.x in the future. PyCEC needed a fair bit of fiddling and manual compilation to get it to work. Nowadays there is also the independent cec-ctl from V4L which uses the kernel CEC drivers and IOCTL interface directly.
Because
espgensam is primarily meant to be used along with Home Assistant, a solution that gets CEC wired into Home Assistant would work (also to control Genelec through espgensam, or do anything else). But the existing
hdmi-cec integration in Home Assistant Core looks a bit dated and not following modern standards, and is based on PyCEC/libcec. It also doesn't look optimal for what I need here, i.e. listening to volume/mute control for the bus.
In my case, I actually had an old Raspberry Pi 2 running in the same cabinet as my HDMI devices. So one way of making this work was to simply connect its HDMI output into my HDMI switch or Projector input. Raspberry PIs have supported CEC control natively for a long time.
I decided to build a Python tool,
cec-audio-bridge, that would run on the RPi and interact with CEC through the Linux kernel's (stable) ioctl interface directly, and talk to Home Assistant over the Websockets API, avoiding a dependency on libcec. That seems to work great so far.
https://github.com/markbergsma/espgensam/tree/main/tools/cec_audio_bridge
What it does: The python script runs as a daemon, and announces itself as
the "Audio System" (A/V receiver, CEC logical address 5), under OSD name "Genelec". That means all other CEC devices send it volume control and mute messages, and report its volume level. The script then forwards that to a designated media_player entity in Home Assistant (e.g. espgensam's). It can optionally power on/off the Genelecs as well.
Although this works very well, and was essentially free in my case (I already had an RPi 2 running here), I don't think it's an ideal solution for everyone. Alternative options exist, most notably
https://github.com/Palakis/esphome-native-hdmi-cec which can also be used with
ready-made hardware, for less than the Pulse Eight adapter. It's likely also possible to make it work with a single microcontroller, integrated directly into HLM or espgensam.
Having my projector, media players along with their remote(s), my Genelec speakers and Home Assistant all integrated and working harmoniously together now is very nice.
