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
73.71k stars 30.83k forks source link

Re-opened: webOS TV stops working and requires HA restart #74888

Open Sab44 opened 2 years ago

Sab44 commented 2 years ago

The problem

This issue re-opens issue #70079. The proposed solution of turning off Wi-Fi connection on the TV is not resolving the issue, as other users also reported in the original issue after it was closed.


The webOS TV integration stops working after some time. It can be hours or days, I have not been able to pinpoint the exact trigger that causes it to crash. Restarting Home Assistant temporarily resolves the issue.

Attached is a FULL uncencored log of the issue, recorded with the log settings:

logger:
  default: info
  logs:
    homeassistant.components.webostv: debug
    aiowebostv: debug

Please let me know if there's anything else I can provide to help resolve this issue.

[log removed]

What version of Home Assistant Core has the issue?

2022.6.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

webostv

Link to integration documentation on our website

https://www.home-assistant.io/integrations/webostv/

Diagnostics information

My LG TV is the following model: 65nano917na

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

thecode commented 1 year ago

I have the same issue doesn't contribute anything, eventually it does the opposite, for other integrations I sometime try to help and when the issue is bumped to many time due to "I have the same issue" I unsubscribe from the issue. Since I am a codeowner here I did not do that.

It is enough to put 👍 on the main post to know you are watching this issue.

Many time the issue is not the same, so you may end up waiting for something that will not be resolved. Instead it would be better to provide logs during the problem so the issue can be identified better.

Until now only two participants provided logs, one log did not show anything and the other showed that the issue is not in a direct code used by this integration (making it almost impossible to identify the root cause), other issues which are closed showed different problems, WIFI is known to create problems with LG TVs.

I am still trying to work on something that might include better logging to identify the issue, when I have something I will post here.

deviantintegral commented 1 year ago

I just double checked, and my TV is actually on wifi and has had no issues. The Unifi access point is actually mounted on the wall behind the TV, so it's very, very close. It makes me wonder if either wifi issues started cropping up after the 03.21.18 firmware, or if those having wifi issues either have a congested environment, a longer distance to the AP, or similar.

gregsheremeta commented 1 year ago

I also have a unifi AP (nanoHD, latest firmware) mounted about 5 feet directly above my 2 C2's that drop from wifi. My wifi is not congested.

I think the TVs are just buggy.

patzobil commented 1 year ago

Hello all, @thecode

