Hi @vervallsweg -
Thank you for your work! I was using Cast-web-api successfully for the last few years … then I went to update it (silly me!) … I previously had been running it on a Pi Zero, but after trying to update it I found that the Arm library issue (which I assume is still not fixed) … anyway, I moved cast-web-api over to my Mac and installed the Cast-web-api-cli from github … It is working sort of … I have been pulling my hair out to figure out why.
I have two use cases in my setup …
Case 1: is a separate Pi Zero running an app that monitors Presence and does various things, including announcing when someone arrives. That used to work fine, but after the upgrade it stopped … after much debugging … I traced it back to the requests.post in my python code. For some reason I had to add the ‘headers’ to the call which previously was left out (and worked fine w/o it).
I added:
headers = {'Content-Type': 'application/json'}
requests.post(speaker+"/playMedia/", data=d, headers=headers)
And now that app works fine.
Case 2: The other problem is with Webcore / Smartthings. I wrote the following test piston to demonstrate it:
This piston uses two methods to speak some text … the first string uses the method I was previously using which worked fine … now it doesn’t … the second string uses a brute force method which works fine.
I both cases, an examination of the cast-web-api-out.log file reveals the issue. I’ve included the last few lines after I run the piston:
new status: {“groupPlayback”:{“on”:false,“from”:“26052C0F-832A-4096-8773-1B6C12378F1A”},“application”:"",“status”:"",“title”:"",“subtitle”:"",“image”:""}
message broadcast: true
playMedia: {}
2020-06-26T20:14:13.969Z 37aa113f97c9dd45e6ef23dbb9d08a4c CastDevice.playMedia(): exception: TypeError: media.forEach is not a function
playMedia: [{“googleTTS”:“en-US”,“mediaTitle”:“This is the second string to speak”,“mediaSubtitle”:"",“mediaImageUrl”:""}]
message broadcast: true
sessionIdChanged: null
message broadcast: true
sessionIdChanged: 25a935c8-1417-4727-b509-e846137c40f6
message broadcast: true
message broadcast: true
the “playmedia:{}” occurs in both cases when it fails (obviously since its a null string.) The question is Why?
I have read through this thread and googled for others but did not see anything that addressed this.
Do you have any insight as to why this is happening? As an aside, other Smartthings apps (like speak the weather) also no longer work and exhibit the same symptom of the null playmedia:{} …
Thanks for any pointers you may have for me to try.