Open execcr opened 3 years ago
Today i spend some time to look if this is possible. The binding uses this library for Chromecast: https://github.com/vitalidze/chromecast-java-api-v2 I managed to make the AppId channel writable. If you send an AppId to the channel, the app gets started. But unfortunately, you can only write appId's and i have not yet found a way to grab a list of installed apps from the chromecast. Only when you have this list it would be user friendly.
Perhaps this could be parsed and used: https://clients3.google.com/cast/chromecast/device/baseconfig. Although bundling a file like this could turn into a maintenance nightmare. Perhaps documentation could be updated to describe how to simply obtain appId's of interest (i.e. start the app and watch the linked item being updated)?
First i though about a hybrid solution. Then you would have the json list as default and in case the app is not listed, some documentation on how to do that. But then i realised this list is HUGE and openHAB doesn't really support a searchable picklist or some default widget that can cope that list. So it would be better to have a list of just the used/installed programs. We could provide a link to this list in the documentaiton, atleast it is a (small) step forward.
wdyt?
@jlaur looking at replacing su.litvak.chromecast.api.v2
for org.digitalmediaserver.cast
as the current lib doesn't look to be maintained anymore and the new lib is a fork of the first.
Before i do some actual work on the binding, would replacing it be an option? It is available in maven repo, so i allready added it in mij dev environment to play with it. It is not a complete drop-in replacement, but it isn't to far off.
Implementing that fork wasn't that difficult and it does have some benefits. Unfortunately it does not offer a list of installed apps. It seems the API just does not support this.
There are some options:
My personal preference would go to 4. as that would be the best user experience and maintainable. @jlaur wdyt?
Technically it would be some StorageStorageService
in the ChromecastHandlerFactory
Created a solution with option 4. Initial tests are no good :-(. The Chromecast only accepts to start the build-in mediaplayer. all other app start requests are answered with a NOT_ALLOWED response.
So unless someone knows about a magic security setting or other, we are stuck here and can't build the enahncement requested. My efforts are here: https://github.com/lsiepel/openhab-addons/tree/chromecast-write-app
Some libraries in javascript (like castv2-client) let you open an application on the chromecast device. Actually sending an AppID to the AppID channel chromecast:chromecast:xxx:appId does nothing,
Reading the code I've seen that is done only for the media Player (CC1AD845) to cast a video.
It would be nice to tell the Chromecast to launch Spotify because actually the chromecast in invisible to the spotify web API until is started from a Desktop Spotify App or Android Application, In this way it should be possible with a rule to cast Spotify on a Chromecast, actually is impossible. Thank you