Sign inSign up

ingemars/mqtt-audio-controller

By ingemars

Updated 11 months ago

Control your amplifier using Android TV remote using HDMI CEC

Image
0

2.0K

ingemars/mqtt-audio-controller repository overview

RPI Soundbar - HDMI CEC MQTT bridge with ARC support

Allows controlling volume of your legacy amplifier with TV's physical or soft remote (Android TV and during casting).

Audio is taken from TV using typical optical or coax link and sent to amplifier, while control commands are read from HDMI CEC. On my Philips TV, if TV's builtin speakers are disabled there are no keypress commands sent over HDMI-CEC. This container image solves this by imitating HDMI sound system (a soundbar), that connects to TV using single HDMI cable. TV has to be configured to use a HDMI sound system and Raspberry PI must be connected to HDMI port supporting HDMI ARC.

Toslink audio output typically remains active whatever the configuration on TV allowing amplifier to function, while Raspberry Pi reads control signals and remote keypresses from HDMI cable using CEC protocol.

This runs as docker container on Raspberry Pi and uses a patched libcec to support ARC signalling protocol.

Requirements

  • Docker installed on Raspberry Pi
  • MQTT broker (like Mosquitto)

Starting up

Requires --privileged and --device /dev/mem:/dev/mem option to be able to work HDMI hardware.

docker run -d --privileged \
    --name mqtt-audio-controller \
    --device /dev/mem:/dev/mem \
    -e MQTT_BROKER="192.168.0.2" \
    -e MQTT_PORT="1883" \
    -e MQTT_PREFIX="media" \
    -e MQTT_USER="cec-mqtt" \
    -e MQTT_PASSWORD="strongpass" \
    -e CEC_ENABLED="1" \
    -e CEC_PORT="RPI" \
    -e CEC_DEVICES="0,8" \
    ingemars/mqtt-audio-controller > /dev/null
  • MQTT_BROKER - IP address / hostname of MQTT broker
  • MQTT_PORT - MQTT broker port, typically "1883"
  • MQTT_PREFIX - prefix for MQTT topic
  • MQTT_USER - MQTT password as registered with broker
  • MQTT_PASSWORD - MQTT password as registered with broker
  • CEC_ENABLED - set to "1" to enable CEC
  • CEC_PORT - HDMI port to use, "RPI" on Raspberry Pi
  • CEC_DEVICES - comma separated device IDs on CEC bus to query and report status

MQTT Topics

The bridge publishes to the following topics:

topicbodyremark
prefix/cec/idon / offReport power status of device with id id, where id 0 is TV.
prefix/cec/volumeuponNotify that volume UP was pressed.
prefix/cec/volumedownonNotify that volume DOWN was pressed.
prefix/cec/volumemuteonNotify that MUTE was pressed.

id is the address (0-15) of the device on the CEC-bus.

Tag summary

Content type

Image

Digest

Size

85.1 MB

Last updated

over 5 years ago

docker pull ingemars/mqtt-audio-controller