I take it this is an older issue - though still ongoing - I experience similar issues lately(since September 2023). When TV goes on (either with WOL or remote doesn't matter) the LG WebOS Integration fails to see the TV comes online.

Troubleshooting steps reproduced:

HASSOS FW: 2023.10.2 LG TV WebOS FW: 03.33.60

While going through the logs, I was only able to find something very strange, this is just an assumption but it looks like the integration is using an IP address that I do not have/use on my network to find the TV. Could that be something that helps out to find the root cause?

My TV is running on DHCP Reservation, over wired network, the IP address of the TV is pingable, however the below is not! I don't even know where the integration picked this IP address up! I have Wi-Fi turned off on the TV!

Logs before server restart:

2023-10-12 18:47:09.540 DEBUG (MainThread) [aiowebostv] connect(192.168.1.187): uri: ws://192.168.1.187:3000

2023-10-12 18:47:11.565 DEBUG (MainThread) [aiowebostv] exception(192.168.1.187): TimeoutError()

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 655, in __await_impl_timeout__
    return await self.__await_impl__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 659, in __await_impl__
    _transport, _protocol = await self._create_connection()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

Logs after server restart:

2023-10-12 18:48:18.985 DEBUG (MainThread) [aiowebostv] connect(192.168.1.53): uri: ws://192.168.1.53:3000
2023-10-12 18:48:18.991 DEBUG (MainThread) [aiowebostv] connect(192.168.1.53): uri: wss://192.168.1.53:3001
2023-10-12 18:48:19.147 DEBUG (MainThread) [aiowebostv] send(192.168.1.53): hello
2023-10-12 18:48:19.235 DEBUG (MainThread) [aiowebostv] recv(192.168.1.53): {"type":"hello","payload":{"protocolVersion":1,"deviceType":"tv","deviceOS":"webOS","deviceOSVersion":"4.1.0","deviceOSReleaseVersion":"7.3.1","deviceUUID":"some_UID","pairingTypes":["PIN","PROMPT","COMBINED"]}}
2023-10-12 18:48:19.235 DEBUG (MainThread) [aiowebostv] send(192.168.1.53): registration
2023-10-12 18:48:19.299 DEBUG (MainThread) [aiowebostv] recv(192.168.1.53): registration
2023-10-12 18:48:19.299 DEBUG (MainThread) [aiowebostv] send(192.168.1.53): {'id': 0, 'type': 'request', 'uri': 'ssap://com.webos.service.networkinput/getPointerInputSocket', 'payload': {}}
2023-10-12 18:48:19.462 DEBUG (MainThread) [aiowebostv] recv(192.168.1.53): {"type":"response","id":0,"payload":{"returnValue":true,"socketPath":"wss://192.168.1.53:3001/resources/some_token/netinput.pointer.sock"}}
2023-10-12 18:48:19.462 DEBUG (MainThread) [aiowebostv] connect(192.168.1.53): uri: wss://192.168.1.53:3001/resources/some_token/netinput.pointer.sock
2023-10-12 18:48:19.529 DEBUG (MainThread) [aiowebostv] send(192.168.1.53): {'id': 1, 'type': 'request', 'uri': 'ssap://system/getSystemInfo', 'payload': {}}
2023-10-12 18:48:19.530 DEBUG (MainThread) [aiowebostv] send(192.168.1.53): {'id': 2, 'type': 'request', 'uri': 'ssap://com.webos.service.update/getCurrentSWInformation', 'payload': {}}
2023-10-12 18:48:19.653 DEBUG (MainThread) [aiowebostv] recv(192.168.1.53): {"type":"response","id":2,"payload":{"returnValue":true,"product_name":"webOSTV 7.0","model_name":"HE_DTV_W22H_AFADATAA","sw_type":"FIRMWARE","major_ver":"03","minor_ver":"33.60","country":"XX","country_group":"EU","device_id":"74:e6:b8:xx:xx:xx","auth_flag":"N","ignore_disable":"N","eco_info":"01","config_key":"00","language_code":"en-GB"}}

Many thanks for your support!

P.S. In the meantime the Homekit integration/entity shows correctly the TV online

thecode commented 1 year ago

Hello all, @thecode I take it this is an older issue - though still ongoing - I experience similar issues lately(since September 2023). When TV goes > * [x] Reload of the integration nothing happens Many thanks for your support! P.S. In the meantime the Homekit integration/entity shows correctly the TV online

Hi @patzobil, thanks for the detailed logging, however you have a different issues. From the ones who did provide a log here the IP was correct. Please create a new issue. It is also possible to log the source of the IP, I will check how and we can try to debug it on the new issue. Thanks.

patzobil commented 1 year ago

Hello all, @thecode I take it this is an older issue - though still ongoing - I experience similar issues lately(since September 2023). When TV goes > * [x] Reload of the integration nothing happens Many thanks for your support! P.S. In the meantime the Homekit integration/entity shows correctly the TV online

Hi @patzobil, thanks for the detailed logging, however you have a different issues. From the ones who did provide a log here the IP was correct. Please create a new issue. It is also possible to log the source of the IP, I will check how and we can try to debug it on the new issue. Thanks.

Will do so, if it happens again! :) Thanks

Draghmar commented 1 year ago

Just my two cents: I have CX55 and started to seeing this issue for some time. Not sure why though as it was working properly before. I'm not on WiFi mind you. HA simply doesn't see the TV when it's on. Re integrating it works for a moment but after TV goes off and on it stops. I have simple automation that turns lights on when TV goes off - this one stopped working because state is always undefined.

Draghmar commented 1 year ago

I turned on debuging in the settings but all I've got related to the webos is:

[...]
2023-10-28 06:03:24.248 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.yamaha_receiver is taking over 10 seconds
2023-10-28 06:03:24.249 WARNING (MainThread) [homeassistant.components.media_player] Updating yamaha media_player took longer than the scheduled update interval 0:00:10
[...]
2023-10-28 08:50:14.385 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.tivik is taking over 10 seconds
2023-10-28 13:47:16.149 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10
[...]
vumaddibly commented 1 year ago

