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

LG Soundbar is triggered by media player #41121

Closed
Snoopy2406 opened this issue Oct 3, 2020 · 16 comments · Fixed by #42044
Closed

LG Soundbar is triggered by media player #41121

Snoopy2406 opened this issue Oct 3, 2020 · 16 comments · Fixed by #42044

Comments

@Snoopy2406
Copy link

Snoopy2406 commented Oct 3, 2020

The problem

my home assistant keeps my soundbar on and i can't turn it of anymore. When i push the powerbutton on the remote it says goodbye and restarts itself immediately.

Environment

  • Home Assistant Core release with the issue: 0.115.6
  • Last working Home Assistant Core release (if known): /
  • Operating environment (OS/Container/Supervised/Core): HassOS 4.13 on Raspi 4
  • Integration causing this issue: media player
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml

Traceback/Error logs

2020-10-03 11:10:20 WARNING (MainThread) [homeassistant.helpers.entity] Entity media_player.lg_soundbar_e797e6bc_013a_41c4_8df7_38516a852e9c is incorrectly being triggered for updates while it is disabled. This is a bug in the lg_soundbar integration

Additional information

The soundbar is not integrated as a device. It always gets an entity. I can deactivate the entity and will get the warning in the logs:

When i push the turn off button ot the switch long, the soundbar turns off. But when i'm using it again, home assistent detects it again as a new entity - with another number behind lg_soundbar_...

I tried:
discovery:
ignore:
- lg_soundbar
- lg
- media_player

that didn't work

also tried:

discovery:
ignore:
- google_cast

media_player:

  • platform: lg_soundbar

that didn't work either

I'm not using the soundbar with ha so i just would love to remove it fully to have a chance to switch it of again

@frenck
Copy link
Member

frenck commented Oct 3, 2020

Hi there,

Thanks for opening up an issue. When creating an issue, an issue template is presented. It looks like you've (partly) removed it. This causes your issue report to be incomplete.

Please edit your issue to have the full issue template back again and provide as much of the requested data as possible. Without it, we won't be able to help you.

Thanks already! 👍

@amonhk
Copy link

amonhk commented Oct 5, 2020

Same problem with SK10Y,
if I turn off the soundbar by holding down the off button, it is no longer reachable from the network and it does not wake up by itself.
Unfortunately, when I turn it back on via the remote control, the connection with the homeassitant is not restored and I have to restart the entire home-assistant to resume its functions.

@probot-home-assistant
Copy link

lg_soundbar documentation
lg_soundbar source
(message by IssueLinks)

@Megachip
Copy link

@frenck any option to disable lg_soundbar Auto-detection?

@Snoopy2406
Copy link
Author

Snoopy2406 commented Oct 13, 2020

I enabled the logs in more detail, here is what i got:

2020-10-13 06:40:15 INFO (SyncWorker_10) [homeassistant.loader] Loaded lg_soundbar from homeassistant.components.lg_soundbar

2020-10-13 06:40:17 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.lg_soundbar

2020-10-13 06:46:10 INFO (MainThread) [homeassistant.components.discovery] Found new service: lg_smart_device {'host': '192.XXX.XXX.XX', 'port': XXXX, 'hostname': 'Soundbar-c45d8433-4d89-bb09-5763-xxxxxxxxxxx-fritz-box.local.', 'properties': {'PROTOVER': '1.0', 'UUID': '57f77c6c-71a4-4004-bfac-exxxxxxxxxxxxxx', 'Model_Type': '0', 'ASSISTANT': 'true'}}

2020-10-13 06:46:10 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.lg_soundbar

2020-10-13 06:46:10 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new media_player.lg_soundbar entity: media_player.lg_soundbar_57f77c6c_71a4_4004_bfac_xxxxxxxxxxxxxxxx

....after disabling the entity manually i got this again...

2020-10-13 08:43:35 WARNING (MainThread) [homeassistant.helpers.entity] Entity media_player.lg_soundbar_57f77c6c_71a4_4004_bfac_xxxxxxxxxxxx is incorrectly being triggered for updates while it is disabled. This is a bug in the lg_soundbar integration

@lasconic
Copy link

See also google/python-temescal#7

@bernimoses
Copy link
Contributor

There are two problems here:

  1. The soundbar uses a different uuid when announcing itself via zeroconf which leads to multiple entities
  2. The current component uses polling which wakes the soundbar from standby and is not necessary with python-temescal version > 0.2 anymore

As unique id i am testing the hostname since that should not change unless the user does so. And so far it looks ok. What did you @amonhk use as unique id for homeassistant?

@amonhk
Copy link

amonhk commented Oct 19, 2020

@bernimoses I have used hostname (self._host)
I also tested the name (self._name) but the expected result did not return.

@patatman
Copy link

@bernimoses Is there anything I can help with to close this issue?
I have a similar issue explained here: #35825 (comment)

I have a LG DSN11rg, and I'm happy to help test or provide additional information if needed.
For now I disabled the discovery component, so I can switch my soundbar off.

@bernimoses
Copy link
Contributor

@patatman both (this and your) issue should be fixed with my pull request #42044. If you want you can test it (via custom_component). But it is currently stuck because of a unique id problem (see pr). Nothing we can do for now if nobody has a satisfying idea.

@patatman
Copy link

patatman commented Nov 2, 2020

@bernimoses I just tried to use the custom_component, and to be clear how I set it up:
Took your fork/branch and copied the files from your branch: __init__.py, media_player.py and manifest.json and copied them to my custom_components/lg_soundbar directory.
enabled Discovery and Restarted HASS.

Unfortunatly I'm getting this error:

home-assistant   | 2020-11-02 09:48:59 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up lg_soundbar platform for media_player
home-assistant   | Traceback (most recent call last):
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, in _async_setup_platform
home-assistant   |     await asyncio.gather(*pending)
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 314, in async_add_entities
home-assistant   |     await asyncio.gather(*tasks)
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 505, in _async_add_entity
home-assistant   |     await entity.add_to_platform_finish()
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
home-assistant   |     self.async_write_ha_state()
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
home-assistant   |     self._async_write_ha_state()
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 314, in _async_write_ha_state
home-assistant   |     attr = self.capability_attributes
home-assistant   |   File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 815, in capability_attributes
home-assistant   |     sound_mode_list = self.sound_mode_list
home-assistant   |   File "/config/custom_components/lg_soundbar/media_player.py", line 172, in sound_mode_list
home-assistant   |     modes.append(temescal.equalisers[equaliser])
home-assistant   | IndexError: list index out of range

If I switch input sources on the Soundbar itself, it gives this error in the log:

home-assistant   | 2020-11-02 09:51:56 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
home-assistant   | Traceback (most recent call last):
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 283, in async_update_ha_state
home-assistant   |     self._async_write_ha_state()
home-assistant   |   File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 314, in _async_write_ha_state
home-assistant   |     attr = self.capability_attributes
home-assistant   |   File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 815, in capability_attributes
home-assistant   |     sound_mode_list = self.sound_mode_list
home-assistant   |   File "/config/custom_components/lg_soundbar/media_player.py", line 172, in sound_mode_list
home-assistant   |     modes.append(temescal.equalisers[equaliser])
home-assistant   | IndexError: list index out of range

@bernimoses
Copy link
Contributor

@patatman i don't think this should happen if you use the official source and the above mentioned patch. This error is more related to another pull request i created a while ago #38798. But your specific case would need some tuning i guess. I'll updated the pull request.

@Zarkstar
Copy link

@patatman both (this and your) issue should be fixed with my pull request #42044. If you want you can test it (via custom_component). But it is currently stuck because of a unique id problem (see pr). Nothing we can do for now if nobody has a satisfying idea.

This is probably a useless comment, but... wouldn't a static ip (eventually with a manual setup) solve this problem? I know it would not be a zero-effort discovered component anymore, but the component is practically unusable at this point, so...
I'm not very good with this stuff, so if it's a bad idea shut me up 😅

@patatman
Copy link

@Zarkstar That's actually not a bad idea.
I've just enabled the static ip, and I'll see what happens to the integration. So far I haven't seen errors in the log.

@Zarkstar
Copy link

Zarkstar commented Nov 28, 2020

Hi, any news on the implementation? I would love to help test it with my SK10Y but I can't find the documentation on how to implement custom components. I tried copying the media_player.py file, the init file and the manifest file in a folder inside custom_components, but it did not work (the soundbar is still randomly turning on). At this point, maybe the best thing would be to remove the discovery option (allowing users who don't want to connect the soundbar in this problematic stage of integration) fo lg_soundbar and just have a manual configuration in which the user can insert the ip if static, or the MAC address. Thank you in advance for the update

@nunocardosonuc
Copy link

I have the same problem with a SK09Y.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants