alandtse / alexa_media_player

This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.
Apache License 2.0
1.49k stars 286 forks source link

Announce and TTS stop working if wrong domain specified #507

Closed craggyh closed 4 years ago

craggyh commented 4 years ago

Describe the bug This integration was working great and announcing without any issues to both of my Echo Dot 3s until I updated to the latest version 2.4.1 from 1.3. Now announcements or TTS don't work. I deleted the whole plugin and alexa pycache file. Restarted HASS and reinstalled clean from HACS, re-registered and completed captcha. Echo is detected fine and added but no announcements or TTS play our from HASS. I then tried on a brand new clean HASS install and it's the exact same.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

System details

Logs Please provide logs. We'll be most likely asking for them anyway.

2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] Message: Water Filter one, Out of salt, kwargs: {'target': ['G090VC0784142RWR'], 'data': OrderedDict([('method', 'all'), ('type', 'announce')])}
2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] Testing item: G090VC0784142RWR against (<Entity Alexa Kitchen: standby>, Alexa Kitchen, G************RWR, media_player.alexa_kitchen)
2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] Converting: G090VC0784142RWR to (entities): <Entity Alexa Kitchen: standby>
2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] Testing item: <Entity Alexa Kitchen: standby> against (<Entity Alexa Kitchen: standby>, Alexa Kitchen, G************RWR, media_player.alexa_kitchen)
2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] Converting: <Entity Alexa Kitchen: standby> to (serialnumbers): G0XXXWR
2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] Announce targets: ['G************RWR'] entities: [<Entity Alexa Kitchen: standby>]
2020-01-11 21:13:28 DEBUG (MainThread) [custom_components.alexa_media.notify] c***********d@g*******m: Announce by <Entity Alexa Kitchen: standby> to targets: ['G************RWR']: Water Filter one, Out of salt
2020-01-11 21:13:28 DEBUG (MainThread) [alexapy.alexaapi] Creating sequence for 1 items
2020-01-11 21:13:28 DEBUG (MainThread) [alexapy.alexaapi] Running behavior with data: {"behaviorId": "PREVIEW", "sequenceJson": "{\"@type\": \"com.amazon.alexa.behaviors.model.Sequence\", \"startNode\": {\"@type\": \"com.amazon.alexa.behaviors.model.SerialNode\", \"nodesToExecute\": [{\"@type\": \"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode\", \"type\": \"AlexaAnnouncement\", \"operationPayload\": {\"deviceType\": \"A32DOYMUN6DTXA\", \"deviceSerialNumber\": \"G0XXX2RWR\", \"locale\": \"en-gb\", \"customerId\": \"A2CNDK6VLKC5LI\", \"expireAfter\": \"PT5S\", \"content\": [{\"locale\": \"en-gb\", \"display\": {\"title\": \"Home Assistant\", \"body\": \"Water Filter one, Out of salt\"}, \"speak\": {\"type\": \"text\", \"value\": \"Water Filter one, Out of salt\"}}], \"target\": {\"customerId\": \"XXX\", \"devices\": [{\"deviceSerialNumber\": \"XXX\", \"deviceTypeId\": \"A32DOYMUN6DTXA\"}]}, \"skillId\": \"amzn1.ask.1p.routines.messaging\"}}]}}", "status": "ENABLED"}
2020-01-11 21:13:28 DEBUG (MainThread) [alexapy.alexaapi] POST: https://alexa.amazon.com/api/behaviors/preview <CIMultiDictProxy('Host': 'alexa.amazon.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': '*', 'Referer': 'https://alexa.amazon.com/spa/index.html', 'Origin': 'https://alexa.amazon.com', 'csrf': '1388372022', 'Accept-Encoding': 'gzip, deflate', 'Cookie': 'at-main=Atza|IwEBIK4p5u2SaFOffIUcMttwnBjS_rjEL72Nu3IbVdUMmmunQOgXIYzPvRQNd65LwjVbRBgnXWy3UEQv0tc2ycssqYjij6aSqAL_Rb2ZxWLyXou8UEEvSkLuKu2Rr9Nf2Mt083xyqGM0o3iLmypTc1IeGNtO6DYS7SayUFQs7wevQyzdGS397dTKHqLlyERjy_fwc6pmocDY4LHFJkhhqIAOqe5ZBu3sUxi7FZwjIDUBz03NEVa7qtEiapFrvPeovTC_dVGEW6qxXUtVV3hhSl-DgtGlnRteOUmcPHviwiaeF_cAb4gxqwd-ePa-f0xTYq_ypRUfpFeIpmwQam1YxgMex0F8TJCnw2-JdYO7dm3ecSSyWeT7Q3JMdt-_z16wsEmDQpfYQHq9IfpM_Bdof8hFFF6l; csrf=1388372022; sess-at-main="FF0yniprNVBsc5Zia5xLqIgQc09rIkhljMEGZUthfj8="; session-id=138-5912658-1322317; session-id-time=2209128181l; session-, 'Content-Length': '937', 'Content-Type': 'application/json')> returned 200:OK:application/octet-stream

Additional context Add any other context about the problem here.

alandtse commented 4 years ago

Can you confirm the region your Alexa devices should be a part of? The logs aren't showing any errors. FYI, I deleted your old logs since you left in your cookie info and some other info. I cleaned it out in the edit above.

alandtse commented 4 years ago

Please also confirm that you can issue an announce or tts by building a routine in the Alexa app and triggering that.

craggyh commented 4 years ago

Oops, thanks for the cleanup.

The alexa devices should be set to Amazon UK i think because I'm in Ireland. They show as UK in my Amazon account.

I can use the announce from the Alexa app and it works fine.

alandtse commented 4 years ago

Make sure you're using the Amazon.co.uk domain. The logs are saying you logged into the US server. That would cause the issues you're seeing. Please reopen if that doesn't fix it.

alandtse commented 4 years ago

Remove the integration and re-add. One of the fields is Amazon region domain and lists amazon.co.uk as an example.