This integration used to work very well indeed but for several weeks now I find that as soon as I turn on the TV using the remote then the majority of the time I just receive timeout messages in the log every 10s, the media player card on the dashboard remains grey (= TV off), the power button has no effect and there are no logbook entries relating to media_player.lounge_tv

I'm running HAOS on bare metal (Core i5 NUC) - Core 2023.11.2, Supervisor 2023.11.0, Operating System 11.1 and Frontend 20231030.2

My TV is an LG OLED65GX6LA running firmware 04.50.52. The TV only has an Ethernet connection and its IP address is set as static within the TV settings.

I find that restarting HA while the TV is in standby causes a flood of warnings, as seen below. Turning the TV on manually and then restarting HA generally fixes the problem.

Enabling debug logging for the integration reveals very little. Attempts to open port 3000 fail but this is to be expected as when the TV is in standby the only thing it responds to is the WOL request.

2023-11-12 12:07:33.989 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10 2023-11-12 12:07:33.989 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.lounge_tv is taking over 10 seconds 2023-11-12 12:07:43.990 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10 2023-11-12 12:07:53.991 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10 2023-11-12 12:08:03.992 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10

vumaddibly commented 11 months ago

@thecode, are you any closer to getting to the bottom of this problem? Due to family commitments, I haven't had much time to tinker with HA during the past week. When I examined the log file this morning I found it has grown to over 15,000 lines, over 99% of which are: 2023-11-25 11:02:22.275 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10 2023-11-25 11:02:32.276 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10 Please let me know if there is any further information that might help you bottom this out.

vumaddibly commented 11 months ago

It's egg on face time 😌 I've just re-run the 'CONFIGURE' option for the integration and my problems have gone away. The timeout messages I was seeing in the log are no more 😀

Edit - this is definitely not fixed. I now have an automation that reloads the integration whenever the string "Update of media_player.lounge_tv is taking over 10 seconds" appears in the log file. Sometimes the reload resolves the problem but at other times it doesn't help.

b00tsie commented 11 months ago

Have had such too, and was able to fix this by forcing a fixed ip address on the tv. And then add the tv to the LG WebOS integration and confirm the pairing on the tv. If you remove/re-add the tv in one go, ensure restart HA and after HA is restarted all shout work properly.

pnm1977 commented 10 months ago

Not sure if my issue is the same as everyone else's but I've just started having problems with an LG TV using this integration. The integration has been working fine for at least a year and is connected by ethernet. I recently got a PS5 and have observed that the LG TV (which is in a different room) shows as Off in the integration as soon as I start playing an online game or downloading data. Doesn't do this if I'm playing an offline game so must be linked to networking somehow. Reloading this integration sets the device status back to On but it doesn't last long before it goes back to Off.

vumaddibly commented 10 months ago

After numerous attempts to find an acceptable workaround, I've pretty much given up on this integration. Even after a full HA restart, the moment I turn on the TV via the remote then I start to see repeated errors in the log. I now have a Shelly Plus PM Mini inline with the TV's power cord that allows me to turn on/off the AVR and subwoofer the moment I see the TV power up or power off.

The logs look like this:

[...]
2024-01-17 15:53:08.748 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.lounge_tv is taking over 10 seconds
2024-01-17 15:53:08.750 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10
2024-01-17 15:53:18.748 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10
2024-01-17 15:53:28.750 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10`
[...]

and so on. During the time the errors are being reported the media player dashboard card remains grey (tv off). Restarting the integration via Settings -> Devices & Services -> Integrations ->LG webOS Smart TV -> Reload or via a script sometimes resolves the problem. At other times the integration appears to be stuck 'Initialising' and the only way forward at that point is to restart HA.

vumaddibly commented 8 months ago

It appears that this problem is related to the TV settings, specifically TV -> Settings -> General -> Home Settings. I noticed that if I turned the TV off while the input was set to Netflix then everything was OK when the TV was next turned on with the remote. However, after watching Live TV then the next time the TV was turned on the timeout problems were once again observed in the HA log. I turned off Home Auto Launch and Home Promotion in the TV settings and now everything appears to work just fine.

pezzy-o commented 8 months ago

It appears that this problem is related to the TV settings, specifically TV -> Settings -> General -> Home Settings. I noticed that if I turned the TV off while the input was set to Netflix then everything was OK when the TV was next turned on with the remote. However, after watching Live TV then the next time the TV was turned on the timeout problems were once again observed in the HA log. I turned off Home Auto Launch and Home Promotion in the TV settings and now everything appears to work just fine.

This appears to fix the issue for me. LG CX on WiFi, been running without issue for the last week. Thank you!

danieldabate commented 8 months ago

Testing this for a couple of days so far and seems to be working well. I'll report if I find otherwise.

I already had Home Promotion turned off, but not the Home Auto Launch option. Not only does it seem to fix the issue, but the TV now turns on faster.

On Thu, Feb 29, 2024 at 18:16 vumaddibly @.***> wrote:

It appears that this problem is related to the TV settings, specifically TV -> Settings -> General -> Home Settings. I noticed that if I turned the TV off while the input was set to Netflix then everything was OK when the TV was next turned on with the remote. However, after watching Live TV then the next time the TV was turned on the timeout problems were once again observed in the HA log. I turned off Home Auto Launch and Home Promotion in the TV settings and now everything appears to work just fine.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/74888#issuecomment-1971599781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP4BOO3YH2PVYFVYZC6G3TYV5Q7JAVCNFSM53FEPIVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJXGE2TSOJXHAYQ . You are receiving this because you were mentioned.Message ID: @.***>

leaskovski commented 8 months ago

So I have done the same changes with regards to the home promotion and auto launch. I think auto launch is the culprit here, as I have still seen issues with this, if I use any apps on the TV, however if I don't then the integration tends to continue to work.

kevinhaas commented 7 months ago

Looks like 2022+ models don't have that settings path, don't see anything for that.

My two B9s had it though, and they've both had it off as long as I've owned them. Sadly, they still go offline once in a while, so not sure that is a fix. Mine don't go offline quite weekly, so I'm curious if that ended up lasting for these people. There also might be multiple issues going on here, so it might not fix mine.

Hard to tell. I never get logs, and I don't see that updated logging has been added.

danieldabate commented 5 months ago

Looks like 2022+ models don't have that settings path, don't see anything for that.

My two B9s had it though, and they've both had it off as long as I've owned them. Sadly, they still go offline once in a while, so not sure that is a fix. Mine don't go offline quite weekly, so I'm curious if that ended up lasting for these people. There also might be multiple issues going on here, so it might not fix mine.

Hard to tell. I never get logs, and I don't see that updated logging has been added.

I can confirm that I got a disconnection with the setting off. But it's nowhere near what I had before. This was one time in months. Before it could happen every week.

issue-triage-workflows[bot] commented 2 months 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.

kevinhaas commented 2 months ago

Still an issue.

bkbartk commented 1 month ago

issue still occurs

teetow commented 1 month ago

Just ran into this. Seeing a lot of this in the log:

WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10

Restarting the LG webOS Smart TV integration fixes it temporarily, but it comes back.

bkbartk commented 4 weeks ago

I rarely have issues with this, and now suddenly 3 times in 2 days. could this be related to something?

Yojimboz commented 3 weeks ago

I rarely have issues with this, and now suddenly 3 times in 2 days. could this be related to something?

I can confirm the same behaviour. It was many months since the last freeze. And now it happened several times for the last week.

danieldabate commented 3 weeks ago

Same for me. And it's not limited to some TV models or OS versions, I changed my LG BX (that died) to a LG G2 and I'm seeing the same behaviour.

El lun, 21 oct 2024 a la(s) 10:28 a.m., Yojimboz @.***) escribió:

I rarely have issues with this, and now suddenly 3 times in 2 days. could this be related to something?

I can confirm the same behaviour. It was many months since the last freeze. And now it happened several times for the last week.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/74888#issuecomment-2425970514, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP4BOIEDY5CKXEQJNVWPD3Z4S3JJAVCNFSM53FEPIVKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TENBSGU4TOMBVGE2A . You are receiving this because you were mentioned.Message ID: @.***>

Kuchiru commented 1 week ago

Same here, suddenly happening every day after using the integration for at least a year.

andrewfraley commented 1 week ago

FWIW, in my case I believe this issue to be related to quirky issues with how these TVs handle the wifi and ethernet interfaces when both are configured/enabled. After I disabled the wifi on the TV and used ethernet only, I haven't had any issues. If you have the wifi configured, but also an ethernet cable connected, it seems to try to use both interfaces and you'll even see IP address conflict warnings in your network logs as for some reason it'll try to use the IP address assigned to the ethernet interface on the wifi interface. So if you're experiencing this issue and you're using ethernet, make sure you go in and disable the wifi interface on the TV.

danieldabate commented 1 week ago

I have only Ethernet and it's still happening. It's just completely random. It might be fine for you now, but it could suddenly reappear anytime.

andrewfraley commented 1 week ago

I haven't had an issue for well over a year. I'd also recommend disabling the Always Ready mode on the TV.

kevinhaas commented 1 week ago

This has all been discussed above. It's still not even known if this is one single issue, so that may fix it for you, but not others.

Still happens to my 4 LGs. One is definitely worse than the others, but it happens to all of them randomly. Seems to especially happen if I haven't used that TV in a week or two. Some are wired, some are wifi.

bkbartk commented 1 week ago

For me this issue also occurs when the tv is turned off.

thecode commented 1 week ago

FWIW, in my case I believe this issue to be related to quirky issues with how these TVs handle the wifi and ethernet interfaces when both are configured/enabled. After I disabled the wifi on the TV and used ethernet only, I haven't had any issues. If you have the wifi configured, but also an ethernet cable connected, it seems to try to use both interfaces and you'll even see IP address conflict warnings in your network logs as for some reason it'll try to use the IP address assigned to the ethernet interface on the wifi interface. So if you're experiencing this issue and you're using ethernet, make sure you go in and disable the wifi interface on the TV.

This is the most common reason for having status updates problem with WebOS TV and the only issue I could reproduce. I am aware that there are people here that may have another issue, but as far as logs showed we didn't find anything in HA side, for years I believed newer TVs firmware has a problem but after having a newer TV with a new firmware I still can't reproduce any issue. I still suggest that affected users try to check the connection between HA and the TV, maybe even temporarily connect the TV to HA in an alternate way/cables and see if it still happens.

I any case, without new logs that shows something there is nothing I can do at this stage.

danieldabate commented 1 week ago

Thanks for your support, this is a very hard issue to reproduce indeed. Nobody has been able to consistently trigger it.

You might be right that there is a temporary issue in the connection between the TV and WebOS, so the add-on gets disconnected, but how do you explain that by restarting the WebOS add-on the issue is fixed?

Why isn't the add-on trying to automatically reconnect after this event happens?

Kuchiru commented 5 days ago

So, I've come to this dirty trick - restarting Webos integration every 10 min if the TV seems to be off. Since there is no way to determine is it really turned off or it's just an integration issue.

alias: "Гостиная: перезапуск LG"
description: ""
trigger:
  - platform: time_pattern
    minutes: /10
    enabled: true
condition:
  - condition: state
    entity_id: media_player.living_room_tv
    state: "off"
    enabled: true
action:
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      entity_id: media_player.living_room_tv
mode: single

I've taken inspiration from this and made the automation to trigger once my receiver turns on with a 30s delay (its turned on via ARC when the TV is powered). The conditions for reloading the integration are that my TV is off and that the receivers input is set to TV audio, this seems to work for now and seems to be a better option than to keep checking every 10 minutes if you have the option.

This works around the issue when it occurs so im happy with that, thanks!

alias: Reload LG Integration
description: ""
triggers:
  - device_id: 388e6b008e78aff70785fc3ae8146a74
    domain: media_player
    entity_id: d42c7b03167200970cc07aaf5a1e136c
    type: turned_on
    trigger: device
    for:
      seconds: 30
conditions:
  - condition: state
    entity_id: media_player.marantz_nr1604
    attribute: source
    state: TV AUDIO
  - condition: state
    entity_id: media_player.lg_webos_tv
    state: "off"
    enabled: true
actions:
  - action: homeassistant.reload_config_entry
    data: {}
    target:
      entity_id:
        - media_player.lg_webos_tv
    enabled: true
mode: single
Nephiel commented 5 days ago

FWIW, in my setup I still have this workaround. A similar approach, but instead of checking every 10min, it watches the logs for a given "webOS [...] is taking over 10 seconds..." error message, and only then, reloads the integration and posts a notification.