Chromecast bindings

@thejayo I also started using the binding yesterday but I am using the most recent snapshot from cloud bees. I know you can use the binding to retrieve song info, but I’m not sure there is a way with the current binding to save the currently playing url for playback after your announcement. If there is a way to do this that would be awesome.

Hi,
Has anyone gotten this to cast youtube videos?
I plan to set a schedule via rules to cast Youtube Sky News Live every 7AM on my TV.
The techslides sample works but I can’t get to cast youtube videos.


2018-03-20 20:21:38.863 [ome.event.ItemCommandEvent] - Item 'Play_Switch' received command ON
2018-03-20 20:21:38.993 [ome.event.ItemCommandEvent] - Item 'CastLRTV_URI' received command https://www.youtube.com/watch?v=XOacA3RYrXk
2018-03-20 20:21:39.084 [ome.event.ItemCommandEvent] - Item 'CastLRTV_Control' received command PLAY

How do you stream Google Play Music Playlist to chromecast? Do you use a rule or the native Google Play Music App on your Phone? I would like to start a Google Play Music Playlist. I have checked all items, but non of them offers me a clear URL or command of the Playlist.

1 Like

You need to use your phone. You should then be able to control it from openhab but you cannot start it from openhab.

1 Like

Hi Fritzcm, appreciate this is an old post but did you ever get Chromecast to play YouTube videos?

So I finally got this to work. To play videos from youtube use the following. Replace XX with your Chromecast IP and change v=XXXXXX to the video you want

executeCommandLine('curl -H “Content-Type:application/json” "http://192.168.XX.XX:8008/apps/YouTube" -X POST -d "v=dQw4w9WgXcQ"', 5000)
3 Likes

Promising, your post burnt my afternoon :slight_smile:
i have tried this without success. nothing is happening.

The GET works but not the POST 404


same issue on two chromecasts : Chromecast first generation and chromecast Second generation

i have tried with different formats and ports.

[16:34:25] openhabian@openhabian:~$ curl -H "Content-Type: application/json" http://192.168.1.62:8008/apps/YouTube -X POST -d 'v=oHg5SJYRHA0'
[16:34:27] openhabian@openhabian:~$ curl -H “Content-Type: application/json” http://192.168.1.62:8008/apps/YouTube -X POST -d ‘v=oHg5SJYRHA0’
curl: (6) Could not resolve host: application
[16:34:30] openhabian@openhabian:~$ curl -X POST -H "Content-Type: application/json" http://192.168.1.62:8009/apps/YouTube -X POST -d 'v=oHg5SJYRHA0'
curl: (52) Empty reply from server
[16:34:40] openhabian@openhabian:~$ curl -X POST -H "Content-Type: application/json" http://192.168.1.62:8008/apps/YouTube -X POST -d 'v=oHg5SJYRHA0'
[16:34:47] openhabian@openhabian:~$

i have Pi-hole , same behaviour when disabling it :slight_smile:

SOS! please

Hi everyone, is there any ETA for Next/Previous buttons? I’m currently trying to control my Google Home players that are usually playing Spotify. Is there any workaround via API callback or something?

Are you Chromecast’s included in a group (Google Home app) ? You can try my GH bridge . OrangeAssist - Google Assistant Integration

Just issue a command like “go to next song”

Is it possible to get IP or name of the chromecast in the error:

2019-02-07 09:01:24.145 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while reading
su.litvak.chromecast.api.v2.ChromeCastException: Remote socket closed
        at su.litvak.chromecast.api.v2.Channel.read(Channel.java:425) ~[263:org.openhab.binding.chromecast:2.5.0.M1]
        at su.litvak.chromecast.api.v2.Channel.access$200(Channel.java:51) ~[263:org.openhab.binding.chromecast:2.5.0.M1]
        at su.litvak.chromecast.api.v2.Channel$ReadThread.run(Channel.java:137) [263:org.openhab.binding.chromecast:2.5.0.M1]
2019-02-07 09:01:24.161 [WARN ] [su.litvak.chromecast.api.v2.Channel ] -  <--  null payload in message

/Mike

