pychromecast
pychromecast copied to clipboard
Calling an HDMI-CEC turn_off function
Hey,
I'm interested in using the Chromecast to turn off TVs via HomeAsssistant. I gather that there is an API function to simply turn on the device connected to the Chromecast, as HASS is able to send a simple turn_on command to the media_player, but as far as I can tell there is currently no turn_off function documented anywhere on pychromecast.
For some quick background, turning off a TV via Chromecast is a very new feature Google rolled out to the Google Assistant. It works on both Assistant for Android and physical assistants.
Before I go any further, my real question is does a public API function for HDMI-CEC turn_off exist, or may there be a better solution to turning off a TV via Chromecast possible through another Google API like gactions.
Thanks!
I don't believe Google documents much about auxiliary functions much past interacting with apps/content already playing. However, lots of people discovered the 'unofficial' API methods for rebooting the CC.
I'm playing with the URL/JSON payload needed to power off the device, similar to:
curl -H "Content-Type: application/json" -X POST http://{chromecast_ip}:8008/setup/reboot -d '{"params":"now"}'
Once we find the URL/JSON payload a method can be added to pychromecast, and then HASS can utilize the method.
After researching some packet captures, it looks like turning off the TV is done via the ongoing encrypted connection to Google. This sort of makes sense, the Google Assistant doesn't make a direct connection to the Chromecast as there are no open incoming ports behind the NAT connection. This is still WIP as I may have a few contacts I can reach out to.
What would be great, is if the Chromecast unit could turn TVs on via HDMI-CEC. There are many smart TVs that close off their API interfaces when on standby, making turn_on the one thing you can't do..
Now news by any chance @edwork ?
I didn't see anything that wasn't already being utilized here, but thought this might have some insight on the exposed API?
Any plans on this? I couldn't see a related thing there.