Thanks for this skill. It looks really comprehensive!!
Unfortunately, I'm having a hard time configuring it with the dreaded: "The remote endpoint could not be called, or the response it returned was invalid." message with a basic command like "ask kodi to pause". I've tried a ton of troubleshooting, but I just can't figure it out, so any help would be immensely appreciated
This is set up as Alexa->Lambda->Kodi and I've followed the instructions as far as I can tell, deployment to Lambda succeeds without errors, and I've tested that I can cURL the JSON-RPC endpoint from the Internet successfully, getting JSON back that I can indeed validate:
Code:
curl --data-binary '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":1}' -H 'content-type: application/json;' -u <username>:<password> http://<hostname>:<port>/jsonrpc
More details below:
On the Alexa skill side, I've made sure:
- intents, slot types, and utterances are fully populated with the slotgenerator
- Lambda arn populated for North America (us-east-1)
- the CloudWatch logs are:
Code:
/var/task/fuzzywuzzy/fuzz.py:35: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
START RequestId: e08df31a-e0f4-11e6-ae40-bf974765169b Version: $LATEST
lambda_handler: applicationId=<appID>
Verifying application ID...
on_session_started: requestId=EdwRequestId.76885fc8-a475-46cc-8811-f1fb8ac5de89, sessionId=SessionId.4e78cb1c-4f2a-46f9-a321-e621dac7da8d
on_intent: requestId=EdwRequestId.76885fc8-a475-46cc-8811-f1fb8ac5de89, sessionId=SessionId.4e78cb1c-4f2a-46f9-a321-e621dac7da8d
Requested intent: PlayPause
Playing or pausing
Sending request to http://<hostname>:<port>/jsonrpc
No JSON object could be decoded: ValueError
Traceback (most recent call last):
File "/var/task/wsgi.py", line 1932, in lambda_handler
return on_intent(event['request'], event['session'])
File "/var/task/wsgi.py", line 1899, in on_intent
return one_intent[1](intent_slots)
File "/var/task/wsgi.py", line 256, in alexa_play_pause
kodi.PlayPause()
File "/var/task/kodi.py", line 494, in PlayPause
playerid = GetPlayerID()
File "/var/task/kodi.py", line 880, in GetPlayerID
data = SendCommand(RPCString("Player.GetActivePlayers"))
File "/var/task/kodi.py", line 143, in SendCommand
return json.loads(r.text)
File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
END RequestId: e08df31a-e0f4-11e6-ae40-bf974765169b
REPORT RequestId: e08df31a-e0f4-11e6-ae40-bf974765169b Duration: 1377.53 ms Billed Duration: 1400 ms Memory Size: 128 MB Max Memory Used: 33 MB
On the Lambda side, which is probably where the problem is, I've:
- used lambda-deploy on python 2.7 on Ubuntu to deploy
- The env file looks like this:
Code:
KODI_ADDRESS = <hostname>
KODI_PORT = <port>
KODI_USERNAME = <username>
KODI_PASSWORD = <password>
SKILL_APPID = amzn1.ask.skill.<blah>
SKILL_TZ =
LAMBDA_ENV_VARS = KODI_SCHEME,KODI_ADDRESS,KODI_PORT,KODI_SUBPATH,KODI_USERNAME,KODI_PASSWORD,SKILL_APPID,SKILL_TZ
AWS_DEFAULT_REGION = us-east-1
LAMBDA_TIMEOUT = 60
LAMBDA_MEMORY_SIZE = 128
LAMBDA_HANDLER = wsgi.lambda_handler
AWS_ACCESS_KEY_ID = <id>
AWS_SECRET_ACCESS_KEY = <key>
LAMBDA_ROLE = arn:aws:iam::<id>:role/lambda_full_access