Receive HDMI-CEC commands for Volume Control

Hello Everyone,

Recently i bought a new TV, unfortunately this one can’t controll the volume of my Receiver via Infrared

But it has the option to send Volume Up/ Volume Down command via HDMI-CEC to the Receiver

BUT my receiver is to old :frowning:

So My idea is that HomeAssistant can receive these Signals and send it out via my IR-Bridge to the receiver

I found some events to listen to like hdmi_cec.cec_keypress_received but those don’t do anything

Does someone has an idea how this could be done ?

for anyone interested, the hardware is
Xiaomi Mi TV 4S 65" (EDIT: TV-Remote is BLUETOOTH-ONLY)
Yamaha RX-V365 (connected via Toslink to TV)
Raspberry Pi4 running HomeAssistant (connected via HDMI to TV)

Do you have the receiver as a media player in HA? (unsure about the specific model if it has Ethernet/wifi)

I already have the receiver in Homeassistant via custom_mediaplayer and different IR commands, i only need a way to pick up those HDMI signals from the TV to forward it to the mediaplayer

You can add a ESP with IR receiver to get the TV remotes codes and use HA to inject it to the media player.

I did that to make use of more buttons on the remote and have it to control the Chromecast and make the volume steps larger on the receiver. I don’t like the Yamaha way of pushing 10 times to make something happen…

forget to mention that the TV-Remote is Bluetooth-Only… :confused:

But it’s great idea to have larger volume steps and make use of the unused buttons :smiley:

You may already be passed this, but I explored seeing what commands were being sent around my CEC bus with a rpi, similar to this article and reference, but I found my LG TV did very poor job of CEC so tabled it fro a infrared solution:

https://www.cec-o-matic.com/index.php

I tryed listening to all HDMI CEC signals but there is no output when i press the Volume buttons
As far as i understand, you need to send some signals to advertise Audio Mode to the Television before it knows where to send those signals, but it’s all no that well explained online :confused:

Another possible way may be to just listen to the Remote using ADB or an Android-App because it is an Android TV, but i cannot find a way for this :frowning:

On some TV´s, you have to enable CEC, the name differs from brand to brand. Have you enabled CEC?

This can also be called smart link or other brand specific names

yes it’s all enabled, i can receive button up/down/left/right however i receive nothing about the volume buttons

I also tried to start cec-client with option -a (see log below)

Output of CEC-Client

== using device type ‘audio system’
CEC Parser created - libCEC version 4.0.4
no serial port given. trying autodetect:
path: Raspberry Pi
com port: RPI