Hi, is anyone else experiencing a long delay 10-30sec) when making commands to chrimecast? When i change the url, pres play or pause or adjust the volume it takes 10-30sec for the command to be executed on the chromecast. Im using chromecast audio, openhabian on rpi3 running OH.2.4.0 . I’m writing this on my phone with no access to my openhab so i will add items, rules and sitmaps files when i get home.

Is there an alternative way of using Google Home as Audio Sink. Then i can uninstall this binding.

/mike

My current knowledge is:

  1. Chromecast Binding
    • Able to play media file on a device or group
    • NOT able to send text to use google internal TTS (so you need third party TTS service)
    • NOT able to resume
    • NOT able to broadcast
  2. Node Red in combination with MQTT binding or openHAB node
    • Able to play audio files, videos, internet radios, etc. on a device
    • NOT Able to play audio files, videos, internet radios, etc. on a group
    • Able to send text to use google internal TTS
    • NOT able to resume
    • NOT able to broadcast
    • All openHAB nodes where not stable during my test…
  3. OrangeAssist
    • Could solve all problems, but is more a PoC at the moment…

So… we get caught between a rock and a hard place. :frowning_face:

Any success?

Yeah. We have some new features for node-red. The node-red-contrib-cast learned to talk to groups. So OH + MQTT + NR are my current choice.

It is very sad that there is currently no development for this binding.

I´m trying to cast a jpeg image from openhab to my Google Home Nest Hub. I managed to cast a mp4 video file. But an jpeg image seems to cause some problems. This is what the log says:

2019-06-11 00:43:01.173 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while handling, caused by com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'ERROR' as a subtype of [simple type, class su.litvak.chromecast.api.v2.StandardResponse]: known type ids = [CLOSE, DEVICE_ADDED, DEVICE_REMOVED, DEVICE_UPDATED, GET_APP_AVAILABILITY, INVALID_REQUEST, LAUNCH_ERROR, LOAD_FAILED, MEDIA_STATUS, PING, PONG, RECEIVER_STATUS]
 at [Source: (String)"{"requestId":841,"responseType":"ERROR","reason":"NOT_SUPPORTED"}"; line: 1, column: 33]

Isn´t is possible to cast a simple jpeg image file? If no, which format will work?

This is my rule for this test:

rule    "Image casting Rule"
	when
		Item  HUE_Occu changed from OFF to ON
	then
        logInfo("debug", "motion ON, cast image")
           HomeHubPlayURI.sendCommand("http://10.4.28.200:8080/static/test01.jpg")
           HomeHubPlayer.sendCommand(PLAY)
        logInfo("debug", "Image Casted")
end

It will probably work if the HEADERS are exactly what google is looking for. My guess is it the method that you are using the basic openhab serving of the file that causes it not to work. Changing the headers to what the chromecast expects is probably the missing key. Find an example jpeg that is online that does work and then we can copy the http headers that the working one uses.

I should have a home hub to play with Soon. But it won’t be for two weeks before I have the time to look into it in depth.

I did add the ability to create and serve jpeg files from the ipcamera binding recently and it is possible it will work already I just have not tried it yet as I prefer to cast a full high res and high framerate moving picture which the binding can do.

@Kim_Andersen
EDIT: ** CONFIRMED IT WORKS **
HomeHubPlayURI.sendCommand(“http://192.168.xx.xx:54321/snapshot0.jpg”)

animated gif also working:
HomeHubPlayURI.sendCommand(“http://192.168.xx.xx:54321/ipcamera.gif”)

If you place any jpg or gif file into the folder that the ipcamera binding uses it can be served and casted using my code. It is the headers that my binding uses which are the key to making it work and what your methods lacks.

This will work if you place the file in the correct folder that you specify in the config called FFMPEG_OUTPUT

HomeHubPlayURI.sendCommand(“http://192.168.xx.xx:54321/test01.jpg”)

1 Like

I dont understand… When you say headers, I assume it´s the jpeg header you mean?
I tried with an .png file as well, (the same jpg file saved in .png format from Windows10 Paint). It gave exactly the same error.

All I will say is it is nothing that you are doing wrong, and has nothing to do with the file. You can google “http headers” and read a wiki. I have already said the easiest way for u to get it working, tested it for you and replied to you in multiple threads on this.

I know Matt… And I really do appreciate all you´re doing, including your ipcamera binding, which I ofcouse will prefere to use.