# v1.2.0 # Unlike previous versions, this one does not send any Onkyo RI commands on its own. # This version is intended to be used with Home Assistant taking action based on # events received from ESPHome. esphome: name: hdmi-cec-onkyo-ri-bridge name_add_mac_suffix: true friendly_name: "HDMI-CEC to Onkyo RI Bridge" #comment: "Configured for Onkyo A-9050 and SparkFun ESP32 Thing Plus" comment: "Configured for Onkyo A-9050 and Seeed Studio XIAO ESP32S3" project: name: "svigneau.hdmi-cec-onkyo-ri-bridge" version: "1.2.0" 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: 0xF physical_address: 0x3000 # HDMI 3 promiscuous_mode: false monitor_mode: false on_message: - opcode: 0x36 # Standby Command then: - event.trigger: id: cec_standby event_type: cec_standby - data: [0x90,0x00] # Report Power Status: On then: - event.trigger: id: cec_report_power_status_on event_type: cec_report_power_status_on - data: [0x90,0x01] # Report Power Status: Sleeping then: - event.trigger: id: cec_report_power_status_standby event_type: cec_report_power_status_standby 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: On" id: cec_report_power_status_on icon: "mdi:power-on" event_types: - "cec_report_power_status_on" on_event: then: - logger.log: "HDMI-CEC: Report Power Status: On (0x90,0x00) Received" # - logger.log: "Onkyo RI: Sending Power On (0xD9)" # - remote_transmitter.transmit_onkyori: # data: 0xD9 - platform: template name: "HDMI-CEC: Report Power Status: Standby" id: cec_report_power_status_standby icon: "mdi:power-standby" event_types: - "cec_report_power_status_standby" on_event: then: - logger.log: "HDMI-CEC: Report Power Status: Standby (0x90,0x01) Received" # - logger.log: "Onkyo RI: Sending Power Off (0xDA)" # - remote_transmitter.transmit_onkyori: # data: 0xDA - platform: template name: "HDMI-CEC: Standby Command" id: cec_standby icon: "mdi:power-standby" event_types: - "cec_standby" on_event: then: - logger.log: "HDMI-CEC: Standby Command (0x36) Command 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