opening a connection to the CEC adapter…
DEBUG: [ 274] Broadcast (F): osd name set to ‘Broadcast’
DEBUG: [ 275] logical address changed to Free use (e)
DEBUG: [ 278] Open - vc_cec initialised
NOTICE: [ 278] connection opened
DEBUG: [ 279] << Broadcast (F) -> TV (0): POLL
DEBUG: [ 279] processor thread started
DEBUG: [ 279] initiator ‘Broadcast’ is not supported by the CEC adapter. using ‘Free use’ instead
TRAFFIC: [ 280] << e0
DEBUG: [ 310] >> POLL sent
DEBUG: [ 310] TV (0): device status changed into ‘present’
DEBUG: [ 310] << requesting vendor ID of ‘TV’ (0)
TRAFFIC: [ 311] << e0:8c
TRAFFIC: [ 692] >> 0f:87:6d:74:6b
DEBUG: [ 692] TV (0): vendor = Unknown (6d746b)
DEBUG: [ 692] >> TV (0) -> Broadcast (F): device vendor id (87)
DEBUG: [ 693] expected response received (87: device vendor id)
NOTICE: [ 693] registering new CEC client - v4.0.4
DEBUG: [ 693] detecting logical address for type ‘audiosystem’
DEBUG: [ 693] trying logical address ‘Audio’
DEBUG: [ 693] << Audio (5) -> Audio (5): POLL
TRAFFIC: [ 693] << 55
TRAFFIC: [ 964] << 55
DEBUG: [ 1236] >> POLL not sent
DEBUG: [ 1236] using logical address ‘Audio’
DEBUG: [ 1236] Audio (5): device status changed into ‘handled by libCEC’
DEBUG: [ 1236] Audio (5): power status changed from ‘unknown’ to ‘on’
DEBUG: [ 1237] Audio (5): vendor = Pulse Eight (001582)
DEBUG: [ 1237] Audio (5): CEC version 1.4
DEBUG: [ 1237] AllocateLogicalAddresses - device ‘0’, type ‘audio system’, LA ‘5’
DEBUG: [ 1238] logical address changed to Audio (5)
DEBUG: [ 1238] Audio (5): osd name set to ‘CECTester’
DEBUG: [ 1238] Audio (5): menu language set to ‘eng’
DEBUG: [ 1239] GetPhysicalAddress - physical address = 0000
NOTICE: [ 1239] setting HDMI port to 1 on device TV (0)
DEBUG: [ 1239] Audio (5): physical address changed from ffff to 1000
DEBUG: [ 1239] << Audio (5) -> broadcast (F): physical address 1000
TRAFFIC: [ 1239] << 5f:84:10:00:05
NOTICE: [ 1451] CEC client registered: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Audio (5) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic … , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
DEBUG: [ 1451] << Audio (5) -> TV (0): OSD name ‘CECTester’
TRAFFIC: [ 1451] << 50:47:43:45:43:54:65:73:74:65:72
DEBUG: [ 1752] << requesting power status of ‘TV’ (0)
TRAFFIC: [ 1752] << 50:8f
TRAFFIC: [ 1883] >> 05:46
DEBUG: [ 1883] << Audio (5) -> TV (0): OSD name ‘CECTester’
TRAFFIC: [ 1883] << 50:47:43:45:43:54:65:73:74:65:72
DEBUG: [ 1883] >> TV (0) -> Audio (5): give osd name (46)
TRAFFIC: [ 2247] >> 05:8c
DEBUG: [ 2247] << Audio (5) -> TV (0): vendor id Pulse Eight (1582)
TRAFFIC: [ 2247] << 5f:87:00:15:82
DEBUG: [ 2247] >> TV (0) -> Audio (5): give device vendor id (8C)
TRAFFIC: [ 2547] >> 05:90:00
DEBUG: [ 2547] TV (0): power status changed from ‘unknown’ to ‘on’
DEBUG: [ 2547] >> TV (0) -> Audio (5): report power status (90)
DEBUG: [ 2547] expected response received (90: report power status)
waiting for input
TRAFFIC: [ 2644] >> 05:7d
DEBUG: [ 2644] << 5 -> 0: system audio mode ‘on’
TRAFFIC: [ 2644] << 50:7e:01
DEBUG: [ 2644] >> TV (0) -> Audio (5): give audio mode status (7D)
TRAFFIC: [ 2847] >> 05:70:00:00
DEBUG: [ 2847] making TV (0) the active source
DEBUG: [ 2847] << 5 -> 0: set system audio mode ‘7f’
TRAFFIC: [ 2847] << 50:72:01
DEBUG: [ 2847] >> TV (0) -> Audio (5): system audio mode request (70)
TRAFFIC: [ 3756] >> 05:a4:02:06:07:0a
DEBUG: [ 3756] sending abort with opcode a4 and reason ‘unrecognised opcode’ to TV
DEBUG: [ 3756] << transmitting abort message
TRAFFIC: [ 3756] << 50:00:a4:00
DEBUG: [ 3756] >> TV (0) -> Audio (5): UNKNOWN (A4)
TRAFFIC: [ 7848] >> 05:70:00:00
DEBUG: [ 7848] TV (0) was already marked as active source
DEBUG: [ 7848] << 5 -> 0: set system audio mode ‘7f’
TRAFFIC: [ 7848] << 50:72:01
DEBUG: [ 7848] >> TV (0) -> Audio (5): system audio mode request (70)
TRAFFIC: [ 8090] >> 05:a4:02:06:07:0a
DEBUG: [ 8090] sending abort with opcode a4 and reason ‘unrecognised opcode’ to TV
DEBUG: [ 8090] << transmitting abort message
TRAFFIC: [ 8090] << 50:00:a4:00
DEBUG: [ 8090] >> TV (0) -> Audio (5): UNKNOWN (A4)
TRAFFIC: [ 12840] >> 05:70:00:00
DEBUG: [ 12840] TV (0) was already marked as active source
DEBUG: [ 12840] << 5 -> 0: set system audio mode ‘7f’
TRAFFIC: [ 12840] << 50:72:01
DEBUG: [ 12840] >> TV (0) -> Audio (5): system audio mode request (70)
TRAFFIC: [ 13091] >> 05:a4:02:06:07:0a
DEBUG: [ 13091] sending abort with opcode a4 and reason ‘unrecognised opcode’ to TV
DEBUG: [ 13091] << transmitting abort message
TRAFFIC: [ 13091] << 50:00:a4:00
DEBUG: [ 13091] >> TV (0) -> Audio (5): UNKNOWN (A4)
^Csignal caught: 2 - exiting
DEBUG: [ 39498] unregistering all CEC clients
NOTICE: [ 39499] unregistering client: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Audio (5) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic … , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
DEBUG: [ 39499] Audio (5): power status changed from ‘on’ to ‘unknown’
DEBUG: [ 39499] Audio (5): vendor = Unknown (000000)
DEBUG: [ 39499] Audio (5): CEC version unknown
DEBUG: [ 39499] Audio (5): osd name set to ‘Audio’
DEBUG: [ 39499] Audio (5): device status changed into ‘unknown’
DEBUG: [ 39499] unregistering all CEC clients
DEBUG: [ 40284] UnregisterLogicalAddress - releasing previous logical address
DEBUG: [ 40286] logical address changed to Broadcast (f)

way beyond my paygrade, unfortunately you probably need someone’s input that does this CEC stuff for a paycheck.

It does look like some of the message as I put them into the CEC-Matic decoder web site I sent you a link to, do seem to imply that the TV and Receiver are some type of paired audio mode, but then some device starts to complain about opcodes…

You might try your test with the receiver disconnected from the cec hdmi network, and then wondering if this python script might show keystrokes flying around…

https://github.com/Pulse-Eight/libcec/blob/76551ea1dd9a55f0ce1533e440dc12dbc594f7ba/src/pyCecClient/pyCecClient.py

hope you don’t end up down the infrared route I had to go, not only is it frustrating that the AV devices are ‘kind of close’ to having a useful control network, but IR is far from solid.

Good hunting!

The range limit from IR comes most of the time from the circuit driving the IR led. Im using an IR diode directly attached to my ESP8266 and get a range of a couple centimeters, if i would use a proper led driving cricuit with a transistor it would get up to a few meters.
But the real “problem” is that IR devices are a one way loop, HA doesnt exactly know if the commands are executed properly.

I tried running the script but had no success, it says CEC not found
i tried compiling libcec but it didn’t work out…

The Receiver isn’t connected to the HDMI-Network, in fact the Receiver doesn’t even have HDMI-CEC
The Only Device with HDMI-CEC is the Raspberry PI, and this one should receive the signals from the TV

The only way to control the Yamaha Receiver is infrared, so an infrared solution would be fine
However the Remote from the Xiaomi-TV talks via BLUETOOTH, and i don’t think that i can listen to the bluetooth signal…

I also tryed installing Tasker on the TV itself, but the Remote Volume Buttons are not counted as normal ones

Thanks, I understand the layout better now. Frustrating! This mirrors my AV experiences, part that get almost there… I see some folks have figured out some of the api for some versions of the TV but looks like input commands only, but maybe there are something yet to be discovered in the api
Good hunting!

https://github.com/simse/pymitv
https://github.com/zhuorantan/homebridge-mitv/blob/0f5306b1503d6fb87107c9eb95ebbec8388796eb/src/tv.js

A workaround could be using an IR multi remote instead of the original one, program an esp8266 with an IR receiver to fire events for every key into HA and react to them to control both your TV and your receiver. I know, this is frustrating, but it avoids detective work. I can provide some codes for esphome and node-red how i did this:

code esphome
api:
  password: donthackmepls
  services: #for controlling the receiver
    - service: vol_up
      then:
        - remote_transmitter.transmit_nec:
           address: 0x1D00
           command: 0xD926
    - service: vol_down
      then:
        - remote_transmitter.transmit_nec:
            address: 0x1D00
            command: 0x59A6
          

     
    
 

remote_transmitter:
  pin: GPIO15
  # Infrared remotes use a 50% carrier signal
  carrier_duty_percent: 50%
  
remote_receiver:
  pin: 
    number: GPIO14
    inverted: true
  dump: all
  on_samsung:
    then:

    - homeassistant.event:
        event: esphome.Remote
        data_template: 
          value: !lambda "return x.data;"
 
