Echo Devices (Alexa) as Media Player - Testers Needed

I am having the same issue - any luck?

I have a Sengled bluetooth bulb connected to Home Assistant through the Alexa Media Player integration - I am able to change the color of the light a few times before the following is issued and the light fails

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/alexa_media/alexa_entity.py:329
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 18:39:03 (4 occurrences)
Last logged: 18:39:21

[139889474582080] can't compare offset-naive and offset-aware datetimes

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1526, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 658, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 760, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 695, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 417, in async_handle_light_on_service await light.async_turn_on(**filter_turn_on_params(light, params)) File "/config/custom_components/alexa_media/light.py", line 329, in async_turn_on await self._set_state(True, brightness, mired, hs) File "/config/custom_components/alexa_media/light.py", line 317, in _set_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 368, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 402, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 374, in _stringify_state state = self.state File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 772, in state return STATE_ON if self.is_on else STATE_OFF File "/config/custom_components/alexa_media/light.py", line 215, in is_on power = parse_power_from_coordinator( File "/config/custom_components/alexa_media/alexa_entity.py", line 277, in parse_power_from_coordinator return parse_value_from_coordinator( File "/config/custom_components/alexa_media/alexa_entity.py", line 305, in parse_value_from_coordinator if is_cap_state_still_acceptable(cap_state, since): File "/config/custom_components/alexa_media/alexa_entity.py", line 329, in is_cap_state_still_acceptable return time_of_sample >= since TypeError: can't compare offset-naive and offset-aware datetimes

Can anybody help me? I don’t know what happened to Alexa Media Player not loading. I don’t know anything about codes, but it follows the Home Assistant error log.

Captura de tela 2021-08-18 032353

Logger: homeassistant.setup
Source: custom_components/alexa_media/__init__.py:16
Integration: Alexa Media Player ([documentation](https://github.com/custom-components/alexa_media_player/wiki), [issues](https://github.com/custom-components/alexa_media_player/issues))
First occurred: 3:11:45 (1 occurrences)
Last logged: 3:11:45

Setup failed for alexa_media: unknown error

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 201, in _async_setup_component component = integration.get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 490, in get_component cache[self.domain] = importlib.import_module(self.pkg_path) File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/config/custom_components/alexa_media/__init__.py", line 16, in <module> from alexapy import ( File "/usr/local/lib/python3.9/site-packages/alexapy/__init__.py", line 16, in <module> from .alexaapi import AlexaAPI File "/usr/local/lib/python3.9/site-packages/alexapy/alexaapi.py", line 23, in <module> from .alexalogin import AlexaLogin File "/usr/local/lib/python3.9/site-packages/alexapy/alexalogin.py", line 49, in <module> class AlexaLogin: File "/usr/local/lib/python3.9/site-packages/alexapy/alexalogin.py", line 221, in AlexaLogin def set_totp(self, otp_secret: Text) -> Optional[pyotp.TOTP]: AttributeError: module 'pyotp' has no attribute 'TOTP'

Remove and readd the integration.

I was changing something on Alexa and removed the integration to readd it again

I have done this many times before. But this time I cannot make it work.

No matter what I try. With 2FA. With Oauth. It all fails. Fail fail fail. I can login to alexa.amazon.com with no problem

Is there a current clitch in the system? Anyone else with same issue?

1 Like

Follow up. Restore of backup of HA also restores Alexa. But then my new Alexa device is not loaded. So it is not a solution. The component works when installed. But installation goes into a loop from hell where the authentication ends in a 400 bad request or looks like a success but a new window just pops up asking to open the Amazon auth page again and again and again. I have tried legacy method also and then I never get anywhere. Nothing works. I tried Google Chrome. I tried Firefox. I tried Chrome on a Linux computer. I cannot get it to work at all. The HA log is full of errors when it happens but I cannot interpret anything from it. It does not look like code errors. Just that the process fails

Edit. New devices are loaded without reinstalling but because I always rotate my devices (new device, older rotates in rooms, oldest in the bin) there is a lot of manual renaming in HA which you avoid by reinstalling. I ended up restoring a HA snapshot and renaming. After 50 failed attempts I had to give up on installing. I hope it was a temporary glitch with Amazon.

Hi, I am able to send custom commands using this integration. However, one of the commands simply returns the status of a device when run from an Amazon device (sound via echo or text via the Alexa app). Is it possible to get this textual response in HA somehow?

Help! So I updated my HA to the latest 2021.8.8 and my Alexa Media Player integration came up with an error which I couldn’t solve. So I thought I remove then re-add the integration however after removing it now doesn’t show up in the integration page. I downloaded the latest components, removed the files from custom_components directory, re-added them after rebooting multiple times but nothing that I do makes the integration come back, what am I doing wrong? Thanks.

working fine without need to re-login for several months, but stopped working yesterday. after deleted the integration but failed to add it back many tries.

finally able to add it back, I deleted the integration, deleted custom repo, deleted the alexa_media folder under custom_components, reboot HA in between. then do a fresh install, when adding the integration it redirect me to the alexa.amazon.com (first time that I ever redirect to this page!) and it worked now!

1 Like

Hi, since two days type announce does not work for my echo shows anymore. For all other echos it works. I have to switch to tts. Has anybody detected the same?

Update: I figured out the bug.
Obviously an update of the echos muted the two echo shows.
At least reading the wiki pushed me into the right direction.
Announce is working again. (Sometimes it is simply better to have this sound before alexa speaks)

QQ - Where do you add to config to include sensors? (sensor.xyz.next_alarm)

In alexa_media: under account, include_devices: full sensor name?

Not working for me.

alexa_media:
  accounts:
    - email: !secret amazon_email
      password: !secret amazon_pwd
      url: amazon.com
      include_devices:
        - "sensor.office_show_next_alarm"

Having an issue configuring the component.
Seems like we have a new configuration window.
I’ve entered my new password and I get the error message that says:
There was a problem
Enter a valid email or mobile number

I am not sure if it checks the for some formatting of an email address and also not sure if it’s because mine is a little unconventional it ends with @maine.rr.com but this is the account that I’ve always used in the past. I also tried to enter my mobile phone number in different format, but that didn’t work. Maybe posting a hint of what the format should be would also help. ( is it 1-123-234-3456 or 123-234-3456 or 1232343456)

Anyone have a suggestion on how I can get this working again?

Had this issue. Surprisingly a quick reboot fixed it. Rebooted and then it prompted for 2FA. Entered that and was good to go.

@martoq Thanks, this worked for me, not sure why I didn’t think of restarting in the first place. Geezz

Hi,
my alarm sensors are generated automatically. Did you have a look if they show up within entities?

Sensors are either defined in configuration.yaml like

sensor:
  - platform: 

or in a separate file like e.g. sensors.yaml, but I don’t think you can (or should) define it manually for echo devices.

Hello,
Today I decided to start using Nabu Casa, I had my (Alexa) media Players working fine, but now none of my scripts or automations (for Alexa media player) are working. Is there a setting I was suppose to do or does it just not work with Nabu Casa?

I’m stuck in a re-authentication loop.

I set it up to use the built-in 2FA.

I click on “reconfigure” and this pops up.

Since I already set up the built-in 2FA I click submit.

it asks for the 2FA code that I get from Amazon:

amp_auth_2

Why? I thought that was what the built-in 2FA was supposed to do.

OK, anyway, I enter the code and I get this:

ex1

It says it successfully authenticated but it also says aborted and my AMP stays un-authenticated.

What the heck am I doing wrong?

It seems this is an ongoing problem with authentication.

Is there any way to have a step-by-step walkthru of the steps required to re-authenticate when using the multitude of various authentication methods put into the wiki?

this happens only occasionally and trying to remember all of the “magical” steps required to successfully re-authenticate is a bit frustrating.

I don’t mind helping to write something up for the method I use once I can repeatably re-authenticate.

1 Like

Can’t reauthorize either, and seems others are stuck too.

Thinking this is an issue with Alexa. Hopefully they’ll fix it soon.

Update- can’t control guard mode in my mobile app either so that would imply an outage/issue on the Alexa side.

1 Like

You’re doing nothing wrong, it just doesn’t work at the moment. This and Tuya :sob::rage:

1 Like

Thanks to both of you.

Thought I was losing my mind.

However the comment about the re-authentication procedure being confusing still stands along with the offer to help improve the docs if I get the procedure confidently worked out.

2 Likes