I have the HDMI-CEC component activated and it works just fine. The docs don’t show any sensors in realtion to that so I thought it just wasn’t implemented. Then I noticed that the HA Log does in fact show when the TV is being turned on:
Now my questions is: Can I monitor this with a sensor? I haven’t found any entities that I could target. There doesn’t seem to be any enity called [0x4d544b TV] that I can see in Dev Tools. But something has to be there writing to the log, so possible I could intercept that and set a variable / input_boolean sensor?
Right now I monitor the source of the Sonos Beam - when this changes to TV I run my TV automations, but this lags a bit as the TV needs to turn on, send sound, Beam has to react, etc. Also I haven’t found a way to detect TV off (as Sonos lags ~10min before changing the source back) so this would be great.
Thanks! Problem is I run Hassio which does not seem to have the cec-client installed but uses something else? At least when I SSH into the HASS instance I can’t use the command.
Also: It appears to be already visible to HA as it turns up in the Logbook? Shouldn’t it be possible to somehow monitor that and react on it?
Just FYI should anybody else find this topic with the same question - the on/off state of an HDMI device does not need to be checked anymore using command_line - the event stream showed that the entity used is switch.hdmi_X with X being the device number in the HDMI chain. You can use the state of this entity for automations.
Hi sorry for bumping may I know how did you accomplish it now? for some reason I could not use the other method as it keeps changing my picture mode. Would really like to know how to get the state of the cec switch without using ‘pow 0’
Just FYI should anybody else find this topic with the same question - the on/off state of an HDMI device does not need to be checked anymore using command_line - the event stream showed that the entity used is switch.hdmi_X with X being the device number in the HDMI chain. You can use the state of this entity for automations.
Hi thanks for the reply, I need further clarification on the solution. Do you mean that we only need command_on and command_off? I have done that but it works only if you use Home asst to turn on and off the device. if you use another remote to power toggle the state will not be registered in home asst
In that case the HDMI-CEC integration is not working for you - for me when I turn off the TV using the remote, the switch.hdmi entity changes to off in a matter of 5-30 seconds.
Once you setup the HDMI-CEC integration a sensor in the hdmi domain is being created for every device that has been found. To detect devices a full reboot of the host system with the HDMI device(s) connected with at least the “core” device (most likely TV) being turned on is necessary.
I did not get it to work with HA Blue, but seen something on the HAOS updates that CEC was now supported for the Odroid N2+ platform. Haven’t tried it yet…