Chromecast bindings

chromecast
binding
Tags: #<Tag:0x00007fe053d35258> #<Tag:0x00007fe053d35118>

(Marcus) #21

hi I’m sending it a mp3 file like where the IP adress is to my local HTTP where I play the files successfully to squeezelite players. I tried to diffrent methods for sending the file but nothings really seems to work maybe there’s an issue with mp3 playback.

sendCommand(CCplayuri,“http://192.X.X.X:65535/doorbell.mp3”)

CCplayuri.sendCommand(“http://192.X.X.X:65535/doorbell.mp3”)


(Daniel Walters) #22

That should work. Does your Chromecast attempt to play the file? e.g. do you see the loading graphics?


(Marcus) #23

Sometimes theres a blu cast icon on my tv instead of picture slides but no sound I guess there’s something strange going on. Atleast now I’m glad i didnt bought 3 chromecast audio before testing.


(Stian) #24

Hi, has anyone had a sucsess playing a radio stream to the chromecast? When playing a mp3 file, everything works fine, but when trying a stream, I get the following error…

2017-04-03 10:44:53.819 [ItemStateChangedEvent ] - CastLRTV_URI changed from http://techslides.com/demos/sample-videos/small.mp4 to http://lyd.nrk.no/nrk_radio_p1_ostlandssendingen_mp3_h
2017-04-03 10:44:53.971 [hingStatusInfoChangedEvent] - ‘chromecast:audio:007ece673a4511f33641702196e5343e’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Invalid request: INVALID_MEDIA_SESSION_ID

Stream: http://lyd.nrk.no/nrk_radio_p1_ostlandssendingen_mp3_h


(Chris) #25

I’ve come across two issues:

1 – If i stream Google Play Music to a Chromecast, and play a song, OpenHAB does not know if the music is playing or paused no matter how many times i cycle it within the Google Play Music app on my phone.
The moment i play/pause the chromecast though OH2 it forever knows what its status is no matter where i pause/play (within Play Music app or Openhab2).

It seems like for OH to know what the chromecast is doing it requires an action to happen in OH first then any changes are logged/updated.

2 - Play/Pause & Next/Previous does not work within netflix. Logs show this:

2017-04-28 22:58:49.747 [DEBUG] [chromecast.handler.ChromecastHandler] - mediaStatus null
2017-04-28 22:58:49.752 [DEBUG] [chromecast.handler.ChromecastHandler] - PLAY command ignored because media is not loaded
2017-04-28 22:58:50.465 [DEBUG] [chromecast.handler.ChromecastHandler] - mediaStatus null
2017-04-28 22:58:50.465 [DEBUG] [chromecast.handler.ChromecastHandler] - PAUSE command ignored because media is not loaded
2017-04-28 22:58:52.397 [INFO ] [chromecast.handler.ChromecastHandler] - NEXT command not yet implemented
2017-04-28 22:58:55.188 [INFO ] [chromecast.handler.ChromecastHandler] - PREVIOUS command not yet implemented

(Marlon) #26

I’m sorry if this is an obvious question. How can I get the URL that is playing my chromecast audio?
I want to play any stream, for example from tunein and then take the URL to use it in openhab2 via sendCommand (“chromecast_audio_7698_playuri”, “URL taken from that”)


(Dries) #27

I have exact the same problem.
Too bad, I would like OH2 to ‘always’ now if my Chromecast is playing or not.
I have a KNX switch I use to turn on/off all my devices in a room. Depending on Chromecast playing yes/no I would know if I need to turn of my projector (which I control via irTrans).


(Lewis) #28

I havn’t had much luck trying to get my Chromecast audio to play any local files.

  • I have tried mounting a share to the Raspberry Pi and using that location as URI
  • added network computer with the share in the hosts file and used that.
  • file:// , file:/// , file:///*insert mounted share
  • config samba and given full writes on the pc for all guests

The chrome cast will play any mp4 from a URL eg: http://techslides.com/demos/sample-videos/small.mp4 but I can not seem to get it to do anything bar playing something thats hosted online.

Could anyone provide any feedback on what I may be missing? Do I need to add something somewhere within Openhab2?

I should add that the Chromecast binding is installed and that is how I have been posting the eg: http://techslides.com/demos/sample-videos/small.mp4 which works… anything else I may put here doesn’t seem too…

My theory is if I can get it to work by just changing that string, I can create my own interface in HabPanel etc… I would prefer not to have to use my phone to Cast things too, i would love to use openhab to tell the chromecast audio to play from a network location or googlemusic etc.

Thank you


(Jürgen Baginski) #29

I’m facing the same problem. My Chromecast Audio is able to play radio-stations from TuneIn, but when trying to play either radio stream (xxxx.m3u) or a local .mp3 it fails. The posted link to a .mp4 works.

So the Chromecast Audio CAN play radio streams (via TuneIn), how to start such a stream via openHAB??
Using an executeComandLine?? Has anybody found a solution on this way?


(Robert ) #30

Chrome-cast Audio how can i call google play music radio station direct so it will play on Chrome-cast Audio

Many thanks


(Jack Sand) #31

Is this dead? Examles op playUricommands would be much appriciated. Hand how to use the playuricommand.

Can i play from a network share?
Can i play from youtube?
Can i play radio streams?


(Dries) #32

Here a dummy example:

rule "Play an MP3 file"

when   
    Item  TEST_Chromecast_GV_Living_Play_Trigger changed from OFF to ON
then
	Chromecast_GV_Living_PlayURI.sendCommand("http://lb.topradio.be/topradio.mp3")
	Chromecast_GV_Living.sendCommand(PLAY)
end

I don’t think it can play from a network share (although I haven’t tested it), but radio streams is fine (see example).


(bruno) #33

Hi all,
for your information after many attempts I could play files only if I move them under /etc/openhab2/html/…/xxx.mp3.
Is anyone able to play many audio files with one command ? (i tried with group-forEach but no results)
Thanks


(Dries) #34

Not sure what you mean with playing many files with one command. I guess you are talking about playing a playlist?

I haven’t tried it myself, but you should consider creating an M3U file (which is a playlist file), put it on the same folder as your MP3 files (not necessary, but convenient). And then trigger the Chromecast to play the M3U file.


(Brian M. Pedersen) #35

I have had problems with my chromecast audio volume level, they often start bouncing change the volume up and down spontaneously after an initial volume adjustment. Did any of experience this?
I get the problem both when I control the audio group and the individual units. I get an error i my log like this:

2017-10-01 21:19:01.860 [WARN ] [su.litvak.chromecast.api.v2.Channel ] - Error while reading: Could not resolve type id 'DEVICE_UPDATED' into a subtype of [simple type, class su.litvak.chromecast.api.v2.StandardResponse]
 at [Source: N/A; line: -1, column: -1]
2017-10-01 21:19:01.863 [WARN ] [su.litvak.chromecast.api.v2.Channel ] -  <-- {"device":{"capabilities":4,"deviceId":"2f017b59-0f18-5ac3-e223-abd0f7fb2109","name":"Soveværelse","volume":{"level":0.12999999523162842,"muted":false}},"requestId":0,"type":"DEVICE_UPDATED"}

(bruno) #36

As a matter of fact, the playlist could be an answer to my problem (I had in mind much pore complex solution!), I’d like to play for example all the songs of a CD (in MP3), but really I do not know how to do it, can you help me?


(bruno) #37

to Dries


(Dries) #38

I just tested it. Unfortunately, ChromeCast doesn’t take M3U files. :frowning:

But just to explain what I had in mind:
You have two MP3 files (A.mp3 and B.mp3) stored on a webserver that is publicly accessible (http://mysite.com/MP3/A.mp3).
Then you create an M3U file with the following content:

http://mysite.com/MP3/A.mp3
http://mysite.com/MP3/B.mp3

You put the M3U file on the same folder as the MP3 files (not needed). And you play the M3U file with the following command:

Chromecast_PlayURI.sendCommand("mysite.com/MP3/Playlist.M3U")
Chromecast_.sendCommand(PLAY)

But like I said… it doesn’t work.

A quick and dirty way to do it (if it’s always the same music you want to play), is to generate one big MP3 file out of your multiple MP3 files (https://audio-joiner.com/).


(bruno) #39

I had checked the solution before, exactly as you had explained, and as you say it does not work.
Sincerely I do not like the solution of a big mp3 (too inelegant :)) , rather better some json or pyton code, but I do not understand why I cannot insert a loop in the rule, scanning one by one a variable with the single http addresses, if a variable is not usable, I could try with a txt file, reading each time the next record (mp3 file). What to you think?


(Dries) #40

Hmm…
What could work maybe (again, I haven’t tried this):

  • Play your first audio file (set URI parameter and then press play);
  • I guess the status of the player will remain PLAY until the song is finished;
  • When the status changes to PAUSED_PLAYBACK/STOPPED, change the URI parameter and press play again;
  • Getting the file names of the MP3 files should be possible using the executeCommandLine;