-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Home Assistant integration #3
Comments
Good idea, but I haven't delved into HA much yet. Might even be possible to implement much of this directly inside HA since it has pychromecast support built in, and CEC available as well I think. But I don't know how well it handles chromecast events for triggering actions. Feel free to contribute an HA integration if you have an idea on how to implement it. |
You know what I just realized I can probably do this using a simple home Assistant automation? How do you subscribe to state changes of Chromecast? If home Assistant also monitors the state in the same way setting up an automation to do this should be really easy |
But sending a power off command to the Chromecast doesn't turn off the TV. I guess I'd have to figure out how you send cec commands through the Chromecast and see if home Assistant supports it |
You'd need to send a CEC power command to the TV or receiver. It would look something vaguely like this:
You'd need to change the action to use CEC (see https://www.home-assistant.io/integrations/hdmi_cec/), and it would be useful to have a timeout. I'll have a play with it when I have a minute. |
OK; here's what I got kind of working in hass first up, I can't get the hdmi_cec integration to work, so I've gone for shell commands instead. You need to add your homeassistant user to the video group for this to work. In configuration.yaml add (replace 5 with the number of the device from running a cec-client scan):
Then add an automation such as:
This doesn't include a delay, and probably needs a little bit of logic to handle transitions a bit better, but works as a proof of concept. Should also work for volume, though will need some more work to determine if the volume is going up or down. Let us know if you come up with anything! |
The HDMI CEC in home Assistant is for sending CEC commands from the rpi or HA device to the TV over the HDMI port. I am a little confused, does your script send the CEC commands from the device running the script or does it remotely tell the Chromecast device to send a CEC command to it's connected tv? My HA device is not connected to the chromecasted TV so I can't send the command from the device, it needs to come from the Chromecast |
You need a Raspberry Pi (or other computer with CEC, such as a pulse-8 adapter) connected to your TV. The Chromecast only sends CEC commands that Google has blessed, which is the whole reason this project exists - to fill in the gaps in Google's implementation. But we can't control the Chromecast's CEC bus. To directly answer your question, this system sends CEC commands directly from the device the script runs on. |
Thank you for that clarification, I think I only realized all that after
iterating on the idea. Damnit Google.
|
This seems like a service that would be useful to run as a plug-in on the Home Assistant platform.
The text was updated successfully, but these errors were encountered: