merdok / homebridge-webos-tv

Homebridge plugin for LG webOS TVs
MIT License
656 stars 88 forks source link

TV appears "off" in Home App #252

Closed solbadguy2010 closed 4 years ago

solbadguy2010 commented 4 years ago

Since i changes my config from Accessories to Plattform and also updated to the latest Version i have a strange behavior.

I can power on my tv and all looks good. But after a few seconds the device in Home appears to be off again and i can not control it anymore. When i power it back on in home i can control if for a few seconds, then it goes back to be off, TV stays on the whole time.

I checked IP and Mac, all fine. No errors in the log, but it writes every few seconds

[6/2/2020, 23:56:39] [webostv] [Fernseher] Connected to TV [6/2/2020, 23:56:43] [webostv] [Fernseher] Connected to TV [6/2/2020, 23:56:47] [webostv] [Fernseher] Connected to TV

What am i doing wrong?

Here is my config:

{ "devices": [ { "name": "Fernseher", "ip": "10.0.1.90", "mac": "04:4E:AF:5D:CE:E0", "pollingInterval": 2, "legacyTvService": false, "showInputButtons": false, "volumeControl": "false", "volumeLimit": 100, "channelControl": false, "mediaControl": false, "inputs": [ { "appId": "com.webos.app.livetv", "name": "Fernsehen" }, { "appId": "com.webos.app.hdmi1", "name": "Apple TV" }, { "appId": "com.webos.app.hdmi2", "name": "Soundbar" }, { "appId": "com.webos.app.hdmi3", "name": "Nintendo Switch" } ], "notificationButtons": [ { "message": "Program der Waschmaschine ist beendet.", "name": "Waschmaschine fertig" }, { "message": "Das Program der Spülmaschine ist beendet.", "name": "Spülmaschine fertig" }, { "message": "Achtung! Kohlendioxid zu hoch! Bitte Lüften!", "name": "Achtung CO2" } ], "infoButtonAction": "MENU" } ], "platform": "webostv" }

merdok commented 4 years ago

At first everything looks ok. Seems like your TV is losing connection to homebridge but this is just a guess. You would need to check the debug log and maybe post the relevant information here.

solbadguy2010 commented 4 years ago

Debug Log repeats this all the time:

