Echo Devices (Alexa) as Media Player - Testers Needed

Tags: #<Tag:0x00007f7c6e01afd0>

Issue solved! Thank you so much for your work on this project.

Perhaps this has been mentioned before, but regarding the last_called attribute;
I have two echos now with this attribute set as true (they do have different timestamps). This use to not be the case, where only one would show as true, but its been a few releases since I tested it.

I do have my echos associated with two Amazon accounts, but they both are and have been set to use the same account ever since I started using this custom component.
I’m running 2.5.1 on 104.0.

And only one account is used by the component?

Yes, only one account is listed under the component’s configuration:

alexa_media:
  accounts:
    - email: !secret alexa_user
      password: !secret alexa_passwd
      url: amazon.com


I’m seeing this too, running 2.5.1 on Hass.io 0.104.0b5 . I just updated to 2.5.1 this morning, thinking it might have fixed what I was seeing, so I’m pretty sure it was in 2.5.0 as well.

Last Alexa only working for me in v2.4.1. Both v2.5.0 and v2.5.1 not working

Great work on Alexa,
Question
why are all the, switches repeats, dnd, shuffle etc unavailable, the only thing avaliable is the media player.
How can i stop them from being created in the first place as i cant workout why i would ever use them. And they just fill up my list of devices in Alexa.
I rather prefer the ability to use the media_player stop service.

This should be fixed in 2.5.2.

If everything is unavailable all the time that’s a bug. In that case check your region.

Do not disturb switches should always be available. The repeat/shuffle switches are only available when the media player is playing certain media that support them.

If you don’t use them, you can either disable the entity in HA or in the config.

Hey on another reboot after update to 104.1 the dnd became available. I did have them all disabled but was seeing all these log entries about it was unable to update entity as it is disabled. Having 13 echos, 3 shows, 3 subs, 4 fire tv and all the wha groups, and stereo pairs theres alot of these switches.

Last called now working for me in v2.5.2, thanks!

I have alexa integration inactive…

I have HASSIO 0.104.1 and alexa_media_player 2.5.2

I don’t find alexapy library so I tried to install it using pip3 command but it returned this error:

Collecting alexapy
  Using cached https://files.pythonhosted.org/packages/15/9e/2c5140fdf2b4c43c6d2ad3cc0146e40354194a9d6de4ee0d9de20ba981da/AlexaPy-1.4.2-py3-none-any.whl
Collecting aiohttp
  Using cached https://files.pythonhosted.org/packages/c2/f7/f0ad3dbace4762fef5d80aa4124b41bf218e4c4dd6d387a86cede707d9a4/aiohttp-3.6.2-py3-none-any.whl
Collecting simplejson
  Using cached https://files.pythonhosted.org/packages/98/87/a7b98aa9256c8843f92878966dc3d8d914c14aad97e2c5ce4798d5743e07/simplejson-3.17.0.tar.gz
Collecting yarl
  Using cached https://files.pythonhosted.org/packages/d6/67/6e2507586eb1cfa6d55540845b0cd05b4b77c414f6bca8b00b45483b976e/yarl-1.4.2.tar.gz
Collecting bs4
  Using cached https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
Collecting requests
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting certifi
  Using cached https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl
Collecting backoff
  Using cached https://files.pythonhosted.org/packages/f0/32/c5dd4f4b0746e9ec05ace2a5045c1fc375ae67ee94355344ad6c7005fd87/backoff-1.10.0-py2.py3-none-any.whl
Collecting aiofiles
  Using cached https://files.pythonhosted.org/packages/cf/f2/a67a23bc0bb61d88f82aa7fb84a2fb5f278becfbdc038c5cbb36c31feaf1/aiofiles-0.4.0-py3-none-any.whl
Collecting multidict<5.0,>=4.5
  Using cached https://files.pythonhosted.org/packages/b6/22/ae21cedaa0e6d35e84e8ab57700dcf3d4609421ebe113e1aaafc468eec42/multidict-4.7.4.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting async-timeout<4.0,>=3.0
  Using cached https://files.pythonhosted.org/packages/e1/1e/5a4441be21b0726c4464f3f23c8b19628372f606755a9d2e46c187e65ec4/async_timeout-3.0.1-py3-none-any.whl
Collecting attrs>=17.3.0
  Using cached https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl
Collecting chardet<4.0,>=2.0
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna>=2.0
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting beautifulsoup4
  Using cached https://files.pythonhosted.org/packages/cb/a1/c698cf319e9cfed6b17376281bd0efc6bfc8465698f54170ef60a485ab5d/beautifulsoup4-4.8.2-py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl
Collecting soupsieve>=1.2
  Using cached https://files.pythonhosted.org/packages/81/94/03c0f04471fc245d08d0a99f7946ac228ca98da4fa75796c507f61e688c2/soupsieve-1.9.5-py2.py3-none-any.whl
