Open strunker opened 7 years ago
Got this to work by following direction on main page, I used the groups friendly name which in my case is "GroupAudio". Found it by its friendly name, and then created a media controller object.
Im not sure why creating the object manually like I was trying to do above failed to work properly. One thing I noticed when I printed the cast type on CC4 is that it was set to audio, not group. I think this is part of the issue. When you create the object yourself, instead of having it get discovered by the discovery functions, you arent able to hard set the cast type. There doesn't appear to be a way to do over ride the cast type.
when I print CC4 you can see the output below.
CC4 = pychromecast.Chromecast("10.1.1.12",port=42236)
Chromecast('10.1.1.12', port=42236, device=DeviceStatus(friendly_name=u'StrunkerKitchen', model_name=u'Chromecast Audio', manufacturer=u'Google Inc.', api_version=(1, 0), uuid=UUID('99c3141d-6251-3bd3-c225-1110691224cc'), cast_type='audio'))
what it should read is this (the below is what you get for it when you find it via SSDP)
Chromecast('10.1.1.12', port=42236, device=DeviceStatus(friendly_name=u'GroupAudio', model_name=u'Google Cast Group', manufacturer=u'Google Inc.', api_version=(1, 0), uuid=UUID('87779a9e-6a3a-444e-bd6f-5a5355d67674'), cast_type='group'))
See below example. On the CC4 object we create the chromecast group object. I am 100% the port and other info is correct. Afterwards we create the Group object as a media controller.
Group.play_media works as expected, I get music coming out of both the chrome cast audio dongles I have. Which is great. Problem is that pause\stop\play no longer work. Neither does volume control.
If you try to do set_volume on the CC4 which is the object that represents the group, it is not functional. As a work around you can set volume on the individual devices, in my case CC2 and CC3, i have to call set_volume on both.
However, im not able to get pause\play\stop to work. On the group object all commands for playback are ignored. I tried to also send pause\stop\play to the kitchen object, since it acts as the "master" of the group (notice the maching ips, just different port numbers). but this also proved non functional.