[6/3/2020, 07:56:39] [webostv] [Fernseher] System info: { "features": { "3d": false, "dvr": true }, "receiverType": "dvb", "modelName": "55UK6100PLB" } [6/3/2020, 07:56:39] [webostv] [Fernseher] TV info file already exists, not saving! [6/3/2020, 07:56:39] [webostv] [Fernseher] Service list: { "services": [ { "name": "api", "version": 1 }, { "name": "audio", "version": 1 }, { "name": "config", "version": 1 }, { "name": "media.controls", "version": 1 }, { "name": "media.viewer", "version": 1 }, { "name": "pairing", "version": 1 }, { "name": "settings", "version": 1 }, { "name": "system", "version": 1 }, { "name": "system.launcher", "version": 1 }, { "name": "system.notifications", "version": 1 }, { "name": "timer", "version": 1 }, { "name": "tv", "version": 1 }, { "name": "user", "version": 1 }, { "name": "webapp", "version": 2 } ] } [6/3/2020, 07:56:40] [webostv] [Fernseher] Sw information: { "product_name": "webOSTV 3.5", "model_name": "HE_DTV_W17P_AFADABAA", "sw_type": "FIRMWARE", "major_ver": "05", "minor_ver": "80.50", "country": "DE", "country_group": "EU", "device_id": "78:5d:c8:82:fc:e1", "auth_flag": "N", "ignore_disable": "N", "eco_info": "01", "config_key": "00", "language_code": "de-DE" } [6/3/2020, 07:56:42] [webostv] [Fernseher] Disconnected from TV [6/3/2020, 07:56:44] [webostv] [Fernseher] Connecting to TV [6/3/2020, 07:56:44] [webostv] [Fernseher] TV state: got response from TV, connecting... [6/3/2020, 07:56:44] [webostv] [Fernseher] Connected to TV, checking power status [6/3/2020, 07:56:44] [webostv] [Fernseher] Power status - TV is On [6/3/2020, 07:56:44] [webostv] [Fernseher] Connected to TV [6/3/2020, 07:56:44] [webostv] [Fernseher] Requesting TV information [6/3/2020, 07:56:45] [webostv] [Fernseher] Launch points (inputs, apps): [ { "appId": "com.webos.app.livetv", "name": "Live TV" }, { "appId": "joyn", "name": "Joyn" }, { "appId": "netflix", "name": "Netflix"

.... shortened this here....

{ "appId": "com.webos.app.connectionwizard", "name": "Geräteanschluss" }, { "appId": "com.webos.app.accessibility", "name": "Barrierefreiheit" }, { "appId": "com.webos.app.notificationcenter", "name": "Benachrichtigungen" } ] [6/3/2020, 07:56:45] [webostv] [Fernseher] System info: { "features": { "3d": false, "dvr": true }, "receiverType": "dvb", "modelName": "55UK6100PLB" } [6/3/2020, 07:56:45] [webostv] [Fernseher] TV info file already exists, not saving!

solbadguy2010 commented 4 years ago

I reinstalled the Plugin and also re-checked all TV settings and plugged its power a few secs. Nothing helped. Ping is constantly going through. I think the network is not the problem.

merdok commented 4 years ago

Maybe try to re-add your TV to home again. There are some extra steps required when configuring the TV as a platform.

solbadguy2010 commented 4 years ago

Already did that. Also deleted the TV from Homebridge Cache before re-adding it.

Also the TV appears offline in the Homebridge Web UI. Therefore i think its not a Home App Problem.

merdok commented 4 years ago

Well, something disconnects your tv. Based on the logs everything looks fine, the tv loses connection and the plugin tries to reconnect. Why this is happening with your setup I cannot honestly tell. You can also try to set your pooling interval to higher value.

solbadguy2010 commented 4 years ago

I just tried grzegorz914‘s plugin for testing. Same behavior in the Logs. Disconnect, then reconnect, except here the TV in the home app goes on and off all the time.

https://share.icloud.com/photos/0QPsFDcCs8pFgTwK_SESC_kpQ

Am i the only one with this error?

merdok commented 4 years ago

I did not hear any other reports of such issue before.

Like I already said, there is something in your setup which constantly disconnects your tv. If it is a network issues, homebridge issue or something else I cannot tell at this point. Maybe some of your dependencies are outdated? You could also try to reinstall homebridge.

BTW, his plugin will give the same result as this is a copy of my plugin...

solbadguy2010 commented 4 years ago

I just rebooted my entire Network. Router, Pi, Tv. Everything. Nothing changed.

I have one Idea left. I installed the newest beta firmware to my Fritz Box 7490 some days ago. Maybe this is causing the errors? If this is true, the problem will get bigger if the firmware is rolled out to all Fritz Boxes.

merdok commented 4 years ago

Can you not roll back the firmware on your FritzBox to check if that is indeed what is causing the issue? I mean it could be plausible that the router disconnects the websocket because it thinks that it might be a security issue?

solbadguy2010 commented 4 years ago

I can. I will do it asap. Currently working from home and need to stay online.

solbadguy2010 commented 4 years ago

I rolled back to stable release firmware and set up my fritz box without using a backup. Error stays the same...

merdok commented 4 years ago

Well then it is not related to your router i would guess. Another option would be to try reinstall homebridge, or even better try on a fresh image if you are running on a raspberry pi.

solbadguy2010 commented 4 years ago

Flashed the SD with the official Homebridge Image and only installed your Plugin. Error stays the same :-/

merdok commented 4 years ago

Well, no ideas at this point anymore. I guess there has to be something that changed in your setup since you mentioned that it was working before...

solbadguy2010 commented 4 years ago

Sadly i do not know when it stopped working. Last thing left is resetting the TV to factory defaults...

solbadguy2010 commented 4 years ago

Can you tell me how the Plugin determines if the TV is on or not?

merdok commented 4 years ago

Connects to a websocket endpoint on the TV.

keefar commented 4 years ago

I have the same problem. I also updated to the newest plugin version today and my fritzbox installed the newest beta firmware a couple of days ago. But I'm experiencing the error since updating the plugin.

I found this in the log repeatedly. I don't know which command caused it. I will try to reproduce it.

[webostv] [TV] Connected to TV (node:3731) UnhandledPromiseRejectionWarning: TypeError: Promise.allSettled is not a function at webosTvPlatformDevice.getTvInformation (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:310:23) at webosTvPlatformDevice.connect (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:184:14) at lgtv.request (/usr/local/lib/node_modules/homebridge-webos-tv/index.js:142:26) at Object.callbacks.(anonymous function) (/usr/local/lib/node_modules/homebridge-webos-tv/node_modules/lgtv2/index.js:216:25) at WebSocketConnection. (/usr/local/lib/node_modules/homebridge-webos-tv/node_modules/lgtv2/index.js:146:48) at WebSocketConnection.emit (events.js:198:13) at WebSocketConnection.processFrame (/usr/local/lib/node_modules/homebridge-webos-tv/node_modules/websocket/lib/WebSocketConnection.js:554:26) at /usr/local/lib/node_modules/homebridge-webos-tv/node_modules/websocket/lib/WebSocketConnection.js:323:40 at process._tickCallback (internal/process/next_tick.js:61:11) (node:3731) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 11502)

