I'm testing this now on an ESP32 with a Sony TV.
The code in the PR doesn't work, but the code in the parent repo at github://johnboiles/esphome-hdmi-cec@main works nicely while the TV is on. I had to extend the example with:
- opcode: 0x9F # Give CEC version
then:
- hdmi_cec.send:
destination: 0x0
data: [0x9e, 0x00]
for the Sony to discover the ESPHome device as an audio unit.
I also try to know of the TV is on or off, and this works:
button:
- platform: template
name: "Get power state"
on_press:
- logger.log: Querying powr state
- hdmi_cec.send:
destination: 0x0
data: [0x8F]
binary_sensor:
- platform: template
id: tv_power
name: "TV Power"
device_class: power
hdmi_cec:
...
on_message:
- data: [0x90, 0x00] # Power status: On
then:
- logger.log: "Power state On"
- binary_sensor.template.publish:
id: tv_power
state: ON
- data: [0x90, 0x01] # Power status: Standby
then:
- logger.log: "Power state Standby"
- binary_sensor.template.publish:
id: tv_power
state: OFF
- data: [0x90, 0x02] # Power status: Standby > On
then:
- logger.log: "Power state Standby > On"
- binary_sensor.template.publish:
id: tv_power
state: ON
- data: [0x90, 0x03] # Power status: On > Standby
then:
- logger.log: "Power state On > Standby"
- binary_sensor.template.publish:
id: tv_power
state: OFF
Turning the TV off or on while the node is connected, reboots the node:
It's not related to the 5V connected to pin 18. It happens regardless of this pin being connected or not (actually, the device detects the ESPHome well without the 5V being connected to pin 18).
I observed that the last CEC message decoded in the log before the reboot was either 0F:36 or 0F:84:00:00:00 or 0F:80:00:00:30:00. These seem to be broadcast messages.
Edit: tested with another TV ser, issue is exactly the same. The node reboots when 0F:32:68:75:6E comes in from TV.
I'm testing this now on an ESP32 with a Sony TV. The code in the PR doesn't work, but the code in the parent repo at
github://johnboiles/esphome-hdmi-cec@main
works nicely while the TV is on. I had to extend the example with:for the Sony to discover the ESPHome device as an audio unit.
I also try to know of the TV is on or off, and this works:
Turning the TV off or on while the node is connected, reboots the node:
It's not related to the 5V connected to pin 18. It happens regardless of this pin being connected or not (actually, the device detects the ESPHome well without the 5V being connected to pin 18).
I observed that the last CEC message decoded in the log before the reboot was either
0F:36
or0F:84:00:00:00
or0F:80:00:00:30:00
. These seem to be broadcast messages.Edit: tested with another TV ser, issue is exactly the same. The node reboots when
0F:32:68:75:6E
comes in from TV.