Chromecast to cast specific media via a script

I’ve built a few actions for the Magic Cards project to cast my specificly chosen media to my chromecast by using pychromecast. For instance, you can make a card to

  • Launch a specific youtube video
  • Start a specific netflix program (This one uses adb remote control of a spare Android device)
  • Play a media URL which has to be first fetched via another API
  • Play a media URL on my DLNA server
  • With some tinkering, launch any simple chromecast app and play something!

Since I’d like to trigger these actions via Home Assistant as well, I’ve thought it makes no sense to integrate this into Magic Cards.

Would be a good idea to integrate this functionality into HAss or just make a separate project? This could also easily be just a service that listens to some events on a socket, which HAss and Magic Cards could both access. (The reason for a service is that the chromecast connection needs some keeping alive, otherwise there is a large delay for each action).

Here is the meat of my magic cards fork:

EDIT:

Also, to add, since some of the current actions use adb remote control, the project needs androidviewclient as a dependency. This is a pretty big one and could take a long time to build on some devices. Because of this I’m not confident it could be integrated to home assistant. I’m wondering if the dependency could be installed on a need-to basis?

1 Like