node-red flow split-events
[{"id":"22e84c05.fe0b64","type":"tab","label":"RemoteCodesToEvents","disabled":false,"info":""},{"id":"b25c95cf.15a7f8","type":"server-events","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event_type":"esphome.Remote","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":110,"y":100,"wires":[["5670c130.b572d"]]},{"id":"5670c130.b572d","type":"switch","z":"22e84c05.fe0b64","name":"","property":"payload.event.value","propertyType":"msg","rules":[{"t":"eq","v":"3772810873","vt":"str"},{"t":"eq","v":"3772819033","vt":"str"},{"t":"eq","v":"3772794553","vt":"str"},{"t":"eq","v":"3772778233","vt":"str"},{"t":"eq","v":"3772782313","vt":"str"},{"t":"eq","v":"3772833823","vt":"str"},{"t":"eq","v":"3772829743","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":8,"x":300,"y":120,"wires":[["1f29ed54.507aeb"],["5739ac15.28bf5c"],["da90bb59.8d5048"],["db8ed98e.956728"],["71177700.d8f02"],["cc7185d4.7e3cd8"],["e5288ee2.eb0d68"],["4101df31.f466d"]]},{"id":"30eebac5.47771e","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"4ef35426.cb7c7c","event":"remote.down","data":"","dataType":"json","x":940,"y":20,"wires":[[]]},{"id":"487f56f.e2404a8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.left","data":"","dataType":"json","x":1130,"y":60,"wires":[[]]},{"id":"7702a337.3eb31c","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.right","data":"","dataType":"json","x":870,"y":100,"wires":[[]]},{"id":"ee1463f3.6cb9c8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.up","data":"","dataType":"json","x":1270,"y":140,"wires":[[]]},{"id":"109fe954.615c7f","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.ok","data":"","dataType":"json","x":930,"y":180,"wires":[[]]},{"id":"27cd08a2.18aba","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.vol_up","data":"","dataType":"json","x":1100,"y":220,"wires":[[]]},{"id":"4c580669.88b958","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.vol_down","data":"","dataType":"json","x":890,"y":260,"wires":[[]]},{"id":"1f29ed54.507aeb","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":20,"wires":[["dc03733a.84f528"]]},{"id":"5739ac15.28bf5c","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":60,"wires":[["b83ea568.ce198"]]},{"id":"db8ed98e.956728","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":140,"wires":[["f7a50cd2.b8f42"]]},{"id":"71177700.d8f02","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":180,"wires":[["4fed1091.108a58"]]},{"id":"cc7185d4.7e3cd8","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":220,"wires":[["27cd08a2.18aba"]]},{"id":"da90bb59.8d5048","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":100,"wires":[["c317413e.545e58"]]},{"id":"e5288ee2.eb0d68","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":260,"wires":[["4c580669.88b958"]]},{"id":"4101df31.f466d","type":"switch","z":"22e84c05.fe0b64","name":"","property":"payload.event.value","propertyType":"msg","rules":[{"t":"eq","v":"3772784863","vt":"str"},{"t":"eq","v":"3772817503","vt":"str"},{"t":"eq","v":"3772801183","vt":"str"},{"t":"eq","v":"3772780783","vt":"str"},{"t":"eq","v":"3772813423","vt":"str"},{"t":"eq","v":"3772797103","vt":"str"},{"t":"eq","v":"3772788943","vt":"str"},{"t":"eq","v":"3772821583","vt":"str"},{"t":"eq","v":"3772805263","vt":"str"},{"t":"eq","v":"3772811383","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":11,"x":300,"y":440,"wires":[["c60fd2fc.d76468"],["65b4187b.dbf81"],["2ea12959.466246"],["87af6389.c4abc"],["318cfc7.ba6c404"],["13948aa8.eaa735"],["32682e7a.2f032a"],["f204507f.3ad82"],["eb756953.1f4478"],["3432ae96.da3502"],["ae3bbf31.c4402"]]},{"id":"c60fd2fc.d76468","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":320,"wires":[["e0b6f4fe.82ad5"]]},{"id":"65b4187b.dbf81","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":360,"wires":[["1ffe0cee.c37ed3"]]},{"id":"2ea12959.466246","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":400,"wires":[["be0da9e5.22f1d"]]},{"id":"87af6389.c4abc","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":440,"wires":[["28ca99e6.395b2e"]]},{"id":"318cfc7.ba6c404","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":480,"wires":[["a4806c89.4ee9e8"]]},{"id":"13948aa8.eaa735","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":520,"wires":[["3da45379.327b6c"]]},{"id":"32682e7a.2f032a","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":560,"wires":[["d6ad661e.e5d938"]]},{"id":"f204507f.3ad82","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":600,"wires":[["dcca3cda.048bf"]]},{"id":"eb756953.1f4478","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":640,"wires":[["f4d010d5.c82d9"]]},{"id":"3432ae96.da3502","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":680,"wires":[["b47af573.b5c538"]]},{"id":"e0b6f4fe.82ad5","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.1","data":"","dataType":"json","x":640,"y":320,"wires":[[]]},{"id":"1ffe0cee.c37ed3","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.2","data":"","dataType":"json","x":680,"y":360,"wires":[[]]},{"id":"be0da9e5.22f1d","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.3","data":"","dataType":"json","x":700,"y":400,"wires":[[]]},{"id":"28ca99e6.395b2e","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.4","data":"","dataType":"json","x":740,"y":440,"wires":[[]]},{"id":"a4806c89.4ee9e8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.5","data":"","dataType":"json","x":760,"y":480,"wires":[[]]},{"id":"3da45379.327b6c","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.6","data":"","dataType":"json","x":780,"y":520,"wires":[[]]},{"id":"d6ad661e.e5d938","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.7","data":"","dataType":"json","x":800,"y":560,"wires":[[]]},{"id":"dcca3cda.048bf","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.8","data":"","dataType":"json","x":840,"y":600,"wires":[[]]},{"id":"f4d010d5.c82d9","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.9","data":"","dataType":"json","x":840,"y":640,"wires":[[]]},{"id":"b47af573.b5c538","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.0","data":"","dataType":"json","x":860,"y":680,"wires":[[]]},{"id":"ae3bbf31.c4402","type":"switch","z":"22e84c05.fe0b64","name":"","property":"payload.event.value","propertyType":"msg","rules":[{"t":"eq","v":"3772793023","vt":"str"},{"t":"eq","v":"3772809343","vt":"str"},{"t":"eq","v":"3772799143","vt":"str"},{"t":"eq","v":"3772838413","vt":"str"},{"t":"eq","v":"3772808323","vt":"str"},{"t":"eq","v":"3772822603","vt":"str"},{"t":"eq","v":"3772839943","vt":"str"},{"t":"eq","v":"3772790473","vt":"str"},{"t":"eq","v":"3772786903","vt":"str"},{"t":"eq","v":"3772819543","vt":"str"},{"t":"eq","v":"3772803223","vt":"str"}],"checkall":"true","repair":false,"outputs":11,"x":340,"y":880,"wires":[["bf0e8087.e9af"],["f87fec35.abe098"],["f459dcba.576a6"],["d920c253.c1799"],["b9abcedc.19783"],["a911c3a4.f6a18"],["2270e471.5b42bc"],["29d9363c.e365aa"],["3f9dc702.f21c98"],["f4b07e74.0961f8"],["e6d6f01.094a41"]]},{"id":"bf0e8087.e9af","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":760,"wires":[["39e4d513.e96f2a"]]},{"id":"f87fec35.abe098","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":800,"wires":[["78b3613a.f6653"]]},{"id":"f459dcba.576a6","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":840,"wires":[["a4cd2784.ba4948"]]},{"id":"d920c253.c1799","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":880,"wires":[["e5459be.17568e8"]]},{"id":"b9abcedc.19783","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":920,"wires":[["9eae0db6.8cbba8"]]},{"id":"a911c3a4.f6a18","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":960,"wires":[["f1af4691.c078c8"]]},{"id":"2270e471.5b42bc","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1000,"wires":[["3a368fe0.0adff8"]]},{"id":"29d9363c.e365aa","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1040,"wires":[["11416ff1.a937c"]]},{"id":"3f9dc702.f21c98","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":1080,"wires":[["885bd3b.b0d5db"]]},{"id":"f4b07e74.0961f8","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":1120,"wires":[["2daf5775.1522b"]]},{"id":"39e4d513.e96f2a","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.power","data":"","dataType":"json","x":700,"y":760,"wires":[[]]},{"id":"78b3613a.f6653","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.av","data":"","dataType":"json","x":770,"y":800,"wires":[[]]},{"id":"a4cd2784.ba4948","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.menu","data":"","dataType":"json","x":760,"y":840,"wires":[[]]},{"id":"e5459be.17568e8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.guide","data":"","dataType":"json","x":800,"y":880,"wires":[[]]},{"id":"9eae0db6.8cbba8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.screen","data":"","dataType":"json","x":820,"y":920,"wires":[[]]},{"id":"f1af4691.c078c8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.exit","data":"","dataType":"json","x":830,"y":960,"wires":[[]]},{"id":"3a368fe0.0adff8","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.info","data":"","dataType":"json","x":850,"y":1000,"wires":[[]]},{"id":"11416ff1.a937c","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.red","data":"","dataType":"json","x":890,"y":1040,"wires":[[]]},{"id":"885bd3b.b0d5db","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.green","data":"","dataType":"json","x":900,"y":1080,"wires":[[]]},{"id":"2daf5775.1522b","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.yellow","data":"","dataType":"json","x":920,"y":1120,"wires":[[]]},{"id":"4a3f8b70.bb057c","type":"ha-fire-event","z":"22e84c05.fe0b64","name":"","server":"e0fa7932.da39f8","event":"remote.blue","data":"","dataType":"json","x":830,"y":1200,"wires":[[]]},{"id":"e6d6f01.094a41","type":"change","z":"22e84c05.fe0b64","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1200,"wires":[["4a3f8b70.bb057c"]]},{"id":"f7a50cd2.b8f42","type":"delay","z":"22e84c05.fe0b64","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1030,"y":140,"wires":[["ee1463f3.6cb9c8"]]},{"id":"c317413e.545e58","type":"delay","z":"22e84c05.fe0b64","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":690,"y":100,"wires":[["7702a337.3eb31c"]]},{"id":"dc03733a.84f528","type":"delay","z":"22e84c05.fe0b64","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":730,"y":20,"wires":[["30eebac5.47771e"]]},{"id":"b83ea568.ce198","type":"delay","z":"22e84c05.fe0b64","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":620,"y":60,"wires":[["487f56f.e2404a8"]]},{"id":"4fed1091.108a58","type":"delay","z":"22e84c05.fe0b64","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":750,"y":180,"wires":[["109fe954.615c7f"]]},{"id":"e0fa7932.da39f8","type":"server","name":"Home Assistant","addon":true},{"id":"4ef35426.cb7c7c","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Then, you can react to these events to trigger HA services and thus, control your TV.

Hey I actually did this exactly for my Sony X900H TV and Vizio sound bar.
The way I have it set up is this:
TV --(HDMI)–> RPi --(USB)–> Arduino nano --(simple FET amp)–> IR LED–>Vizio soundbar

  • Sony TV sends CEC to RPi (Volume up, volume down, power, mute keys are forwarded, among others)
  • RPi is running node red, listening as an audio reciever
  • When node red receives a key press, it sends the appropriate keypress over IR to the soundbar
  • One weird part - there is no (easy) way to get volume level feedback from the soundbar, so node-red tells the TV that the volume is set at “30” no matter what. The relative controls work, but the TV always says the volume is at “30”

I just migrated to HA from home bridge, so I’m in the process of re-setting things. I can share my code and Arduino firmware tomorrow. The whole set-up should be easy to replicate using the same firmware and hardware, just need to find the right IR codes for your sound system. I even made a little 3D printed enclosure for the Arduino!

That Sounds nice
Can you explain how you did the NodeRed-CEC part ?

EDIT: This won’t work in home assistant OS
Sure! I just created a GitHub repo for the project. You can see it here: https://github.com/dalovering/CEC2IR

To get it set up:

You’ll need to adapt for your sound bar’s IR codes and IR blaster - I’m using a simple blaster I made with an Arduino (you can find the Arduino sketch in my GitHub repo - working on uploading some photos, schematic, and 3D printed case)

EDIT: updated after talking to the node-RED addon developer

This configuration was working before I migrated to home assistant. With home assistant OS its unlikely to be able to work, since the node red add on for HASS runs in its own container and may not even have hardware device access.

I’m migrating my install to raspbian + HASS container and will manually install node-red either in a container or natively in raspbian to resolve this issue.

I was able to CEC → IR working for my TCL 635 but I had to pretend to be an HDMI-ARC device before the TCL tv would send CEC volume commands. I’ve documented my process here: CEC volume control for IR devices by pretending to be an HDMI ARC device

2 Likes