[SOLVED] Amazon Echo Control: trying to start TuneIn station from rule

I have the echo binding running already and now try to start a tunein radio station via time rule.
I run into two issues:
My item:
String echo_wz_radioid “TuneIn Radio Station Id” {channel=“amazonechocontrol:echo:0fe03771:90F00818708606V5:radioStationId”}
My command:
echo_wz_radioid.sendCommand(‘Antenne Bayern’)

This fails with an exception:
java.net.URISyntaxException: Illegal character in query at index 126: https://alexa.amazon.de/api/tunein/queue-and-play?deviceSerialNumber=90F00818708606V5&deviceType=AB72C64C86AW2&guideId=Antenne Bayern

seems caused by the whitespace. Not sure how to specify this differently.

When I change the command to:
echo_wz_radioid.sendCommand(‘AntenneBayern’)

this also does not work. The Echo tells me that it cannot play music currently. When I run the command via voice everything works fine though.

1 Like

Try:

echo_wz_radioid.sendCommand("Antenne\ Bayern")

or

echo_wz_radioid.sendCommand("Antenne%20Bayern")

Thanks, tried the %20 and the exception is gone.
The result though is still that Alexa tells me it has difficulties to play the music while the station via voice works perfectly fine.

Solved my problem now.
The TuneIn API expects some internal code as a guideId and not a name or search term as I have given before.
Had some issues to find this guideId from the API since alexa.amazon.de doesn’t allow me to open the Tunein app with an error message " App-Unterstützung nicht verfügbar". So I couldn’t look at the browser console to find the id.
But the search on tunein.com shows the ID at the end of the URL once the correct sender is selected. In my case “s42824”.

1 Like

I made a little GUI for this, you don’t have to reinvent the wheel :wink:

2 Likes

Doesnt work for me with %20.
\ and Space throws an error:

{
	"resource": "/Volumes/openHAB-conf/rules/Audio.rules",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "org.eclipse.xtext.diagnostics.Diagnostic.Syntax.Range",
	"severity": 8,
	"message": "Invalid escape sequence (valid ones are  \\b  \\t  \\n  \\f  \\r  \\\"  \\'  \\\\ )",
	"startLineNumber": 94,
	"startColumn": 68,
	"endLineNumber": 94,
	"endColumn": 70
}

Any other ideas? I managed to use the workaround with the station id but for spotify the playlist “number” does not work .…