Cast-web porting help - SOLVED


#1

Looking to port over the Cast-Web app from ST. Got the 3 pieces installed with the normal minor changes needed.

When running the app, it finds my devices but doesn't populate the dropdown box to select any of them. @rayzurbock has had the same problem in another thread (here).

Hoping to get some brilliant minds to take a look at the code and figure out how to populate the drop down. :slight_smile:

Appreciate any help...thanks!
@Cobra, @stephack, @rayzurbock, @bravenel, @mike.maxwell


#2

All I can offer at this time is to find the code section that's supposed to populate the enum input, add some debug logging to catch the raw data being sent, then figure out why it's not updating the input element.
Specifically look at the data in state.devicesMap and how and if that structure is being created correctly within the parse method.


#3

I'll take cast however I can get it. You two going to race? :wink:


#4

Ummm, yeah, my race car has only three wheels currently, each of which is pointed in a different direction...


[Release] Google Home Assistant Relay Driver - text to speech on Google Home devices
#5

As long as they're not all in-line with one another, you're going in the right direction! :smiley:


#6

This should get you set GitHub - jp0550/smartthings at hubitat

The key for the dropdown fix is below

                def options = [:]
                state.devicesMap.each {
                 	options[it.key] = it.value   
                }
                input "selectedDevices", "enum", required:false, title:"Select Cast Device ("+ state.devicesMap.size() +" found)", multiple:true, options: options

@mike.maxwell The best I can figure is that the options dropdown doesn't like to take a map straight from the state (maybe due to the deserialization process). Recreating it solves the issue.

Other hubitat patches to make the rest work are in the repo above. I didn't touch the group sync app code though.


Cast-Web - Cannot get property 'input' on null object
Lutron Pico Audio for Echo Speakers
#7

Thank you, @putnamjwp! The drop down list now populates. I can select a speaker and move on to the next screen. Looks like there is now a problem when it's trying to create the device.

cast-web-api
[dev:1237](http://192.168.86.77/logs#dev1237)2018-07-14 16:17:32.982:errorgroovy.lang.MissingMethodException: No signature of method: dev1531596300248324077442.addChildDevice() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String, java.lang.Long, java.util.LinkedHashMap) values: [vervallsweg, cast-web-device, 521219da99bcca58d2dd1e52dc0f5806, ...] on line 146 (updated)

If I go into the cast-web-api driver and look at line 146....this is what I see.

Thoughts?


#8

Sure thing, check out my repo above. I got this error fixed as well to the point of controlling devices and seeing their state.

The child device doesn't accept a hub id. Also sending the label caused some weird issues, so I removed it too:

addChildDevice("vervallsweg", "cast-web-device", it, ["apiHost": getDataValue("apiHost")])


#9

Thank you so much, I went to your repo and updated the drivers and apps. Working GREAT! Now to play around with all the options. Thanks again!


#10

If working, would you share the ported app please?


#11

It's all in his repo.


#12

Thanks. This resolved my issue with adding my Google Home devices.
PlayText and Speak functions still did not work for me.
I was getting the following error in Hubitat for the device when I tried these functions:
errorgroovy.lang.MissingMethodException: No signature of method: dev15316173436921026341192.textToSpeech() is applicable for argument types: (java.lang.String, java.lang.Boolean) values: [Testing, true] on line 418 (speak)

Line 418 in cast-web-device was the following:
return playTrack( textToSpeech(phrase, true).uri, 0, 0, true )
I modified to:
return playTrack( textToSpeech(phrase).uri, 0, 0, true )

and it is now working.

def speak(phrase, resume = false) {
    if(settings.googleTTS && settings.googleTTSLanguage){
        if(settings.googleTTS==true) {
            return playTrack( phrase, 0, 0, true, settings.googleTTSLanguage )
        }
    }
    //return playTrack( textToSpeech(phrase, true).uri, 0, 0, true )
    return playTrack( textToSpeech(phrase).uri, 0, 0, true )
}

#13

Since I already have Google Assistant Relay working, I found this a bit more involved then I needed.
If anyone is looking for an alternate choice, I instead downloaded the latest nightly for MacOS VLC Player 3.0.4 which is able to Cast and have the HTTP web interface active at the same time.

NOTE: To get this working, I found it was necessary to first disable the HTTP web interface then quit and restart VLC Player. Once it's running again, set the cast device, and then go into the preferences and re-enable HTTP web interface.

Works great, and I now have both my door chime and a verbal announcement of the door that has been opened.

[Edit} I forgot to include something I did previously, and for some time couldn't get this working again. There's an important step after re-starting VLC Player, selecting the Cast device, and then re-enabling HTTP. You then must then go to the VLC menu, choose "Add Interface" and select "Web". It should then work to play a track from Hubitat.


TTS to a Echo dot or Google mini
Porting VLCthing
#14

Just wanted to say thanks to @putnamjwp. This is a nifty feature to have available. Thanks for porting over and sharing.


#15

Question...

If I'm listening to a Google Music radio station and an announcement happens...How do I get it to continue playing the radio station after the announcement?


#16

Hi putnamjwp,
thanks for porting this over to Hubitat. Installed the app & drivers from your repo but can't seem to get the dropdown populated with my cast devices.

  • My cast-web-api node server is working fine - I used it before for cast-web-api on ST
  • The Hubitat app doesn't even hit the node server - not for Test API connection and neither for Discover Devices

The log is inconclusive:

Would appreciate any hints.

Thanks,
Jan

Edit: bptworld -> putnamjwp :wink:


#17

All credit goes to @putnamjwp. :smile: (I don't even have a repo)


#18

Hi @putnamjwp,

I'm not sure if you received a notification for my first post a few days ago because I initially used the wrong recipient.

I'd be glad if you could give me a hint what might be wrong if Cast web - service manager doesn't list any devices, even though cast-web-api actually found the devices:

image

Would be glad if you could give me a hint.

Thanks,
Jan


#19

I don't have this installed anymore so I'm not sure off the top of my head. The big thing about it not populating before was this code below which should be in the repo now:

def options = [:]
state.devicesMap.each {
     options[it.key] = it.value   
}
input "selectedDevices", "enum", required:false, title:"Select Cast Device ("+ state.devicesMap.size() +" found)", multiple:true, options: options

#20

For the chromecast fans out there, I finally got some time to poke at our chromecast integration again.
What I have so far is play/pause/stop/set volume, mute/unmute.

The only other possible rev 1 inclusion would be speak (ie TTS), however I have no time to dig into play track, restore/resume types of functionality at this time.

So if I add speak, and you have something already running and you send a speak command, it will not be restored.

Add it?, leave it out, thoughts?


Google Home/Assistant tutorial?