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

probot-home-assistant[bot] commented 2 years ago

webostv documentation webostv source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @bendavid, @thecode, mind taking a look at this issue as it has been labeled with an integration (webostv) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

thecode commented 2 years ago

I don't see any problem in this log, at start of the log the integration is working and sending commands / getting responses from the TV

At 2022-05-26 23:12:45 the TV is turning off and reporting it is off and notify HA for this event: 2022-05-26 23:12:45 DEBUG (MainThread) [aiowebostv] recv(192.168.178.62): {"type":"response","id":4,"payload":{"returnValue":true,"state":"Suspend"}}

The errors after are caused by the library try to reconnect to the TV.

At 2022-05-27 08:38:0 the TV is on again and the integration reconnects to the TV: 2022-05-27 08:38:07 DEBUG (MainThread) [aiowebostv] send(192.168.178.62): hello

This pattern repeats itself several times.

Can you specify a time that the connection between the TV and HA did not work? Can you confirm that the problem is NOT due to the TV not turning on from HA (this is a known issue)? (meaning the TV is on but HA does not detect it is on)

Sab44 commented 2 years ago

Thanks for your quick reply.

I can say for certain that where the log stops, so at 2022-05-28 in the evening the TV was on but the integration did not work.

The turn-on action for the TV is WOL, defined in HA via blueprint (this one to be exact: https://gist.github.com/cvroque/6780ca0869ef781e9de3b506fd501f78). Turning on the TV works reliably with this.

You're saying the TV could be on but HA does not recognize it being on. That might be the case, I will check next time the issue arises.

Sab44 commented 2 years ago

The issue just resurfaced and I can confirm that the integration showed the TV as off in HA. The TV was previously turned on via the remote. Trying to turn the TV on via HA while it is already on in order to make the integration notice it is on did not have any effect.

Interestingly, the HomeKit integration is seeing the device as online correctly and is able to control the TV without issues.

I don't know why restarting HA resolves this, but it does. Keeping the TV on, after restarting HA it will be recognized as on properly.

So yeah, seems to be the known issue you mentioned. Feel free to close this issue then and I hope the root of this issue comes to light soon. Thanks for your work!

thecode commented 2 years ago

According to your description it is not the same issue. The issue I mentioned is turning on the TV via HA. The integration should show the status of the TV correctly. Try to reproduce it with a log with the exact time you see the TV off in HA but it is on.

Sab44 commented 2 years ago

Find attached a log of the issue. 2022-07-18 15:49:44 TV turned on successfully via HA integration 2022-07-18 15:49:54 Successfully switched to HDMI_1 input via HA integration (in the meantime, TV was not turned off.) Sometime around 17:00 - 17:45 TV was switched to Live TV input via the remote control. 2022-07-18 18:07:26 Trying to lower TV volume via HA integration -> not working. In HA the TV is shown as off. (Note: HomeKit integration is showing TV as on)

home-assistant.log

number65259 commented 2 years ago

I have the same behavior. Much like what Sab44 appears to be doing, I use an automation to turn on the TV with a WOL packet and swap to a certain input using the api. After a while, the TV will only respond to the WOL packet. The on/off status in HA will show off and the TV won't respond to any commands. Restarting HA fixes the issue.

thecode commented 2 years ago

I have the same behavior. Much like what Sab44 appears to be doing, I use an automation to turn on the TV with a WOL packet and swap to a certain input using the api. After a while, the TV will only respond to the WOL packet. The on/off status in HA will show off and the TV won't respond to any commands. Restarting HA fixes the issue.

Please add the following to configuration.yaml, restart home assistant, and attach the log when this problem occurs, provide the exact time it stopped responding.

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

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

colemickens commented 2 years ago

I haven't had a chance to grab the debug log, but I can say this:

I have auto-updates turned on the LG C1. It's on firmware version 03.33.11. However, it seems like the last time HA saw it successfully, it thought it was running Firmware: 03.30.20.

Is this as simple as a firmware update that breaks backward-compatibility with the webostv integration?

yuden404 commented 2 years ago

I have the same issue - the tv integration stop working after few hours/days. Not just turning on and off but also volume control and source control. What I'm doing to fix it is clicking on configure in the integration and it returning to work again.

telegrambeans commented 2 years ago

Can

Ich habe das gleiche Verhalten. Ähnlich wie Sab44 zu tun scheint, verwende ich eine Automatisierung, um den Fernseher mit einem WOL-Paket einzuschalten und über die API zu einem bestimmten Eingang zu wechseln. Nach einer Weile reagiert der Fernseher nur noch auf das WOL-Paket. Der Ein-/Aus-Status in HA wird angezeigt und der Fernseher reagiert nicht auf Befehle. Ein Neustart von HA behebt das Problem.

Fügen Sie Folgendes hinzu, starten Sie den Heimassistenten neu, hängen Sie das Protokoll an, wenn dieses Problem auftritt, und geben Sie den genauen Zeitpunkt an, zu dem die Antwort nicht mehr reagiert hat.configuration.yaml

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

Hinweis: Es ist besser, das Protokoll in den Kommentar zu ziehen (wodurch es als Anhang hinzugefügt wird) und nicht das Einfügen zu kopieren, da es schwierig ist, Protokolle in GitHub zu lesen.

Danke

On start Update Media Player error. The error occurs from 19:48

home-assistant.log

If I completely restart my LG TV and home assistant, then it works for a few minutes.

I use wake on lan, wifi is off, source for automations. I've seen the integration crash when he updates the channel list. Or what exactly he did before that. See log.

A little info. I always turn off the TV power via a smart socket. When I'm not at home or going to bed. When I get up, the electricity is on.

Edit: I deleted the filter lists at adguard home for Smart TV. No change. It continues to crash. Media Player from Home assistant then also crashes with update For 10 seconds.

timollic commented 2 years ago

I have same issue with my LG C1. Integration will stay alive for 2-3 days and then it crashes. I didn't find helpful to click "configure" / "reload" on integration. I have also tried to reboot HA frequently by automation with no success.

Only thing what can fix this is reboot HA when TV is on. After that HA will find integration and everything works. I have LG on LAN connection, Wifi is set ot off.

ipeacocks commented 2 years ago

I have probably the same issue. Integration just stops working for some reason (nothing interesting in logs), but after reloading add-on (that's possible to do in HA settings) starts working again.

haempy commented 2 years ago

I have the same problem... OLED55CX9LA with Firmware: 04.40.10

GBCRAS1 commented 2 years ago

Same issue on OLED55B8. Worked fine on Home Assistant (2022.6.4), but after upgrading to Home Assistant (2022.8.7) after some time the connection to the Webos dropped and can be restored only by restarting HA while the TV is ON

cafarre commented 2 years ago

Same issue on OLED55CX5LB with Firmware: 04.40.10

hefla commented 2 years ago

Same issue on OLED65CX with firmware: 04.40.10 running Home assistant 2022.10.5. Pressing "Configure" on the integration solves the issue temporary.

ipeacocks commented 2 years ago

Mine is working well at this time.

haempy commented 2 years ago

Is there any update?

danieldabate commented 2 years ago

Mine worked so far with some disconnections now and then and restarting HA or the integration solved the issue, but with one of the latest updates it started working very bad. I get disconnections every day and the "turn on" automation also stops working (I stop seeing the turn on button in the UI).

Yojimboz commented 1 year ago

Just came here to say that I have the same issue with LG 65NANO906NA, with firmware: 04.40.18 running Home assistant 2022.11.5

It was working a few months before. So this is either the particular LG firmware issue, either HA. Both were updating few times recently.

twosh commented 1 year ago

Same problem here, restarting the integration works for me. I do that manually when I notice it is not working properly, which is annoying because the way I notice it is that the whole house goes into Night mode if the TV isn't on (or detected to be on in this case...) shutting down all the lights, locking the door, turning of the power to the LG TV/Nvidia shield/amplifier etc... Would be greatful for a fix or a workaround that automatically reloads the integration somehow (interval or by detecting that it's not working).

Cheers!

Yojimboz commented 1 year 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
Sab44 commented 1 year ago

To everyone responding suffering from the same issue: let's try and get more logs for the developers to take a look at so this issue might finally be resolved.

Instructions for providing a log file can be found in this post: https://github.com/home-assistant/core/issues/74888#issuecomment-1189964284

I have provided my log in the original post, but more logs will surely help finding patterns and narrowing down a potential cause of the issue. Thanks!

deviantintegral commented 1 year ago

I have one more datapoint to add on the firmware side. I've kept my OLED65CXPUA on the 03.21.18 firmware and haven't had any problems with the Home Assistant integration since I set it up a year or two ago. I'd try upgrading, but it sounds like downgrading the firmware is difficult at best and recorded in permanent storage in case of a future need for warranty or service.

https://www.avsforum.com/threads/guide-lg-webos-tvs-firmware-downgrade-advanced-users-only.3217168/

lordleo-gh commented 1 year ago

Hi, I have the same issue unfortunately, I did 3 things at the same time. PUtting TV on a smart socket, upgraded home assistant and upgraded LG WebOS. I can exclude the smart socket now as leaving things on doesn't make a difference. From comments I think, it's not Home Assistant and therefore most likely WebOS version... I will see if there is a way to downgrade to confirm. In the meantime I enabled debug logging in the integration.. where can I find these logs though? part of core?

That was in the core log after restarting the integration: Logger: homeassistant.components.media_player Source: helpers/entity_platform.py:797 Integration: Media Player (documentation, issues) First occurred: 10 February 2023 at 18:38:38 (34686 occurrences) Last logged: 19:05:04

Updating webostv media_player took longer than the scheduled update interval 0:00:10

andrewfraley commented 1 year ago

Similar issues here with a C2 . I'll turn the TV off with the remote, then come back later and turn the TV back on with the remote. HA thinks the TV is still off, and the only way to get HA to see that the TV is on, is to restart HA.

jeanke24 commented 1 year ago

Hi. Same here. I use it only for shutting down the TV when pressing an all-off command (scene on KNX). Worked great for about 5 days and then one evening it suddenly stopped working. Shows the TV is powered off while it's on. Only restarting HA helps.

oblanao commented 1 year ago

I too have this problem, the TV appears off in home assistant even though it is turned on. Trying to send commands does not work. Reloading the integration does not fix the problem. Is there any workaround until a fix comes along?

In hass system logs i get

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:550 
First occurred: 10:39:06 PM (1 occurrences) 
Last logged: 10:39:06 PM

Update of media_player.living_room_tv is taking over 10 seconds
kephail commented 1 year ago

I wanted to report that I also have this issue currently. LG g2. Not checked the webos version but it's up to date with the latest available.

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

sebstrand commented 1 year ago

I have the same issue. At some point after restarting Home Assistant the integration stops working and the TV is shown as off until a Home Assistant restart. I've had this issue for a long time, it just hasn't bothered me enough to really look into it until now, because it can sometimes work fine for weeks.

I have enabled debug logging as described in an earlier comment and will comment here if/when I get results.

However, I suspect the issue may be in the aiowebostv lib and not in HA core, because I was able to get client.connect() in the WebOsClient to hang indefinitely by modifying one of the examples to do a loop very similar to the one HA does in the integration. The modified example logged any TV state changes and used a loop which connects if not already connected, then sleeps for a few seconds, and repeat. I'm not really familiar with the HA code, but from what I can tell that is basically what the integration does as well. This worked fine for a couple of days, but then the connect call hung and the loop got stuck there, despite there being timeouts on the socket operations. It looks to me like a hung connect call like that in the webos client used by the integration would cause the error message and other symptoms mentioned in this issue.

thecode commented 1 year ago

However, I suspect the issue may be in the aiowebostv lib and not in HA core, because I was able to get client.connect() in

I do be believe the issue is in aiowebostv and not in core, however it may still be something related to the device (although I don't think it is).

the WebOsClient to hang indefinitely by modifying one of the examples to do a loop very similar to the one HA does in the integration. The modified example logged any TV state changes and used a loop which connects if not already connected, then sleeps for a few seconds, and repeat. I'm not really familiar with the HA code, but from what I can tell that is basically what the integration does as well.

This is exactly what the integration is doing.

This worked fine for a couple of days, but then the connect call hung and the loop got stuck there, despite there being timeouts on the socket operations. It looks to me like a hung connect call like that in the webos client used by the integration would cause the error message and other symptoms mentioned in this issue.

If you can reproduce it, try to set the log level to debug. You can also set the whole example log level to debug which will also print log messages from websockets and maybe something will pop up. I was never able to reproduce this problem, however I did had a single occurrence similar to this when I had construction works at my house and disconnected power & network sections multiple times.

kephail commented 1 year ago

I have used the above automation posted by @Yojimboz which is not ideal but does appear to work as a temporary fix in my case for the time being. For others having this issue I recommend trying it. Would be great to see this fixed though.

oblanao commented 1 year ago

After coming across a similar post on the Facebook group, where people suggested reserving an IP address for LG TVs, I configured the Network router by reserving an IP address for my LG webOS TV, and it works perfectly now. Just so you know, I am running a TP-Link Deco X50 Mesh.

sebstrand commented 1 year ago

I have attached a log from when my modified aiowebostv example hung while reconnecting to the TV. Debug logging was enabled. I added a few notes to the log. The modified loop tries to reconnect every 3 seconds, I figured more reconnects means higher chance of failure. My Home Assistant instance has not lost connection to the TV during the same time I've been running this code.

aiowebostv_connect_hanging.log

As seen in the log the connect call hung just after the TV was turned off by its timer (2 hours with no user input). The previous time that I got the same code to hang but without debug logging turned on was also after an automatic suspend. Maybe the TV behaves slightly different during the automatic suspend than it does when turned off with the remote? It doesn't happen every time it's turned off by the timer though.

nioakeim commented 1 year ago

Hello everyone, i just experienced a very similar issue to this, looking for some place to report this. My LG TV webos for some weird reason stopped responding after a network connectivity loss, (all my home stack is on one server including internet gateway and home assistant) and webos integration did not allow home assistant to complete the boot up process. Only if i disabled the integration and did a complete system reboot (vm). I figured out the issue the opposite way trying to understand what is happening and realised my tv did not respond. I had to power down/up the tv as well.

thecode commented 1 year ago

@nioakeim not related, please create a new issue. Thanks

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

deviantintegral commented 1 year ago

After coming across a similar post on the Facebook group, where people suggested reserving an IP address for LG TVs, I configured the Network router by reserving an IP address for my LG webOS TV

Can someone else confirm setting a static IP for the TV solves this? Or if a newer firmware works without issue? If setting a static IP seems the best way to solve this, then perhaps we update that in the integration docs and can close this issue.

danieldabate commented 1 year ago

In my case I've always had a static IP and experienced the issue. Also tried Ethernet and Wifi without difference.

I ended up implementing an automation that resets the webos integration in Home Assistant every 5 minutes. Probably the issue still happens, but the odds of noticing it are probably very low.

On Thu, 31 Aug 2023 at 22:55 Andrew Berry @.***> wrote:

After coming across a similar post on the Facebook group, where people suggested reserving an IP address for LG TVs, I configured the Network router by reserving an IP address for my LG webOS TV

Can someone else confirm setting a static IP for the TV solves this? Or if a newer firmware works without issue? If setting a static IP seems the best way to solve this, then perhaps we update that in the integration docs and can close this issue.

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

thecode commented 1 year ago

I ended up implementing an automation that resets the webos integration in Home Assistant every 5 minutes. Probably the issue still happens, but the odds of noticing it are probably very low.

@danieldabate Would be nice if you disable the automation and check it again, if it fails please provide logs. There was a bug which required reloading the integration which was fixed long time ago. This will help identifying the issue.

danieldabate commented 1 year ago

When was that bug fixed?

I'll try again. But last time I checked, the logs were not very helpful (even in debug). Also the error is so random, that it could take 1 day or 60 to trigger.

On Sat, 2 Sep 2023 at 00:06 Shay Levy @.***> wrote:

In my case I've always had a static IP and experienced the issue. Also tried Ethernet and Wifi without difference. I ended up implementing an automation that resets the webos integration in Home Assistant every 5 minutes. Probably the issue still happens, but the odds of noticing it are probably very low. … <#m-334046438070721811> On Thu, 31 Aug 2023 at 22:55 Andrew Berry @.***> wrote: After coming across a similar post on the Facebook group, where people suggested reserving an IP address for LG TVs, I configured the Network router by reserving an IP address for my LG webOS TV Can someone else confirm setting a static IP for the TV solves this? Or if a newer firmware works without issue? If setting a static IP seems the best way to solve this, then perhaps we update that in the integration docs and can close this issue. >

@danieldabate https://github.com/danieldabate Would be nice if you disable the automation and check it again, if it fails please provide logs. There was a bug which required reloading the integration which was fixed long time ago. This will help identifying the issue.

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

danieldabate commented 1 year ago

After 1 week I again got to the point were I need to restart the integration for it to work again. I'll re-enable the automation.

This is the log that starts appearing when this happens: [33m2023-09-07 08:24:54.777 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.living_room_tv is taking over 10 seconds [33m2023-09-07 08:24:54.779 WARNING (MainThread) [homeassistant.components.media_player] Updating webostv media_player took longer than the scheduled update interval 0:00:10

Also the following log appears every 10 seconds before this happened, then Home Assistant restarted and this message stops appearing in the logs after the restart. A few hours later the previous log appears and the integrations stops working.

[36m2023-09-06 23:36:17.586 DEBUG (MainThread) [aiowebostv] connect(192.168.1.164): uri: ws://192.168.1.164:3000 [0m [36m2023-09-06 23:36:19.587 DEBUG (MainThread) [aiowebostv] exception(192.168.1.164): 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

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiowebostv/webos_client.py", line 124, in connect_handler main_ws = await self._ws_connect(uri, ssl_context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiowebostv/webos_client.py", line 104, in _ws_connect return await ws_connect( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 654, in await_impl_timeout async with asyncio_timeout(self.open_timeout): File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in aexit raise TimeoutError from exc_val TimeoutError [0m

Hope this helps!

thekillerpt commented 1 year ago

I also have the same issue, LG webos 23, TV is just 2 weeks old so I've just started using the integration. Ha 2023.9. It's on WiFi with a fixed IP (set on router) . Just restarting the integration it recovers

gregsheremeta commented 1 year ago

Can someone else confirm setting a static IP for the TV solves this?

It did not for me. I have one LG C1 and two LG C2s. All set to static IPs in pfsense. The C1 doesn't stop responding, but the C2s both do, intermittently.

Home Assistant logs don't show anything. I may need to increase the log verbosity.

Just restarting the integration it recovers

that works for me as well

lordleo-gh commented 1 year ago

My problem seem to have completely disappeared. I have done some work on the house and cabled the place with network cables and that seem to have stabilised the connection and no issues since. Before I had wifi which was bad at the best of times and powerline adapters which were better but failed sometimes too.

Yojimboz commented 1 year ago

I have to confirm my problem is gone too. After disabling my workaround automation (which restarts Webos integration every 15 min), it seems everything's working. No Webos update since then, no network configuration changes. Maybe one of HA updates solved this issue for me.

TV is connected via cable, static IP.

gregsheremeta commented 1 year ago

TV is connected via cable, static IP.

I'll need to try this with My C2s. There are innumerable threads on reddit with people talking about C2s being unreliable on wifi. I've noticed both of my C2s just stop being pingable over wifi. Talk about buyer's remorse... Anyway, makes me wonder if the primary problem I'm seeing with the integration is actually just this wifi problem.

wzaatar commented 1 year ago

Same issue as the rest of the folks. Wifi connection with static DHCP for the TV. Problem happens sporadically and a "reload entity" fixes it until the next time around.

Running latest HA version (2023.9.3 at the time of writing this message) as we as the latest WebOS version, still facing the problem.