python-alexa-voice-service icon indicating copy to clipboard operation
python-alexa-voice-service copied to clipboard

Stuck at SynchronizeState event

Open mingdee opened this issue 8 years ago • 6 comments

I am able to see the success of sending the 1st GET to establish the downchannel stream, but fail to see the response from sending the SynchronizeState event. The error I got is

PUSH b'{"header":{"namespace":"System","name":"Exception","messageId":"7d621fd0-f7fc-4c9a-b666-273e8a8ca2ac"},"payload":{"code":"INVALID_REQUEST_EXCEPTION","description":"Bad Request"}}' Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/local/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/home/pi/python-alexa-voice-service/alexa_device.py", line 181, in device_thread_function process_response_handle=self.process_response) File "/home/pi/python-alexa-voice-service/alexa_communication.py", line 178, in __init__ self.init_connection() File "/home/pi/python-alexa-voice-service/alexa_communication.py", line 201, in init_connection raise NameError("Bad status (%s)" % data.status) NameError: Bad status (400)

Any idea?

mingdee avatar Feb 15 '17 19:02 mingdee

Hello,

Try the following in the file alexa_device.py:

Locate the line return [context_audio, context_alerts, context_speaker] in the get_context function. On that line remove context_audio from the list. If I remember correctly, that's what solved my issue.

Shameless plug: I maintain a version of this code with wake word and a media player + playback functionality added. You can check it out here: https://github.com/mikeyy/pywakealexa

mikeyy avatar Feb 15 '17 20:02 mikeyy

@mikeyy, hey your suggestion works!! Thank you very much. Any idea why removing the audio context (the audio player state) works? Their docs shows the include of audio player state (and speech synthesizer state) in the context.

mingdee avatar Feb 16 '17 14:02 mingdee

Hello,

It would appear that one of the names changed within the AudioPlayer state. If you check the get_context function again you'll find a line that looks like "token": "audio_token",. On that line, change it to where it looks exactly like this "streamId": 0,.

Don't forget, I have most of the bugs and lack of functionality fixed in my maintained version of this code in the previously posted link.

mikeyy avatar Feb 16 '17 16:02 mikeyy

Thanks for the info. I will definitely take a look at your project. On Thu, Feb 16, 2017 at 11:29 AM Michael Mooney [email protected] wrote:

Hello,

It would appear that one of the variables name changed within the AudioPlayer state. If you check that function again you'll find a line that looks like "token": "audio_token",. On that line, change it to where it looks exactly like this "streamId": 0,. It would appear token was changed to streamId in the past, but that should fix your issue.

Don't forget, I have most of the bugs and lack of functionality fixed in my maintained version of this code in the previously posted link.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nicholasjconn/python-alexa-voice-service/issues/3#issuecomment-280381846, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVcLr2w_wuJ1PkWRVebkdwoBfQJDulXks5rdHmHgaJpZM4MCLND .

-- ../ming

mingdee avatar Feb 16 '17 18:02 mingdee

@mikeyy Thanks for the fix! But why not submit a PR?

tgarc avatar Jul 07 '17 23:07 tgarc

@tgarc My support is a pleasure. I will when I have some time, thanks for the reminder. I would have in the past but pywakealexa's code swayed too far from the original (python-alexa-voice-service) so I just started a new repository..

mikeyy avatar Jul 09 '17 12:07 mikeyy