pychromecast icon indicating copy to clipboard operation
pychromecast copied to clipboard

Calling an HDMI-CEC turn_off function

Open ghost opened this issue 8 years ago • 6 comments

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!

ghost avatar Nov 16 '17 20:11 ghost

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.

edwork avatar Nov 20 '17 00:11 edwork

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.

edwork avatar Nov 21 '17 19:11 edwork

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..

mattpurnell avatar Jun 27 '18 03:06 mattpurnell

Now news by any chance @edwork ?

Jeroendeeerste avatar Aug 16 '18 07:08 Jeroendeeerste

I didn't see anything that wasn't already being utilized here, but thought this might have some insight on the exposed API?

jproctor10 avatar Jan 19 '19 06:01 jproctor10

Any plans on this? I couldn't see a related thing there.

KTibow avatar Jun 04 '20 20:06 KTibow