Hi All,
Would it be possible to further develop the HDMI_CEC plugin by allowing either a switch or input boolean, so that it would be possible to switch a device on using the Homebridge functionality. Currently, Homebridge only supports switch or input booleans and the input_select functionality from the HASS interface is iffy at best (ie One has to switch it off then on again to get a response)
It would also be cool to know the status of the HDMI device eg. On or Off
Thanks alot for the hard work, absolutely great product!
Regards,
Michael
I don’t ues the HDMI CEC component, but based on reading the docs and looking at the services it exposes, I think you could make a switch like:
switch hdmi_cec:
platform: template
turn_on:
service: hdmi_cec.power_on
turn_off:
service: hdmi_cec.standby
… actually, I got through writing that out, and realized that it needs a value_template
to know what the current state of the thing is, and I don’t see any sensors that would give you that. Maybe it could be hard-coded to off? It wouldn’t reflect the current value of the switch, but you would be able to control it in homebridge.
Instead of input_selects, you probably could just make one of those template switches per device you want, and use hdmi_cec.select_device
instead.
Ok thanks, how would one hard code it to off?
I’m unable to use the hdmi_cec.select_device function only hdmi_cec.power_on.
I’ve also tried using a value_template that fetches the power state of the TV using echo pow 0.0.0.0 | cec-client -s -d 1 | grep “power status” | sed ‘s/power status: //g’ but it always registers the TV as on and once run the HASS HDMI CEC component is totally unresponsive.
Hopefully there will be more development into this as the functionality is quite cool. One could create some seriously media based automations with it.
Thanks again
I’m also interested in adding my TV to Homebridge using hdmi cec. I just finished adding the functionality to turning on my tv with hdmi cec. Now I’m looking at adding it as a switch or something to turn on my tv with my iphone using homebridge/homekit.
Any updates? ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=9)
Hi there,
So, got this working using a template switch that uses my ambilight as the value_template. If the light is off I can switch the TV on using this method and since the light and TV work interchangeably the state of the light will always be on when the TV is on. ie I’d never have the light behind the TV on if the TV isn’t on. Below is my switch config. Just ensure that the HDMI_CEC component is running and working.
# HDMI #
- platform: template
switches:
tv:
value_template: "{{ is_state('light.ambilight', 'on') }}"
turn_on:
service: hdmi_cec.power_on
turn_off:
service: hdmi_cec.standby