Nice…will give the beta a try. I’m actually using a ported webCoRE in Hubitat and would like to use the Make web request option. By using post i can send the request to the app - x.x.x.x:3000/playMedia. What other parameters do i need to add, say if i wanted to speak out “Hello World”?
Would it be something like this - 1.1.1.1:3000/playMedia?GoogleTTS=en&text=Hello World
This would be HTTP GET, the new api call for that is {api:port}/{cast-device-id}/playMediaGet/{JSON array object with all parameters}
I’d prefer using POST, since you don’t really need to HTTP encode/decode, thus the path is {api:port}/{cast-device-id}/playMedia and the post data is a JSON array object with all the media info, just like above.
The most minimal json object just for tts would be: [{"mediaTitle":"Hello world, this is my text", "mediaSubtitle": "Audio notification", "mediaImageUrl":"http://example.com/image.jpg", "GoogleTTS":"en-US"}]
API v1 also supports queueing, so you can just append as many JSON objects you want, separated by commas: [{"mediaTitle": .... }, {"mediaTitle": .... }, {"mediaTitle": .... }]
Since it’s json, you can always test for validity with something like an online parser. It’ll tell you if the syntax is wrong
Just open {ip:port}/device/ in your browser. It will list all of your devices, names, ids and connection status. Its also JSON if you want it more readable, parse it online or install a browser extension.
Oh and that would be the id. But no need to hunt down terminal messages
Update: it’s /device/ without s. Also check out the docs.
Awesome! Once i play around and figure out how to include all those JSON objects into webCoRE (i hope it’s possible), i’ll let you know on the outcome.
From the above it seems that 1.1.1.1:3000/abcd1234/playMediaGet/{JSON}
But per your Github notes it seems we need to add “device” into every command? e.g. 1.1.1.1:3000/device/abcd1234/playMediaGet/{JSON}
Last, is it /playMediaGet/{JSON} with the forward-slash between the API command and the JSON data or is it similar to the way it was in v0.30? e.g playMediaGet?mediatype=&mediaUrl=&mediaStreamType=&mediaTitle=&mediaSubtitle=&mediaImageUrl=
Yup, my bad. Messed up /devices/ and /device/ should be /device/. Yes it’s actually quite simple /device/ lists them all /device/{id} shows just the selected and then /device/{id}/{command} controls the device.
Forward slash. You just dump a JSON array after the command /device/{id}/playMediaGet/[{"mediaTitle":"title", ...}]
Yeah, because your link is not json data. Should be in your case: http://1.1.1.1:3000/device/1234abcd/playMediaGet/[{"mediaTitle":"Hello world", "mediaSubtitle":"Audio notification", "mediaImageUrl": "http://example.com/image.jpg", "GoogleTTS":"en-US"}]
And please don’t use example.com should link to an actual image.
For POST:
URL: http://1.1.1.1:3000/device/1234abcd/playMedia/
DATA: [{"mediaTitle":"Hello world", "mediaSubtitle":"Audio notification", "mediaImageUrl": "http://example.com/image.jpg", "GoogleTTS":"en-US"}] (same as above)
As said above to aniceberg, /device/ lists them /device/{id}/{command} controls them.
Just tested this and I can happily confirm it works. One “bug” I found is that it doesn’t update the device tile in ST with the current media status. For that you need to hit the “refresh” button, unlike in v0.30 where it refreshed automatically.
It calls data.forEach() . You cannot call forEach on a JSON object, only on arrays. This is why you get the error message from above
Update: After you fixed this, there’ll be another error. Look at the data that webCoRE posts. Then look at the data that the API logs, it received. It seems like there’s something wrong with your GoogleTTS variable. Instead of posting the value, webCoRE posts an error message and adds that to the post data.
Yeah there’s a typo in your webCoRE variables. You define them with googleTTS line 20 with lowercase g and access GoogleTTS in line 27 with uppercase G. The later variable doesn’t exist and webCoRE posts an error message.
On the version 1.0, using GoogleTTS, is there a limit on character count? I tried sending a pretty long string and i hear the chime on the GH’s come on, but nothing spoken. When shortening it, then it works.
When installing the cast-web-service-manager
I’m getting
Groovy.lang.MissingMethodException: No signature of method: script_dth_metadata_82bb8089_7489_4327_a02a_854760aacbea.appSetting() is applicable for argument types: (java.lang.String) values: [api] Possible solutions: typeSetting(java.lang.String), typeSetting(java.util.Map), typeSetting(java.lang.String, java.lang.String), getSettings(), setSettings(java.lang.Object), typeSetting(java.lang.String, java.lang.String, java.util.List)