merdok commented 4 years ago

@keefar your issue is a not up to date node version. You need to use at least version 12.9 as specified in the package.json.

solbadguy2010 commented 4 years ago

I also resettet the TV to factory defaults now. Nothing changed. I basically resettet all of my hardware now. nothing helped. Can you tell me the Port of the Webhook you use, if Webhooks use ports...

merdok commented 4 years ago

Port 3000

solbadguy2010 commented 4 years ago

some way we can try another port or an alternate way of checking the TV is on like "Ping"?

merdok commented 4 years ago

Unfortunately not, the port cannot be changed. It is not about checking if the tv responds to a ping or not, this only gives me an info if the tv is reachable or not and does not tell me if the tv is on or not. A websocket connection needs to be all the time on or else you would not be able to control the tv. Something is disconnecting this websocket connection for some reason, you would need to find out what exactly...

solbadguy2010 commented 4 years ago

Any general ideas what can disconnect a websocket connection? What cought my attention: In germany a new app "Join" was pushed a few days ago. I deleted it, no change. But could LG have changed something in their firmware?

merdok commented 4 years ago

I do not think that lg changed something in the firmware. This would affect a lot of other users then. I can certainly say that this is an issue related to your local environment. Since I never experienced this issue before I honestly have no idea what exactly causes this. I mean if it was working before then you just need to find out what changed recently with your setup and try to revert back temporary.

Sebbl81 commented 4 years ago

I have the same Issue that my LG Web OS isn't shown as Online. Everything else is working like Notification,...

Bildschirmfoto 2020-06-05 um 10 37 19 Bildschirmfoto 2020-06-05 um 10 38 34 Bildschirmfoto 2020-06-05 um 10 41 01
solbadguy2010 commented 4 years ago

I also testet wired connection to the TV now. Same error. So its not the Wifi...

I rolled everything back i am aware of, what could have changed. I even unplugged my new Osram Bluetooth light strip, even if BT can not interfere... Only to be sure.

All i can not roll back are the software-updates happened to the WebOS, the Raspbian, Homebridge and your Plugin. I think we need to find the change in the Software???

Also just checked Sebbl81's post. His config looks linke mine. The error looks the same.

Sebbl81 commented 4 years ago

Here is my Homebridge Configuration (Version)

Bildschirmfoto 2020-06-05 um 10 45 17
solbadguy2010 commented 4 years ago

@Sebbl81 Node and NPM Version are the same as mine.

Sebbl81 commented 4 years ago

So it a bug in the Homebridge Plugin from my point of view....

solbadguy2010 commented 4 years ago

@Sebbl81 only strange, that not more users have these errors. Maybe some error that only affects Fritz Box Users? What Model is your TV?

Sebbl81 commented 4 years ago

@solbadguy2010 I'm using Homebridge on a Synology Docker installation. My TV is WebOS TV EG9109 on Software Version 04.06.30.

I'm using the FritzBox as DHCP Server and a Ruckus WiFi AP for the WiFi. I tested it also with a cabled connection and have the same problem.

merdok commented 4 years ago

Oh, you both have a FritzBox. I start to suspect that the FritzBox indeed might be the issue.

@Sebbl81 your tv also clearly gets constantly disconnected as seen in the log. This is of course not as its supposed to be. You can only control your tv because you have a low pooling interval so the tv reconnects every 5 seconds.

I am pretty certain this issue is not related to the plugin itself.

solbadguy2010 commented 4 years ago

So, we have different LG TVs.

I had the issue with three different Fritz OS Versions now: FRITZ!OS-113.07.12 FRITZ!OS-07.19-78834 BETA FRITZ!OS-07.19-78988 BETA

Most important here is the 7.12, which was released in July 2019. So even if the error is Fritz Box related, it is not caused by a change of Fritz OS recently. Maybe you changed something in your Plugin that triggers and Fritz Box related error that was already there?

