home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.1k stars 30.18k forks source link

lg_soundbar without discovery #23752

Closed darootler closed 3 years ago

darootler commented 5 years ago

Home Assistant release with the issue: hassos: "2.11" homeassistant: 0.92.2 machine: raspberrypi3 supervisor: "162"

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io

Component/platform: lg_soundbar

Description of problem: I am using a LG SK6F soundbar. Hassio and the soundbar are both on different subnets. This is for security reasons.

It would be nice if there would be an option to configure the soundbar manually with ip/port without having discovery enabled.

cgtobi commented 5 years ago

Please use the issue template.

darootler commented 5 years ago

Done.

Regards Richard

SNoof85 commented 5 years ago

I will give a try to support static config but as i have no LG Soundbar i'll need you to test the new version as custom component for example. And btw how much soundbars do you have ? Only 1 ?

darootler commented 5 years ago

Yes, i will test a new custom version. I have one LG SK6F soundbar.

Regards

SNoof85 commented 5 years ago

Can you please try this as custom component : https://github.com/SNoof85/home-assistant/tree/dev/homeassistant/components/lg_soundbar

Add config into your configuration.yaml

media_player:
  - platform: lg_soundbar
    host: <ip of the soundbar>
    port: <port to use>

Hope i did it correct (i'm not an expert !). Would be nice also if you could try it with discovery first (with soundbar on same net that your HA instance), then with fixed config (soundbar different network if you want to) and report. Thx

PS : you need to place all 3 files into /custom_components/lg_soundbar/

darootler commented 5 years ago

I already tried a similar solution like yours. It seems like "add_entities" needs some information from discovery, but i am not an expert too :-)

I does not work and i think you need an "else" after "if discovery_info:". No error logs and no entity added.

Regards Richard

SNoof85 commented 5 years ago

There was missing import 🗡 Try again ? :)

darootler commented 5 years ago
2019-05-10 23:54:24 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform lg_soundbar
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/lg_soundbar/media_player.py", line 38, in setup_platform
    add_entities([LGDevice(hass, host, port)], True)
TypeError: __init__() takes 3 positional arguments but 4 were given
SNoof85 commented 5 years ago

Sorry again a stupid mistake. Fixed.

darootler commented 5 years ago

It's adding a media player, but you cannot change the source:

image

Also changing the sound mode is very buggy. And changing the volume is also not possible.

Regards

SNoof85 commented 5 years ago

ok, so it's either a bug with the test component or the original was also buggy. Did you managed to make the original component working with discovery ? and if yes was it also buggy ?

On my side if i just configure a lg soundbar within my config with the IP of my TV i have the same than yours but...it's a TV not an LG soundbar. It's a bit hard for me to test.

Could you try to set your soundbar in the same subnet that home assistant and test the custom component ? If it works, we would then exclude any network communication bug.

darootler commented 5 years ago

Yes, the original component is working with the exception that "Optical/HDMI ARC" is not shown in the gui if selected:

image image

Volume, source and sound mode is changeable.

The soundbar is on the same subnet as HA because the original component is not working if the soundbar is on different subnet.

As i said i think "add_entities" is expecting a discovery object, mine looks like this:

