Echo Devices (Alexa) as Media Player - Testers Needed

I am not able to log in also. I used to be able to log in when the captcha and 2FA was prompted from notifications, today I noticed that I needed to do this from the integrations page. Typically getting 2FA is a two step process but now it looks like I need to provide everything in one shot but not sure how that is possible. Anyway, I tried with a blank 2FA and some random numbers either way I did not get my 2FA code from amazon. Stuck and there does not appear to be any help available for this new form of sign-in. As of now I see a message about needing to enter an “valid email” I wonder if something went wrong due to too many failed attempts.

I must admit that each time I see this need to relogin I remove the Alexa Media Player integration and add it again.

Before you do this setup your 2FA to use an authenticator app. I use the Google Authenticator app. When you set it up, Amazon shows a QR code which you load via the camera to the Google Authenticator app on your phone. If you take an photo of it you can add it again later to an iPad. You can even take the code and load it to an Authenticator integration in HA if you dare. This way you do not need to fight with getting Amazon to send a push code to your phone. You just open the app and it will always show a 6 digit code that changes every 30 seconds

1 Like

Appreciate the response, I completely forgot that I had a 2FA app already setup. It worked, but not sure if it had anything to do with a reboot of the system which I did not do before.

How do I log on without using 2FA. Is it possible?

Regards Dave

Is there any way to add devices to the list of inclusions or exclusions once the integration is configured? Or is the only way to delete the integration and re-add it?

like this

# https://github.com/keatontaylor/alexa_media_player
accounts:
- email: !secret alexa_email
  password: !secret alexa_password
  url: amazon.com  
  exclude_devices:
  - "This Device"

2FA has been recently made mandatory:

Yes, I suppose I could do that. But, I was under the impression that the UI configuration flow was the recommended way to configure the integration.

The config flow doesn’t allow for editing entries yet. You can remove/readd until HA allows it or let the configuration.yaml update it as suggested.

The reauth prompt should be enough to log in again. If it doesn’t, that’s a bug I’d need to fix. You’re welcome to do the remove/readd but they should be equivalent as they both use the same login flow. The only difference is the remove path will actually unregister everything from HA and then reregister.

With the ‘entity_id’ option being deprecated in templates in 115 can someone point me in the right direction on how to do the last_alexa yaml now? Currently mine looks like this

- platform: template
  sensors:
      last_alexa:
        entity_id:
          - media_player.granddad
          - media_player.nanny
          - media_player.sarah
          - media_player.vicky
          - media_player.jukefire
          - media_player.the_kitchen
        value_template: >
          {{ states.media_player | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}

But I get an error in the log which I think refers to the above YAML.

Log Details (WARNING)
Logger: homeassistant.components.template.sensor
Source: helpers/config_validation.py:752
Integration: template (documentation, issues)
First occurred: 18 September 2020, 23:40:26 (1 occurrences)
Last logged: 18 September 2020, 23:40:26

The 'entity_id' option is deprecated, please remove it from your configuration

Thanks
Simon

I am looking for a solution to this minor issue as well. Since it is a warning, only, You can safely ignore it. The documentation in the Wiki needs to be updated to reflect this change as well, as many of us are scratching our heads. Why was entity_id deprecated in the first place?

Does people also have problems to re login again?
I get the message saying my password is incorrect. It is correct. After upgrade to 0.115.1 I see this error.

EDIT: Got the solution myself

Ok, finally what I did now:
filled in my email, password, Amazon Region domain. DID NOT give the 2FA
Then a popup asked me for a 2FA, 2FA was send to my mobile numbers. Filled in and WHOOP everything is back.

Maybe the 2FA part in first login screen must be deleted? Because Amazon will send you a 2FA?

hello everyone,
today I received notification for reconfiguration of the integration as usual I received this every two or three week and I stuck with 2FA.
I tried something new today and work very well
I logged in amazon.com account

  • account & list
  • Login & security
  • Two-Step Verification (2SV) Settings
    I clicked on require OTP on all devices
    after that I tried on home assistant everything back to normal I received 2FA and everything good so far
    sorry for my bad English and I hope help you with this method

I haven’t yet upgraded to 0.115, but reading other threads on this, and playing around with the template editor, see if the following works:
We need to move the list of entities into the template itself, so delete the entity_id and the players in the list. In the template do something like:

value_template: >
  {% set alexa_players = [ states.media_player.granddad,states.media_player.nanny,..etc.... ] %}
  {{ alexa_players | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}

EDIT
I just upgraded to 0.115.2 and I tried that out. It does work, but for some reason it throws an error but only on startup.

Another way that seems to work without throwing the error is the following:

  - platform: template
    sensors:
      last_alexa:
#       entity_id:
#         - media_player.echo1
#         - media_player.echo2
#         - media_player.echo3
        value_template: >
          {{ expand(states.media_player.echo1, states.media_player.echo2, states.media_player.echo3) | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}

EDIT2:
It turns out the first approach that throws an error at startup time was a bug, and there is a fix in place for it.

1 Like

Showing need authentication today, as usual, I deleted the integration and tried to add it again, but failed due to not able to login. error in the log:

2020-09-20 22:57:28 WARNING (MainThread) [alexapy.helpers] alexalogin.login((<alexapy.alexalogin.AlexaLogin object at 0x7f703c4e4760>,), {'cookies': {}, 'data': OrderedDict([('email', '*******@g*******m'), ('password', '*********'), ('url', 'amazon.com'), ('debug', False), ('scan_interval', 60), ('include_devices', ''), ('exclude_devices', ''), ('securitycode', '******')])}): An error occured accessing AlexaAPI: An exception of type RuntimeError occurred. Arguments:
881:2020-09-20 22:57:28 WARNING (MainThread) [custom_components.alexa_media.config_flow] Unknown error: Session is closed

Updated HASS to 0.115 and tried again but still failed. Tried enter 2FA or left it blank, both failed.

I have the same issue. Mote succintly, it looks like there is cross-site scripting going on, which is blocked at the firewall. I’m not sure this is completely correct as I haven’t going debugging. I’m just saying the integration won’t authenticate to Amazon because the Captcha doesn’t appear.

I ran into the sudden need to re-auth issue that everyone else is talking about. I guess I got locked out of Amazon and had to do the forgot password process. This never seemed to work right and I decided to delete all Alexa Media Player integrations and start over. However, I cannot find the Alexa media player integration option either in HACS or in the HA Integrations page. I’ve done multiple restarts to no avail. Do I need to remove the underlying directories or someting like that to get it the show as an integration again?

I just clicked on submit after entering some xxx in captcha, after that I received a new window with the picture, entered a captcha twice and then received my SMS with the 2fa code.
After that I had tho reenter a new captcha two times before the login have been accepted. Annoying

Same thing happened to me yesterday. I was forced to reauthorize and in the process I ended up with the Failed Password issue.

What worked for me was to delete the integration (Configuration —> Integrations), then Reinstall the integration in HACS and then go back to Configuration and add the integration.

I also started using Google’s Authenticator app.

I was able to finally make this work. I think it was the combination of two things. 1) I started using an authenticator app since email/text was cycling before I could enter it; and 2) I removed and re-added the whole alexa_media folder in my custom components directory. Once I did those things and restarted, HA discovered Alexa Media and then all it did when I clicked configure was to ask for my 2FA code from my authenticator app. There is a third thing that may or may not be related. I configured the old setup of user/pass in my configuartion.yaml. This actually might cause issues later if I were to use HACS or built-in integration. Neither HACS or the built-in integrations show Alexa Media as a selectable integration so I don’t know what’s going on there.