Building wheels for collected packages: multidict
  Building wheel for multidict (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.8 /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpbhucbwp2
       cwd: /tmp/pip-install-iexeel3s/multidict
  Complete output (43 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.8
  creating build/lib.linux-armv7l-3.8/multidict
  copying multidict/_multidict_base.py -> build/lib.linux-armv7l-3.8/multidict
  copying multidict/_multidict_py.py -> build/lib.linux-armv7l-3.8/multidict
  copying multidict/_compat.py -> build/lib.linux-armv7l-3.8/multidict
  copying multidict/__init__.py -> build/lib.linux-armv7l-3.8/multidict
  copying multidict/_abc.py -> build/lib.linux-armv7l-3.8/multidict
  running egg_info
  writing multidict.egg-info/PKG-INFO
  writing dependency_links to multidict.egg-info/dependency_links.txt
  writing top-level names to multidict.egg-info/top_level.txt
  reading manifest file 'multidict.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files found matching 'multidict/_multidict.html'
  warning: no previously-included files found matching 'multidict/*.so'
  warning: no previously-included files found matching 'multidict/*.pyd'
  warning: no previously-included files found matching 'multidict/*.pyd'
  no previously-included directories found matching 'docs/_build'
  writing manifest file 'multidict.egg-info/SOURCES.txt'
  copying multidict/__init__.pyi -> build/lib.linux-armv7l-3.8/multidict
  copying multidict/_multidict.c -> build/lib.linux-armv7l-3.8/multidict
  copying multidict/py.typed -> build/lib.linux-armv7l-3.8/multidict
  creating build/lib.linux-armv7l-3.8/multidict/_multilib
  copying multidict/_multilib/defs.h -> build/lib.linux-armv7l-3.8/multidict/_multilib
  copying multidict/_multilib/dict.h -> build/lib.linux-armv7l-3.8/multidict/_multilib
  copying multidict/_multilib/istr.h -> build/lib.linux-armv7l-3.8/multidict/_multilib
  copying multidict/_multilib/iter.h -> build/lib.linux-armv7l-3.8/multidict/_multilib
  copying multidict/_multilib/pair_list.h -> build/lib.linux-armv7l-3.8/multidict/_multilib
  copying multidict/_multilib/views.h -> build/lib.linux-armv7l-3.8/multidict/_multilib
  running build_ext
  building 'multidict._multidict' extension
  creating build/temp.linux-armv7l-3.8
  creating build/temp.linux-armv7l-3.8/multidict
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.8 -c multidict/_multidict.c -o build/temp.linux-armv7l-3.8/multidict/_multidict.o -O2 -std=c99 -Wall -Wsign-compare -Wconversion -fno-strict-aliasing -pedantic
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for multidict
  Running setup.py clean for multidict
Failed to build multidict
ERROR: Could not build wheels for multidict which use PEP 517 and cannot be installed directly

Managed to get the timer and reminder sensors working and now I want to show them on the UI (I have a wall mounted tablet). Anyone got any suggestions on the best Lovelace card to use? I like the Entities card as it shows the countdown although it doesn’t say what the timer is for (if you’ve named it). Also, it always shows even if there is no timer (or reminder) set as they always show as unavailable. Any way to show this only when there’s an active timer/reminder? Thanks

Hi,

i wrote a script which I exposed to alexa in order to ask which timer are active.
I have 6 echos collected in a group before.
Perhaps it can push you into the right direction:

question_open_reminder:
  sequence:
  - service: alexa_media.update_last_called
  - delay: '00:00:01'  
  - service: notify.alexa_media
    data_template:
      target: '{{states.sensor.last_called_alexa.state}}'
      data:
        type: tts
      message: >
        {%if states | selectattr('entity_id','in',state_attr('group.all_alexa_sensors','entity_id')) | selectattr('state','eq','unavailable') | list | count | int == 18 %}
            There is no timer, alarm or reminder set
        {% else %}
           {%- for entity_id in states.group.all_alexa_sensors.attributes.entity_id if states(entity_id) != 'unavailable' -%}
            {% if loop.first %} the following times are set {% elif loop.last %} and {% else %} , {% endif -%}
             {{ state_attr(entity_id,'friendly_name') + ' in  ' }} {{( (as_timestamp(states(entity_id)) - as_timestamp(now())) / 60) |int }} Minutes
           {%- endfor %}
        {% endif %}

By the way: my wife likes to get the minutes left and not the time of getting valid :slight_smile:

Thanks Pirol_62 I like your script and I’ll have to give it a crack as it is pretty cool. It’s not quite what I’m looking for though as this (I presume) will get alexa to announce all active timers etc when you ask. I want to be able to walk past the tablet and see the timers set and the remaining time without having to ask.

Last called now working for me in v2.5.2, as well!! thanks!

1 Like

Ditto on last_called working in 2.5.2 . Thank you SO much for quick response!

I’m currently putting in some logic to skip creation of illogical switches or to hide them when you can’t use them.
In that vein, would people want timers/alarms/notifications to be hidden from the UI if there isn’t any detected? You would still be able to access them in scripts.

1 Like

Good idea, makes sense and enforces the focus on that, what we want to know

I’d love to have a lovelace card that could show all active timers and reminders and show the card only when they’re active. I’ve partially managed this with the following

show_empty: false
card:
  type: entities
filter:
  include:
    - entity_id: sensor.*_next_timer
    - entity_id: sensor.*_next_reminder
  exclude:
    - state: unavailable

It works pretty well but only shows the timer or reminder that’s due next and not the detail of it. It would be great to have it show all active reminders and timers with the details pulled from the code. I can see that the timer/reminder info is there but no idea how to grab it and put it into a card.

Just some thoughts for the much cleverer people than me out there to consider :slight_smile:

My issue was with the cookie that I exported and saved to /tmp per the instructions on github. I found that I had to make a cookie for https://pitangui.amazon.com instead of alexa.amazon.com