@Sebbl81: What Fritz Box do you use and what OS is installed?

Sebbl81 commented 4 years ago

@solbadguy2010 I tried the same Fritz OS and I tried it also with a Mikrotik as gateway.

I see also the problem on the plugin side.

merdok commented 4 years ago

@Sebbl81 can you post a debug log? Like that above just in debug mode. If it is too big you upload it somewhere like gist.

phlexx commented 4 years ago

I have the same issue. TV keeps disconnecting. Plugin is able to fetch launchpoints etc then disconnects. Not using a fritzbox.

can i help?

solbadguy2010 commented 4 years ago

@phlexx Please also post a debug log. You can enable Debug mode in the settings.

BAA0A017-C212-462A-AE63-F2B931AAE51B

Please also list your used hardware. Pi? TV? Router?

Sebbl81 commented 4 years ago

Here is my Debug Log homebridge.log

merdok commented 4 years ago

Thanks, the log looks ok. I do not see anything which might close the connection. Could you try to revert back the plugin version by version and check if the issues disappears, if yes then you would need to tell me at which exactly version it happend, so at least i can have a look at the changes.

solbadguy2010 commented 4 years ago

How can i install an older Version? And where can i see which Versions released when?

merdok commented 4 years ago

sudo npm -g install homebridge-webos-tv@1.8.6

https://www.npmjs.com/package/homebridge-webos-tv

shrimpbox commented 4 years ago

I have the same problem. I tried different versions. 1.7.1 works for me. Versions > 1.8.x don't work anymore.

solbadguy2010 commented 4 years ago

i can confirm @shrimpbox's test results. 1.7.1 is working without any problem. Starting with 1.8.0 the TV is "off" all the time.

While testing 1.8.0 terminal threw this at me when i played with TV power and switching inputs. Maybe it helps?

[6/5/2020, 20:53:50] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:53:52] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:53:54] [webostv] [Fernseher] App switch service - Trying to launch com.webos.app.livetv but TV is off, attempting to power on the TV [6/5/2020, 20:53:54] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:53:56] [webostv] [Fernseher] Error - Error: Sec-WebSocket-Accept header from server didn't match expected value of VExVbYkcSCLrYXN5VuoTipJVfAE= at WebSocketClient.failHandshake (/usr/lib/node_modules/homebridge-webos-tv/node_modules/websocket/lib/WebSocketClient.js:339:32) at WebSocketClient.validateHandshake (/usr/lib/node_modules/homebridge-webos-tv/node_modules/websocket/lib/WebSocketClient.js:326:14) at ClientRequest.handleRequestUpgrade (/usr/lib/node_modules/homebridge-webos-tv/node_modules/websocket/lib/WebSocketClient.js:261:14) at ClientRequest.emit (events.js:315:20) at Socket.socketOnData (_http_client.js:503:11) at Socket.emit (events.js:315:20) at addChunk (_stream_readable.js:295:12) at readableAddChunk (_stream_readable.js:271:9) at Socket.Readable.push (_stream_readable.js:212:10) at TCP.onStreamRead (internal/stream_base_commons.js:186:23) [6/5/2020, 20:53:57] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:53:58] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:54:00] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:54:02] [webostv] [Fernseher] Connected to TV [6/5/2020, 20:54:04] [webostv] [Fernseher] Connected to TV

merdok commented 4 years ago

Ok, that is some progress now! But i am still not sure what exactly is causing the issue. Could somebody modify the index.js locally and do some testing for me?

solbadguy2010 commented 4 years ago

@merdok If you tell me what i need to do... I'll add you on Twitter for easier chatting. (https://twitter.com/__Timo__)

Index

shrimpbox commented 4 years ago

I commented out the getTvInformation in the connect function. Now the TV gets connected. // --== CONNECT/DISCONNECT METHODS ==--
connect() { this.logInfo('Connected to TV'); this.connected = true; // this.getTvInformation().then(() => { this.logDebug('Got TV information proceeding with launch'); this.updateTvStatus(null, true); this.subscribeToServices(); this.connectToPointerInputSocket(); this.updateAccessoryStatus(); // }); }

merdok commented 4 years ago

@shrimpbox can you just comment out this lines and check if that also helps? https://github.com/merdok/homebridge-webos-tv/blob/f337f53435a0e1cfd13807eb47f42075af7e23dc/index.js#L286-L308

shrimpbox commented 4 years ago

@merdok This helps. Works for me.