Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform alexa_media does not generate unique Ids #260

Closed
niemyjski opened this issue Aug 1, 2019 · 17 comments · Fixed by #335
Closed

Platform alexa_media does not generate unique Ids #260

niemyjski opened this issue Aug 1, 2019 · 17 comments · Fixed by #335

Comments

@niemyjski
Copy link

image

System details

  • Home-assistant (version): 0.96.5
  • Hassio (Yes/No): yes
  • alexa_media (version from const.py or HA startup): latest via hacs
@niemyjski
Copy link
Author

2019-08-02 07:11:41 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform alexa_media.media_player: Platform not found (cannot import name 'MEDIA_PLAYER_SCHEMA' from 'homeassistant.components.media_player' (/usr/src/homeassistant/homeassistant/components/media_player/__init__.py)).
2019-08-02 07:11:41 INFO (MainThread) [homeassistant.components.notify] Setting up notify.alexa_media
2019-08-02 07:11:41 INFO (MainThread) [homeassistant.components.alarm_control_panel] Setting up alarm_control_panel.alexa_media
2019-08-02 07:11:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 390, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: alarm_control_panel.alexa_guard_18547. Platform alexa_media does not generate unique IDs

@alandtse
Copy link
Owner

alandtse commented Aug 8, 2019

Try out 1.4.0 and see if this error persists please.

@alandtse alandtse closed this as completed Aug 8, 2019
@genem2
Copy link

genem2 commented Aug 17, 2019

Hi,
Not sure if adding to a closed issue is acceptable...

(Each HA startup puts about 200 lines into the log, but I think I read you are still working other issues with .97.)

If there's anything I can add to this, please advise.
Gene
Pi: hassbian 4.19.58-v7+
python_version: 3.7.3
HA version: 0.97.1
alexa_media: version = '1.4.1'

@alandtse
Copy link
Owner

I'll see if additional checks are needed for this.

@genem2
Copy link

genem2 commented Sep 1, 2019

I was wondering if there was something I could provide you to help with this. Am I the only one still getting all these?
I have a log file create with:

custom_components.media_player.alexa: debug
alexapy: debug

Truth be told, I'm not sure if posting the log here discloses acct-specific info.
From what I can see in that log, nothing strange appears before the std complaints logged at eact start:

2019-09-01 10:43:44 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: alarm_control_panel.alexa_guard_ea947. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.villages_s_echo_dot. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.house. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.living_room. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.recroom. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.family_room. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.bedroom. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.reed. Platform alexa_media does not generate unique IDs
2019-09-01 10:43:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 399, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.everywhere_group. Platform alexa_media does not generate unique IDs

Pi 3, Hassbian,
2019-09-01_10-56-30

@alandtse
Copy link
Owner

alandtse commented Sep 1, 2019

@genem2 Are you still on 1.4.x? We actually did some changes when we went to 2.x that should stop this from happening. The logs you posted don't have anything private but we probably need to understand what happened before this snippet

Was there any other errors like a reconnect or disconnect?

(edit for grammar).

@genem2
Copy link

genem2 commented Sep 1, 2019

No, no. I check on this after each HACS update.
Today I'm at: version = '2.0.1'

any other errors like a reconnect or disconnect?

No, just the expected:

[alexapy.alexawebsocket] Connecting to wss://dp-gw-na-js.amazon.com/?x-amz-device-type=ALEGCNGL9K0HM&x-amz-device-serial=130-6350509-1763602-1567359652000 with {'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': '*', 'Cookie': 'session-id=140-6479908-1351625; session-id-time=2197474628l; ubid-main=130-6350509-1763602; session-token=
[Shortened]
; ', 'Origin': 'https://alexa.amazon.com', 'csrf': '-432764741'}
2019-09-01 

One of these for each of my two accounts.

@alandtse
Copy link
Owner

alandtse commented Sep 1, 2019

Oh wait. Do the two accounts share echo devices? We may not have a check for that.

@alandtse alandtse reopened this Sep 1, 2019
@genem2
Copy link

genem2 commented Sep 1, 2019 via email

@alandtse
Copy link
Owner

alandtse commented Sep 2, 2019

@genem2 can you try the fix I just staged? You'll need to replace 4 files. No worries if you can't, I'll just stage it in the next release so hopefully I'll finally resolve this old bug.

@genem2
Copy link

genem2 commented Sep 2, 2019

So, in .homeassistant\custom_components\alexa_media
I updated:

  • alarm_control_panel.py
  • media_player.py
  • switch.py

And added:

  • helpers.py

Also removed the earlier pycache (not sure if that would trip us up.)
See attached log.
NewLog.txt

@alandtse
Copy link
Owner

alandtse commented Sep 2, 2019

Your debug logging setting is wrong. Please see here.

Specifically,

custom_components.media_player.alexa: debug
Is the wrong line for the latest version.

Can you please fix the line and reattach?

@genem2
Copy link

genem2 commented Sep 2, 2019

So sorry. Corrected; new log attached.
190901-1914-log.txt

@alandtse
Copy link
Owner

alandtse commented Sep 2, 2019

@genem2 another version for you to try. I think the issue is coming from the fact you have multiple accounts. Some wires are getting crossed so I need to add additional checks.

@genem2
Copy link

genem2 commented Sep 2, 2019

I'm not finding the thread at the moment, but I comment in another (pre 2.0?)
It was issue #180 that I mentioned I was not having the ID's report unless I used my second acct. I only have that other one to support an Echo installed remotely in a somewhat public area. I don't have to worry about my Amazon acct, and have HA visibility to that, allows me to stop anyone playing music late night.

So, updated: __init__.py
alarm_control_panel.py
helpers.py

Here are some logs:
190902-0912-Both Accts.txt
190902-0909-Just Main Acct.txt
190902-0911-Just Secondary Acct.txt

@alandtse
Copy link
Owner

alandtse commented Sep 3, 2019

@genem2 ok, i refactored the way we load devices. Can you try the latest version in #324 please? Thanks again for all your help in testing.

alandtse added a commit that referenced this issue Sep 3, 2019
fix: add catch for HomeAssistantError when adding entities
alandtse added a commit that referenced this issue Sep 3, 2019
feat: allow exclusions for alarm_control_panel and switches
@alandtse alandtse mentioned this issue Sep 3, 2019
@genem2
Copy link

genem2 commented Sep 3, 2019

Awesome. Many thanks, @alandtse and @niemyjski for spending time on this work. Resolved!
Greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants