esphome: name: hdmi-cec-onkyo-ri-bridge name_add_mac_suffix: true friendly_name: "HDMI-CEC to Onkyo RI Bridge" esp32: #board: esp32thing_plus # SparkFun ESP32 Thing Plus / WROOM (Micro-B) / WRL-15663 board: esp32-s3-devkitc-1 # Seeed Studio XIAO ESP32S3 framework: type: arduino # Enable logging logger: # Enable Home Assistant API api: encryption: # Key can be generated with: echo -n `pwgen -n 32 1` | openssl base64 key: !secret api_encryption_key services: # Allows Home Assistant to send messages via CEC - service: hdmi_cec_send variables: cec_destination: int cec_data: int[] then: - hdmi_cec.send: destination: !lambda "return static_cast(cec_destination);" data: !lambda "std::vector charVector; for (int i : cec_data) { charVector.push_back(static_cast(i)); } return charVector;" ota: - platform: esphome password: !secret ota_password wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails # https://esphome.io/components/wifi#access-point-mode #ap: #ssid: "Hdmi-Cec-Test Fallback Hotspot" #password: "4P2PlPPPoXwM" # Enable the captive portal for WiFi configuration should the fallback hotspot become enabled # https://esphome.io/components/captive_portal.html #captive_portal: # Enable the web server component # https://esphome.io/components/web_server.html #web_server: #port: 80 #local: true external_components: # Add the HDMI-CEC stuff for ESPHome - source: github://Palakis/esphome-hdmi-cec # Add PR7117, which is my changes to add Onkyo RI. Had not been merged as of 2024-Sep-01. - source: github://pr#7117 components: - remote_base hdmi_cec: #pin: GPIO16 # SparkFun ESP32 Thing Plus / WROOM (Micro-B) / WRL-15663 pin: GPIO3 # Seeed Studio XIAO ESP32S3 address: 0xE physical_address: 0x3000 # HDMI 3 promiscuous_mode: false monitor_mode: false on_message: - opcode: 0x36 # Standby then: - event.trigger: id: cec_standby event_type: "cec_standby" - remote_transmitter.transmit_onkyori: data: 0xDA - logger.log: "HDMI-CEC Standby (0x36) received, sending RI Power Off (0xDA)" - opcode: 0x90 # Report Power Status, sent when devices are waking then: - event.trigger: id: cec_report_power_status event_type: "cec_report_power_status" - remote_transmitter.transmit_onkyori: data: 0xD9 - logger.log: "HDMI-CEC Report Power Status (0x90) Received, sending RI Power On (0xD9)" remote_transmitter: #pin: GPIO17 # SparkFun ESP32 Thing Plus / WROOM (Micro-B) / WRL-15663 pin: GPIO1 # Seeed Studio XIAO ESP32S3 carrier_duty_percent: 100% event: - platform: template name: HDMI-CEC Report Power Status id: cec_report_power_status icon: "mdi:power-on" event_types: - "cec_report_power_status" on_event: then: - logger.log: "HDMI-CEC Report Power Status (0x90) Event Received" - platform: template name: HDMI-CEC Standby id: cec_standby icon: "mdi:power-standby" event_types: - "cec_standby" on_event: then: - logger.log: "HDMI-CEC Standby (0x36) Event Received" button: # HDMI-CEC Commands - platform: template name: "HDMI-CEC: Broadcast Standby" icon: "mdi:power-on" on_press: hdmi_cec.send: destination: 0xF # Broadcast data: [0x36] # "Standby" opcode - platform: template name: "HDMI-CEC: Broadcast Power Status - EF:90:00 [DEV]" icon: "mdi:power-off" on_press: hdmi_cec.send: destination: 0xF # Broadcast data: [0x90,0x00] # "Report power status" - platform: template name: "HDMI-CEC: Broadcast Power Status - EF:90:01 [DEV]" icon: "mdi:power-off" on_press: hdmi_cec.send: destination: 0xF # Broadcast data: [0x90,0x01] # "Report power status" # Onkyo A-9050 Commands - platform: template name: "Onkyo RI: On" icon: "mdi:power-on" on_press: - remote_transmitter.transmit_onkyori: data: 0xD9 - platform: template name: "Onkyo RI: Off" icon: "mdi:power-off" on_press: - remote_transmitter.transmit_onkyori: data: 0xDA - platform: template name: "Onkyo RI: Toggle On/Off" icon: "mdi:power" on_press: - remote_transmitter.transmit_onkyori: data: 0x4 - platform: template name: "Onkyo RI: Mute" icon: "mdi:volume-low" on_press: - remote_transmitter.transmit_onkyori: data: 0xD7 - platform: template name: "Onkyo RI: Unmute" icon: "mdi:volume-high" on_press: - remote_transmitter.transmit_onkyori: data: 0xD8 - platform: template name: "Onkyo RI: Toggle Mute" icon: "mdi:volume-mute" on_press: - remote_transmitter.transmit_onkyori: data: 0x5 - platform: template name: "Onkyo RI: Volume Up" icon: "mdi:volume-plus" on_press: - remote_transmitter.transmit_onkyori: data: 0x2 - platform: template name: "Onkyo RI: Volume Down" icon: "mdi:volume-minus" on_press: - remote_transmitter.transmit_onkyori: data: 0x3 - platform: template name: "Onkyo RI: Next Input" icon: "mdi:chevron-right-box" on_press: - remote_transmitter.transmit_onkyori: data: 0xD5 - platform: template name: "Onkyo RI: Previous Input" icon: "mdi:chevron-left-box" on_press: - remote_transmitter.transmit_onkyori: data: 0xD6 - platform: template name: "Onkyo RI: Input D1" icon: "mdi:numeric-1-box-outline" on_press: - remote_transmitter.transmit_onkyori: data: 0x20 - platform: template name: "Onkyo RI: Input D2" icon: "mdi:numeric-2-box-outline" on_press: - remote_transmitter.transmit_onkyori: data: 0xE0 - platform: template name: "Onkyo RI: Input D3" icon: "mdi:numeric-3-box-outline" on_press: - remote_transmitter.transmit_onkyori: data: 0x170