So here it is. I had to change things for my multi-source features so it's not at all backwards compatible- that and I removed all menuing for the moment. But it will give you an idea of how I'm approaching multi-CCA. I've added support for 3 CCAs, but I only have 2 CCAs to test with, so I can't say I've tried all the permutations out. It appears to handle average case scenarios decently, but there's still plenty of random problems that crop up. Every so often some data field is not set, or you do something on the phone app which causes the plugin to stop playing. If nothing else, it might give you some ideas. If anyone cares to give this a try, you are welcome to it, but it is offered without any warranties or guarantees, and may not work given your specific setup.
I'm sure with enough work I could make the system self-configure, but that's going to take more time than it's worth.
Hand-Edits in Homeseer:
* Add 3 new timers, "CCA1 TitleTimer", "CCA2 TitileTimer", and "CCA3 TitleTimer"
* Add 3 new events corresponding to each CCA as before
* Add a parameter "CCA1", "CCA2" or "CCA3" to each event, to be passed to SendMetaData.vb
, depending on which event is being called.
Notes - I'm experimenting with an Idle event, that might more gracefully deal with CCA disconnects. So far, it only resets the timer. I was hoping to use it to call a spotify or google url, but that function wasn't working as I expected. Right now it's more of a placeholder.
* Unmodified from BOBONE's version.
* Now use different global variables, and added functionality to branch based on configured CCAs
* Contains all the global variables needed to run the scripts. Some altered logic.
* Change the variable values at the top of the script that are being defined to match your system.
Notes - This should be the only script you'll need to modify for your given system. I've added a global PortDebug boolean which you can toggle during run time to get more data from the sub calls Port is now a global as well. Lastly, there's CCA_Name has to be whatever the Chromecast plugin uses for "Room" on the Device List, as opposed to the name given to the CCA by Google.
I'm sure there's something I'm forgetting which will cause the system to not work properly, first time.
Known Issues/Left to do:
* Startup is not handled gracefully. Source Display is not defaulted properly
* The first casted song does not display proper time. Without a known stream position, there's not much that can be done, short of forcing the song to start playing from the beginning. That is not a universal solution, because free services do not allow that feature.
* On my machine, a "Rewind" command on a 3rd party app does not trigger a reset of the TitleTimer, causing the display to show an incorrect timer.
* Chromecast Timeout is not handled gracefully
* Zone On and Off is currently a non-op, as far as the CCA is concerned. There needs to be a way where Homeseer keeps track of how many zones are using a given source, and when all of them are off, the CCA geos into some sort of holding pattern, keeping the Application loaded, but not streaming - perhaps a quick "Play & Pause" every 30 minutes?
* Little error checking built in.
[Edit] I've looked at the code again and have spotted 2 or 3 bugs in some of the logic. I'll have to set this project aside for the moment, but when I get back to it I'll make the fixes, and attempt to work on the "Zone On" handling.