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

High Cpu Bug with alexa media player integration #1929

Closed
zeldoy24 opened this issue May 5, 2023 · 16 comments
Closed

High Cpu Bug with alexa media player integration #1929

zeldoy24 opened this issue May 5, 2023 · 16 comments

Comments

@zeldoy24
Copy link

zeldoy24 commented May 5, 2023

Describe the bug

The cpu load is higher than it should be and fluctuates between 10 percent to 30 percent.

To Reproduce

  1. Go to '/http://homeassistant.local:8123/config/dashboard'
  2. Click on 'system and hardware.'
  3. Scroll down to 'Processor'
  4. See error: Higher cpu since update

Expected behavior

Screenshots
log 1

System details

  • Home-assistant (version): 2023.5.2
  • alexa_media (version from const.py or HA startup): V.4.6.2
  • alexapy (version from pip show alexapy or HA startup): Unable to locate this
  • Amazon 2FA is enabled (y/n). Y <!---We will not debug login issues if unanswered--->: Yes, its enabled.

Logs
Please provide [logsLogger: homeassistant.components.alexa.state_report
Source: components/alexa/state_report.py:106
Integration: Amazon Alexa (documentation, issues)
First occurred: 6:59:53 PM (14 occurrences)
Last logged: 7:01:53 PM

Timeout sending report to Alexa for sensor.washroom_temperature
Timeout sending report to Alexa for sensor.bedroom_temperature
Timeout sending report to Alexa for light.bedroom
Timeout sending report to Alexa for light.bedroom_2
Timeout sending report to Alexa for light.bedroomm
Timeout sending report to Alexa for sensor.kitchen_light_temperature
Timeout sending report to Alexa for sensor.openweathermap_temperature
Timeout sending report to Alexa for sensor.openweathermap_feels_like_temperature
Timeout sending report to Alexa for sensor.openweathermap_forecast_temperature
Timeout sending report to Alexa for sensor.meter_plus_d4ff_temperature

2023-05-05 18:56:54.395 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up alexa_media platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/alexa_media/binary_sensor.py", line 36, in async_setup_platform
account = config[CONF_EMAIL] if config else discovery_info["config"][CONF_EMAIL]
KeyError: 'email'
2023-05-05 19:00:09.730 ERROR (MainThread) [homeassistant.components.alexa.state_report] Timeout sending report to Alexa for media_player.francis_s_echo_show
Additional context
tried reverting to previous versions, and did not help and makes all my automations super slow.....

@alandtse
Copy link
Owner

alandtse commented May 6, 2023

All your timeout errors point to the core integration. Not this component. If you remove that does it resolve the CPU issue?

The entries related to this component show amp hasn't even loaded since it can't find an email address. That should be a one time failure and wouldn't impact the CPU.

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

No it only goes down when disabling the Alexa media player integration 🤔 @alandtse

@alandtse
Copy link
Owner

alandtse commented May 6, 2023

Don't ping me. I'm already in the thread and it's rude to do it when someone isn't even involved. Remove the integration entirely and restart HA. Check if the Alexa time outs still happen. I don't use the core integration so don't know how often it may trigger so make sure you've given it enough time.

After that add the integration and provide logs.

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

My bad . When you say the core integration, you're talking about the Alexa media player integration that's located in the devices and integration ?

@alandtse
Copy link
Owner

alandtse commented May 6, 2023

Actually, after readding the integration, enable debug logs and restart HA once more so I can see the startup state.

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

Won't let me re add it because whenever i try to re add it it wont pass the authentication part for Alexa media player

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

It should log me into another webpage and ask me to re add my Amazon account information. At that part it won't load that specific page.

@alandtse
Copy link
Owner

alandtse commented May 6, 2023

Well the issue is if you're restoring a bad backup with incomplete info like missing email address, the component won't work. That is the key error you're getting. I can't really debug it since the config is broken. You'll just have to watch the other issue for a solution before I can help you on this.

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

What if my previous backup worked ? Shouldn't that have solved the high CPU issues ?

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

so update when re adding the integration "alexa media player" i changed the nabu casa to the local http://homeassistant.local:8123/ and it worked re adding it. however it spikes up the cpu once again to 30 percent. so I re added will now share you the log after a restart.

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

"/usr/src/homeassistant/homeassistant/helpers/entity.py", line 554, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
    await coro
  File "/config/custom_components/alexa_media/helpers.py", line 156, in _catch_login_errors
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 909, in async_update
    await self.refresh(  # pylint: disable=unexpected-keyword-arg
  File "/config/custom_components/alexa_media/helpers.py", line 156, in _catch_login_errors
    result = await func(*args, **kwargs)
  File "/config/custom_components/alexa_media/media_player.py", line 569, in refresh
    await self._update_notify_targets()
  File "/config/custom_components/alexa_media/media_player.py", line 1525, in _update_notify_targets
    await notify.async_register_services()
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 288, in async_register_services
    if self.targets is not None:
  File "/config/custom_components/alexa_media/notify.py", line 152, in targets
    entity_name = (entity.entity_id).split(".")[1]
AttributeError: 'NoneType' object has no attribute 'split'  

this is the log after a restart...........very interesting...........seems like an update issue ?

@zeldoy24
Copy link
Author

zeldoy24 commented May 6, 2023

2023-05-06 17:26:47.934 ERROR (MainThread) [homeassistant.components.light] Error while setting up alexa_media platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/alexa_media/light.py", line 72, in async_setup_platform
    account = config[CONF_EMAIL] if config else discovery_info["config"][CONF_EMAIL]
KeyError: 'email'

after re adding it sucessfully (alexa media player) still receiving this error

@alandtse
Copy link
Owner

alandtse commented May 7, 2023

This is still not the logs I asked for.

@zeldoy24
Copy link
Author

zeldoy24 commented May 7, 2023

i don't have see any other logs ...maybe i am not looking in the right place.

@zeldoy24
Copy link
Author

zeldoy24 commented May 7, 2023

i am not sure what log im looking for but this is the error logs i got after restarting. This is the only "error logs" i found when i searched in logs.....

2023-05-06 22:29:02.653 ERROR (MainThread) [homeassistant.components.media_player] Platform alexa_media does not generate unique IDs. ID d7a8e7939b644b23b2f3da0fcc9aabbe already exists - ignoring media_player.francis_s_ultimate_alexa
2023-05-06 22:29:02.655 ERROR (MainThread) [homeassistant.components.media_player] Platform alexa_media does not generate unique IDs. ID 3cea54ef16e449babf7a88353e13940f already exists - ignoring media_player.francis_s_vue_lite
value_template: "{{ '56:55:45:01:07:76' in state_attr('sensor.pixel_6_pro_bluetooth_connection', 'connected_paired_devices') | string }}"
2023-05-06 22:29:02.657 DEBUG (MainThread) [custom_components.alexa_media.helpers] alexa_media.notify.async_get_service: Try: 1/5 after waiting 0 seconds result: <custom_components.alexa_media.notify.AlexaNotificationService object at 0x7f92683820>
2023-05-06 22:29:02.681 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up alexa_media platform for sensor
2023-05-06 22:29:02.707 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 134, in async_platform_discovered
await async_setup_platform(platform, discovery_info=info)
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 123, in async_setup_platform
await notify_service.async_register_services()
File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 288, in async_register_services
if self.targets is not None:
File "/config/custom_components/alexa_media/notify.py", line 152, in targets
2023-05-06 22:29:02.750 DEBUG (MainThread) [custom_components.alexa_media.helpers] f***************3@h*********m: Adding [<entity None=off>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>, <entity None=off>, <entity None=unavailable>, <entity None=unavailable>]
2023-05-06 22:29:02.767 ERROR (MainThread) [homeassistant.components.switch] Error while setting up alexa_media platform for switch
2023-05-06 22:30:21.826 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.francis_s_echo_show_next_alarm exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
2023-05-06 22:29:02.681 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up alexa_media platform for sensor
KeyError: 'email'
2023-05-06 22:29:02.688 ERROR (MainThread) [homeassistant.components.alarm_control_panel] Error while setting up alexa_media platform for alarm_control_panel
KeyError: 'email'
2023-05-06 22:29:02.693 ERROR (MainThread) [homeassistant.components.light] Error while setting up alexa_media platform for light
KeyError: 'email'
2023-05-06 22:29:02.699 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up alexa_media platform for binary_sensor
KeyError: 'email'
2023-05-06 22:29:02.707 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
AttributeError: 'NoneType' object has no attribute 'split'
2023-05-06 22:29:02.767 ERROR (MainThread) [homeassistant.components.switch] Error while setting up alexa_media platform for switch

@zeldoy24
Copy link
Author

zeldoy24 commented May 7, 2023

/
PXL_20230507_021559216
![PXL_20230507_021616832~2](https://user-images.githubusercontent.com/108962242/236656089-7043ca08-bb3b-4aef-b508-05f591a23ca0.jpg

With all due respect, I've turned off 90 percent of my integrations and the moment i have added Alexa media player my cpu spikes to 30 percent from what you can see in the pictures. Furthermore, i looked in logs but i cannot find what you are looking for. So any other clue or help would be 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

No branches or pull requests

2 participants