{'host': '192.168.6.3', 'port': 9741, 'hostname': 'Chromecast.local.', 'properties': {'PROTO_VER': '1.0', 'UUID': 'de85605e-68f4-4e83-9b28-474ee7315596'}

Regards Richard

SNoof85 commented 5 years ago

Yes we have to find these missing properties as i just pass host and port in the new version component. Thx for the detailed report of the discovery info object. Will try to get a look at this.

The temescal lib is only waiting for host and port. Wich are passed to the class LGDevice in the component (stable and tested one).

Don't want to doubt on your knowledge but what did you wrote in your config ? It should be this :

media_player:
  - platform: lg_soundbar
    host: 192.168.6.3
    port: 9741
stale[bot] commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

darootler commented 5 years ago

@SNoof85

Any progress?

Regards Richard

SNoof85 commented 5 years ago

Hey, sorry no, have no time yet to try it again. Also, i don't have this hardware at home and it's hard to find out without. On top of this I'm afraid that I've reached my maximum level at home assistant/python dev. I'm sorry but i won't be able to help more on this. If someone here is using an LG soundbar and with better knowledge than me can help it would be nice.

amonhk commented 5 years ago

same problem that got worse after updating my SK10Y soundbar 2019-09-17_15-01-49

I think the problem is in the code that the component uses https://github.com/google/python-temescal broken by the latest updates LG(?)

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

darootler commented 4 years ago

Not working yet.

Regards Richard

Pete1979 commented 4 years ago

Also not working with LG SL9YG

RIKWEBB commented 4 years ago

Also not working with LG SL8YG soundbar

amonhk commented 4 years ago

Also not working with LG SK10Y

amonhk commented 4 years ago

I have tested this PR https://github.com/home-assistant/core/pull/31617 as custom_components and it seems to work properly on my soundbar LG SK10Y Thanks @mattchrist @MartinHjelmare

darootler commented 4 years ago

I have tested the PR #31617 with a LG SK6F soundbar too. I am getting a working media_player entity:

image

What i am missing is the option to turn it on or off. As an addition it would be nice to store this entity permanent. And if the source is changed to "Optical/HDMI ARC" the source changes to "Optical" and the GUI does not show the source anymore.

Thanks @mattchrist @MartinHjelmare for the work so far.

Regards Richard

Pete1979 commented 4 years ago

How do i test it as a custom component? Right now i have added LG_smart_device to my ignore list.

darootler commented 4 years ago

How do i test it as a custom component? Right now i have added LG_smart_device to my ignore list.

Download this git clone, extract the contents. Navigate to \homeassistant\components and copy the folder "lg_soundbar" to your HA "custom_components" folder, configure the lg_soundbar like mentioned here and restart HA.

Regards Richard

darootler commented 4 years ago

There is also a problem with this integration and the standby option with the soundbar. Since this integration polls the soundbar permanently, it turns on instantly after the soundbar enters standby mode. Maybe this can be fixed in a combination with an on/off feature.

For me this is not useable at the moment.

Regards Richard

darootler commented 4 years ago

Any chance to get the integration working without discovery?

Regards Richard

amonhk commented 4 years ago

I think it works without discovery

discovery:
  ignore:
    - lg_smart_device
media_player:
  - platform: lg_soundbar
    host: 192.168.7.118
    port: 9741

these are the problems found:

darootler commented 4 years ago

I think it works without discovery

discovery:
  ignore:
    - lg_smart_device
media_player:
  - platform: lg_soundbar
    host: 192.168.7.118
    port: 9741

these are the problems found:

  • soundbar turns on instantly after the soundbar enters standby mode
  • if the soundbar is completely turned off, the connection is lost until the reboot of home-assistant

I also encountered the problem with the soundbar turning on with this configuration... So that's not an option i guess.

Regards Richard

a5mith commented 4 years ago

Can confirm, even with just discovery enabled, the soundbar will turn off, then immediately turn back on again. SL10YG here.

visstro commented 4 years ago

I had to disable lg_soundbar due to heating problems. It was keeping the device always on.

CeccoCQ commented 4 years ago

Hi guys, any news about this issue?

Pete1979 commented 4 years ago

No news from me. I have kinda accepted that it does not work. I have created a remote in HA that controls a Broadlink Mini that in turn controls the soundbar. Still annoying that the soundbar turns on immediately after you turn it off tho.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

darootler commented 3 years ago

Issue still persists.

Regards

d4icon commented 3 years ago

I think it works without discovery

discovery:
  ignore:
    - lg_smart_device
media_player:
  - platform: lg_soundbar
    host: 192.168.7.118
    port: 9741

these are the problems found:

  • soundbar turns on instantly after the soundbar enters standby mode
  • if the soundbar is completely turned off, the connection is lost until the reboot of home-assistant

I also encountered the problem with the soundbar turning on with this configuration... So that's not an option i guess.

Regards Richard

SAme problem here with sn9yg soundbar I have doubts as to whether this will ever work.

Is there a possibility to turn off the soundbar via wifi/network? I'm beginning to think not....

In fact, the official soundbar app doesn't have the option, and besides, it has the same problem as us, as soon as you open the app the soundbar turns on :-(

On the other hand, for my soundbar model, I had to edit the lg_soundbar component, with the temescal library, because it doesn't support all the modes of my soundbar: https://github.com/google/python-temescal/issues/9

Translated with www.DeepL.com/Translator (free version)

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.