[RELEASE] cast-web v1.2.1 - Chromecast Integration (EDGE Driver discussion begins in post 1668)

Thats great
Martin

Does anyone use the embedded switch capability in their devices? I don’t really understand the purpose of why it’s included. Automation routines can directly set the device’s controls (pause/play/stop/preset selection, etc). So what value does the switch provide?

1 Like

You will continue to need the cast-web-api running on your network. It’s possible that it could be eliminated but that’s well beyond the scope of my effort right now.

I use it on my ActionTiles panel and with my google home assisstant integration to activate lets say “hey google” turn on radio, then it starts playing i.e. preset1. I have routines that turns off my radio in the kitchen when TV in the living room turns on and turns on again in daytime hours when TV turns off.

1 Like

no never used it ,

martin

I’m making available an initial Edge driver for anyone willing to suffer through a beta-level version :slight_smile: .

This driver still requires cast-web-api running on a local computer, as with the legacy driver, but no longer requires a SmartApp.

What IS working:

  • Discovery and creation of devices
  • Play/pause/stop/volume control of media
  • Define and use presets
  • ‘hidden’ switch and track controls with same config options as legacy driver
  • Devices are recognized by SmartThings as smart speakers, so can be used in SmartThings automation routines (Notify someone > Play message on speaker)
  • After notification is issued, the driver will attempt to resume prior preset media, similar to the legacy driver, however this has limitations.

Limitations:

  • Google Assistant integration not working, and probably never will unless/until someone wants to rewrite one of the cast-web-api modules to comply with the new Google oauth flows.
  • Google TTS not working; don’t know why this is, but SmartThings Notifications work ok
  • SmartThings’ mediaPlayback and mediaTrackControl capabilities are still in ‘Proposed’ state and they are flakey. On iOS, the GUI pause/play button is not working. Let me know if you find otherwise on Andriod. Because of this, I’ve included an ‘alternate controls’ button to select pause/play/stop.
  • Resumed media is limited to media configured in presets; can’t resume media initiated outside the driver (via Google app or directly on device)
  • Chromecast media will not resume after notifications; this may be a real nuisance for some of you; I may have to consider disabling this for Chromecast devices
  • Cannot control volume on Chromecast devices
  • I’ve not implemented any connection monitoring or retry cycles, but this may be needed for a more robust driver

Limited Testing has been done:

  • Only with cast-web-api version 1.2.1 (the most recent)
  • Only with Nest mini 2nd gen and Chromecast HD devices
  • So far, I’ve done little testing with automations other than notifications
  • Minimal experimentation with various presets
  • No testing with Groups
  • No testing with parallel use of the legacy SmartApp and DTH devices

Some observations as I’ve developed this:

  • the cast-web-api is a bit flakey at times. As mentioned earlier, I see fairly frequent disconnects with the actual devices, but it does eventually restore connection
  • ability to control Chromecast devices is pretty limited without access to Assistant commands
  • If you want better integration and control of a TV media controller, I’d recommend Roku - I have a driver that provides much more control and it does not require an intermediate app running on another computer.

Some points about getting it up and running and configured:

  • You do not use the legacy SmartApp with this driver
  • The first time you do an Add device / Scan for nearby devices, a ‘Manager’ device is created in your ‘No room assigned’ room. You need to then configure the network address of your cast-web-api app in device settings. Status field on Controls screen will show success or failure. Info field on Controls screen will show all Cast devices found and configured, once you complete the second discovery step below
  • If you want to, you can also configure your 6 presets on this manager device. Note that title - subtitle are provided in one field (just separate with a - character), and I’ve omitted the image URL for now. (Not sure how important that is for anyone)
  • Assuming you are now connected to cast-web-api, you can do another Add device / Scan for nearby devices and now your Cast devices reported by cast-web-api will be created and found in your ‘No room assigned’ room.
  • Configure your switch and track control options in each device; ignore the Google TTS language selection for now since it’s not working
  • Although not normally needed, you can use the ‘pull-down’ gesture on a device Controls screen to force a refresh with the device; the Refresh button on the Manager device will reset the connection with the cast-web-api.

That’s essentially it. Let me know your feedback and I’ll get things fixed as we find them.


Channel: SmartThings. Add a little smartness to your things.
Driver: Google Cast V0.1
Version: 2022-12-27T03:54:45.711448614

7 Likes

thanks
for some reason it dosent like me lol
it says cannot reach cast-web-api
i did a logcat and got this
however i learnt a new word concatenate lol
? Select a driver. 3
2022-12-27T11:51:47.172481575+00:00 TRACE Google Cast V0.1 Received event with handler capability
2022-12-27T11:51:47.178156117+00:00 INFO Google Cast V0.1 <Device: 8d4637e4-3e23-440f-83d5-dec1aaadd5f8 (Google Cast Manager)> received command: {“args”:{},“capability”:“partyvoice23922.refresh”,“command”:“push”,“component”:“main”,“positional_args”:{}}
2022-12-27T11:51:47.181607617+00:00 TRACE Google Cast V0.1 Found CapabilityCommandDispatcher handler in Chromecast
2022-12-27T11:51:47.184418617+00:00 INFO Google Cast V0.1 Refresh requested
2022-12-27T11:51:47.187437659+00:00 DEBUG Google Cast V0.1 Sending GET / to 192.168.0.107:3000
2022-12-27T11:51:47.190252992+00:00 DEBUG Google Cast V0.1 Send body:
2022-12-27T11:51:47.319080826+00:00 DEBUG Google Cast V0.1 Response: { “cast-web-api” : “v1.0.2” }
2022-12-27T11:51:47.322474159+00:00 ERROR Google Cast V0.1 Google Cast Manager thread encountered error: [string “st/dispatcher.lua”]:233: Error encountered while processing event for <Device: 8d4637e4-3e23-440f-83d5-dec1aaadd5f8 (Google Cast Manager)>:
arg1: table: 0x1eaab58
[string “init.lua”]:267: attempt to concatenate a nil value (field ‘castWebApi’)
listening for logs… done

its sorted i removed the cast-web-api snap and installed the cli
so far so good
the driver is excellent thanks you @TAustin

1 Like

First thing I noticed was that every time I scan, many of my devices which were already added, come up again. Definitely for audio groups. See pics below. Second, I am not able to use the audio notifications, for the older or newer minis, Lenovo smart clocks, or audio groups.


Great! I was going to say that you had an older version of the cast-web-api and it is returning a different key/value pair when connecting. This is something I can address in the code so others don’t run into this. Thanks.

1 Like

You don’t use the old SmartApp with this driver.

Are you saying I need to delete the old smart app for this to work? What about the duplicate devices showing up?

I don’t know for sure, but I wouldn’t think you’d have to. It and the old DTH-type devices should be able to continue to work in parallel. But I don’t have them installed so never tested it.

I don’t know why the SmartApp is reporting duplicate devices for you. Seeing as you only have a few days left where the legacy driver is working it might be best to bite the bullet and go ahead and delete the old SmartApp and devices.

@TAustin, have you tried to create audio groups for testing? Are they coming in with duplicates?
Thanks!

I haven’t done anything with audio groups yet. I only have a nest mini and a chromecast, but will try it.

1 Like

@TAustin , thanks! I’ll wait until you’ve done that testing.

@TAustin, after a few hours of letting everything ‘sit’ duplicates are no longer being added. However, when I delete a device, they aren’t being added back either with a scan. I don’t know what is going on.

OK, I did find one problem with groups and have fixed it on my driver version (not pushed out yet), but it didn’t have anything to do with having duplicate devices created. One device should be created that represents the group. So in my case I have one Nest mini, one Chromecast, and one group device, plus the manager device.

So if you have many groups defined, then you will get a device created for each group - along with a device for each individual device. We can discuss if this is desirable, but I think it would be, in that it allows you to view and control your speakers as a group from SmartThings, as well as control them individually. If you don’t want the group devices, I could provide an option setting to suppress creation of them.

I didn’t notice anything in the legacy driver code to indicate special handling of groups so I’m not sure of how it worked there.

Are you keeping track of which devices are from which driver? For example, if you delete a device from the legacy driver, the new driver won’t recreate it. They are independent of each other.

The way device creation is managed is quite different from the SmartApp. There, you were presented with a list and you could individually select which devices to create. With the Edge driver I really can’t take that approach. Rather - any time you do an Add device / Scan for nearby devices function in the mobile app, all devices reported by cast-web-api will be created if they don’t already exist. If you delete one and then later do an Add device / Scan for nearby devices, then it will get recreated.

hi ive added some presets but cant figure out how to use them in a routine ,
martin

When you are configuring the Then portion of the routine, select the device, then on the controls list, pick ‘Play a favorite’, turn on the toggle, and in the blank field, type ‘preset1’ or ‘preset2’ etc.

2 Likes