Closed ArtemKiyashko closed 3 years ago
May be U get some debug log from console?
I got same problem with different plugins too, debug log is this:
[5/8/2021 14:05:41] [webostv] [Tele] Connected to TV [5/8/2021 14:05:41] [webostv] [Tele] Requesting TV information [5/8/2021 14:05:41] [webostv] [Tele] system service - getSystemInfo requested. [5/8/2021 14:05:41] [HB Supervisor] Homebridge Process Ended. Code: null, Signal: SIGBUS [5/8/2021 14:05:46] [HB Supervisor] Restarting Homebridge...
Some clue, if i don´t enable the tv connection it works, problem seems happen when is sharing some info.
this is not from my plugin
yes i know, it was my test on the other, i´m currently installing yours again. It was only to let you know some clue.
I can share with you now the log with yours:
[5/8/2021 14:29:04] [LgWebOsTv] Device: XXX.XXX.XXX.XXX Tele, waiting on confirmation... [5/8/2021 14:29:07] [LgWebOsTv] Device: XXX.XXX.XXX.XXX Tele, connected. [5/8/2021 14:29:07] [LgWebOsTv] Device: XXX.XXX.XXX.XXX Tele, connecting to TV RC Socket [5/8/2021 14:29:07] [HB Supervisor] Homebridge Process Ended. Code: null, Signal: SIGBUS [5/8/2021 14:29:12] [HB Supervisor] Restarting Homebridge...
I hope this log can throw more info.
what a tv model, homebridge, npm, node version? installed machine, config
SW: 05.60.05 TV: webOS TV UH850V Homebridge v1.3.4 Node: v14.17.4 NPM: 7.20.3 Raspberry pi 4 "devices": [ { "name": "Tele", "host": "XXX", "mac": "XXX", "refreshInterval": 5, "disableLogInfo": false, "switchInfoMenu": false, "getInputsFromDevice": true } ], "platform": "LgWebOsTv"
This is webOS TV 3.0 must working, try uninstalling all other plugins and try again, may be some conflict, check write permission to disk
@grzegorz914 sorry, for the lack of info, havent expect so rapid reaction. So... Part from console:
[05/08/2021, 14:50:33] [LgWebOsTv] Device: 192.168.1.56 LG TV, Input: Wink, get target visibility state: SHOWN
[05/08/2021, 14:50:33] [LgWebOsTv] Device: 192.168.1.56 LG TV, Input: Российские программы, get target visibility state: SHOWN
[05/08/2021, 14:50:33] [LgWebOsTv] Device: 192.168.1.56 LG TV, Input: PREMIER, get target visibility state: SHOWN
[05/08/2021, 14:50:33] [LgWebOsTv] Device: 192.168.1.56 LG TV, Input: wifire-tv-lite, get target visibility state: SHOWN
[05/08/2021, 14:50:37] [LgWebOsTv] Device: 192.168.1.56 LG TV, connected.
[05/08/2021, 14:50:37] [HB Supervisor] Homebridge Process Ended. Code: null, Signal: SIGBUS
[05/08/2021, 14:50:42] [HB Supervisor] Restarting Homebridge...
OS: Raspbian GNU/Linux Buster (10) Node v: v14.17.4 Npm v: v6.14.14
Config part:
{
"devices": [
{
"name": "LG TV",
"host": "192.168.1.56",
"mac": "60:AB:14:59:79:66",
"refreshInterval": 5,
"disableLogInfo": false,
"switchInfoMenu": false,
"getInputsFromDevice": true
}
],
"platform": "LgWebOsTv"
},
Plugin version: 1.8.17 TV Model: LG OLED C9
Just disabled all other plugins and got the same:
try uninstall one webOS plugin
@grzegorz914 done. the same =(
Can You enable debug mode in HB config and get the log again?
In my case the log is with debug mode in HB:
[5/8/2021 14:29:07] [LgWebOsTv] Device: XX Tele, connected. [5/8/2021 14:29:07] [LgWebOsTv] Device: XX Tele, connecting to TV RC Socket [5/8/2021 14:29:07] [HB Supervisor] Homebridge Process Ended. Code: null, Signal: SIGBUS [5/8/2021 14:29:12] [HB Supervisor] Restarting Homebridge... [5/8/2021 14:29:12] [HB Supervisor] Starting Homebridge with extra flags: -I -D [5/8/2021 14:29:12] [HB Supervisor] Started Homebridge v1.3.4 with PID: 2878
@infvmm this is not a debug mode log
@grzegorz914 is it not enough with -D flag?. If there is another way to enable debug mode log please let me know to be able to share more info. I´m going to share all I have currently with -D in my log, i didn´t share all info:
[5/8/2021 15:38:20] [LgWebOsTv] didFinishLaunching
[5/8/2021 15:38:20] [LgWebOsTv] Adding new accessory: Tele
[5/8/2021 15:38:20] [LgWebOsTv] prepareAccessory
[5/8/2021 15:38:20] [LgWebOsTv] prepareInformationService
[5/8/2021 15:38:20] [LgWebOsTv] Device: XXXXX Tele, prepareInformationService error: SyntaxError: Unexpected end of JSON input
at JSON.parse (
@grzegorz914
[05/08/2021, 15:52:19] [LgWebOsTv] Device: 192.168.1.56 LG TV, connecting to TV
[05/08/2021, 15:52:19] [LgWebOsTv] Device: 192.168.1.56 LG TV, connecting...
[05/08/2021, 15:52:19] [LgWebOsTv] Device: 192.168.1.56 LG TV, connect error: Error: Sec-WebSocket-Accept header from server didn't match expected value of IB10Sjb7/BMeKwogakSNMizEHAw=
at WebSocketClient.failHandshake (/usr/local/lib/node_modules/homebridge-lgwebos-tv/node_modules/websocket/lib/WebSocketClient.js:339:32)
at WebSocketClient.validateHandshake (/usr/local/lib/node_modules/homebridge-lgwebos-tv/node_modules/websocket/lib/WebSocketClient.js:326:14)
at ClientRequest.handleRequestUpgrade (/usr/local/lib/node_modules/homebridge-lgwebos-tv/node_modules/websocket/lib/WebSocketClient.js:261:14)
at ClientRequest.emit (events.js:400:28)
at Socket.socketOnData (_http_client.js:553:11)
at Socket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at Socket.Readable.push (internal/streams/readable.js:204:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
[05/08/2021, 15:52:19] [LgWebOsTv] Device: 192.168.1.56 LG TV, connected.
[05/08/2021, 15:52:19] [LgWebOsTv] Device: 192.168.1.56 LG TV, connecting to TV RC Socket
[05/08/2021, 15:52:19] [HB Supervisor] Homebridge Process Ended. Code: null, Signal: SIGBUS
[05/08/2021, 15:52:24] [HB Supervisor] Restarting Homebridge...
@grzegorz914 i cant see JSON parsing error like in @infvmm log, the only error i can see is
[05/08/2021, 15:52:49] [LgWebOsTv] Device: 192.168.1.56 LG TV, connect error: Error: Sec-WebSocket-Accept header from server didn't match expected value of 7qoYCKsIwn+QLrH775yCoyoTvZE=
are You accept permission for this plugin on TV, are You enabled LG Connect App in TV Settings
i dont see any request for this plugin on my TV, but Wi-Fi control from apps enabled in the settings. Do i need something else? As well i can control my TV from Lg ThinQ official app
@grzegorz914 In my case yes for both, I have this enabled, in fact i can use the app from mobile, and HB restart in the moment I accept on TV permissions, I´ve purged all homebridge from system and started again only with this plugin, i had to assing permissions on /home/homebridge/. After that:
[5/8/2021 16:18:50] [LgWebOsTv] Initializing LgWebOsTv platform...
[5/8/2021 16:18:50] [LgWebOsTv] didFinishLaunching
[5/8/2021 16:18:50] [LgWebOsTv] Adding new accessory: Tele
[5/8/2021 16:18:50] [LgWebOsTv] prepareAccessory
[5/8/2021 16:18:50] [LgWebOsTv] prepareInformationService
[5/8/2021 16:18:50] [LgWebOsTv] Device: XXX Tele, prepareInformationService error: SyntaxError: Unexpect ed end of JSON input
at JSON.parse (
I was reading this part and it seems it fails when tries to read the json from manufaturer info, .... here: at lgwebosTvDevice.prepareAccessory (/usr/lib/node_modules/homebridge-lgwebos-tv/index.js:506:55)
I suppose this not to be the problem :(, i don´t know how can i help more.
Tbh, both plugins (this and webostv) was working fine till today morning. Im 100% sure 2 days ago i was able to control my TV in HB
Moreover, i can natively add this TV to Apple Home app, but i would like to use it on a homebridge =)
Please check /var/lib/homebridge/lgwebosTv/ folder permission, here need to store all data
pi@homebridge:/var/lib/homebridge $ ls -la
total 2884
drwxr-xr-x 8 homebridge homebridge 4096 Aug 5 16:47 .
drwxr-xr-x 46 root root 4096 Jul 31 14:49 ..
drwxr-xr-x 2 homebridge homebridge 4096 Aug 5 10:45 accessories
-rw-r--r-- 1 homebridge homebridge 387 Jun 28 20:26 auth.json
drwxr-xr-x 4 homebridge homebridge 4096 Jun 16 05:11 backups
-rw-r--r-- 1 homebridge homebridge 3247 Aug 5 16:47 config.json
-rw-r--r-- 1 homebridge homebridge 5769 Jun 17 10:53 homebridge-hue.json.gz
-rw-r--r-- 1 homebridge homebridge 2878483 Aug 5 17:03 homebridge.log
drwxr-xr-x 2 homebridge homebridge 4096 Aug 5 11:40 lgwebosTv
drwxr-xr-x 2 homebridge homebridge 4096 Aug 5 12:22 persist
-rw-r--r-- 1 homebridge homebridge 5605 Aug 5 12:24 .smartglass.tokens.json
-rw-r--r-- 1 homebridge homebridge 845 Aug 5 12:08 .uix-dashboard.json
-rw-r--r-- 1 homebridge homebridge 94 Aug 5 16:17 .uix-hb-service-homebridge-startup.json
-rw-r--r-- 1 homebridge homebridge 81 Apr 27 13:00 .uix-secrets
drwxr-xr-x 2 homebridge homebridge 4096 Jun 18 00:03 .webosTv
drwxr-xr-x 2 homebridge homebridge 4096 Aug 5 09:46 xboxTv
pi@homebridge:/var/lib/homebridge $
pi@homebridge:/var/lib/homebridge/lgwebosTv $ ls -la
total 28
drwxr-xr-x 2 homebridge homebridge 4096 Aug 5 11:40 .
drwxr-xr-x 8 homebridge homebridge 4096 Aug 5 16:47 ..
-rw-r--r-- 1 homebridge homebridge 0 Jun 17 22:34 customInputs_192168156
-rw-r--r-- 1 homebridge homebridge 498 Jun 17 23:25 devInfo_192168156
-rw-r--r-- 1 homebridge homebridge 8160 Jun 17 23:25 inputs_192168156
-rw-r--r-- 1 homebridge homebridge 401 Aug 5 11:43 inputsNames_192168156
-rw-r--r-- 1 homebridge homebridge 32 Jun 17 23:25 key_192168156
-rw-r--r-- 1 homebridge homebridge 0 Jun 17 22:34 targetVisibilityInputs_192168156
pi@homebridge:/var/lib/homebridge/lgwebosTv $
do you need content any of this files?
My case have permissions but all is empty:
0 -rw-r--r-- 1 homebridge homebridge 0 ago 5 16:09 devInfo_192168192 0 -rw-r--r-- 1 homebridge homebridge 0 ago 5 16:09 inputs_192168192 0 -rw-r--r-- 1 homebridge homebridge 0 ago 5 16:09 inputsNames_192168192 0 -rw-r--r-- 1 homebridge homebridge 0 ago 5 16:09 targetVisibilityInputs_192168192
all looks good, I don't know what is wrong on Your side, I have running this on 4 different TV all working correct
All are empty because HB crashes before plugin stores it’s data
The only change I made yesterday - added “arm_64=1” into boot.txt of my RPI. Because without that there was another problem (not related to HB) :) Not sure if it’s matter, but…
Revert this changes and try again
Me too, but i think both of us can´t revert this, in my case generate OOM in rasp i think due to a bug.
@infvmm indeed!
I can try a little bit later, but as @infvmm mentioned we cannot remove this option forever, but just to determine the problem I will do it temporary
What I could read: Sec-WebSocket-Accept header from server didn't match expected value --> This only happens when more than one WS connections are made in a tight loop. Unit test can reproduce this most of the time. Being a tight loop: a loop which heavily uses I/O or processing resources, failing to adequately share them with other programs running in the operating system.
It could be this change (arm_64) affect.
I was doing a tcpdump trying to check anything, what I saw: HTTP/1.1: Upgrade connection, websocket upgrade. Websocket version 13 HTTP/1.1: Switching protocols Websocket: register Websocket: response with id: 61ad..... HTTP/1.1: Upgrade connection, websocket upgrade. HTTP/1.1: Switching protocols Websocket: register Websocket: 409 register already in progress Websocket: response with id: 0f0.....
It seems it registers twice with two different ids, i think i only enabled one in the tv. Problem is it could be as HB reboot i took two different registration but i don´t think so.
Without knowledge about what it should do it´s what i can take.
without: “arm_64=1" [5/8/2021 18:18:47] [LgWebOsTv] Device: XXX Tele, connecting to TV [5/8/2021 18:18:47] [LgWebOsTv] Device: XXX Tele, connecting... [5/8/2021 18:18:47] [LgWebOsTv] Device: XXX Tele, connect error: Error: Sec-WebSocket-Accept header from server didn't match expected value of zqcmGmGfo9mMBcY6aRZmIPn37XQ= at WebSocketClient.failHandshake (/usr/lib/node_modules/homebridge-lgwebos-tv/node_modules/websocket/lib/WebS ocketClient.js:339:32) at WebSocketClient.validateHandshake (/usr/lib/node_modules/homebridge-lgwebos-tv/node_modules/websocket/lib/ WebSocketClient.js:326:14) at ClientRequest.handleRequestUpgrade (/usr/lib/node_modules/homebridge-lgwebos-tv/node_modules/websocket/lib /WebSocketClient.js:261:14) at ClientRequest.emit (events.js:400:28) at Socket.socketOnData (_http_client.js:553:11) at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:290:12) at readableAddChunk (internal/streams/readable.js:265:9) at Socket.Readable.push (internal/streams/readable.js:204:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) [5/8/2021 18:18:47] [LgWebOsTv] Device: XXX Tele, connected. [5/8/2021 18:18:47] [LgWebOsTv] Device: XXX Tele, connecting to TV RC Socket [5/8/2021 18:18:47] [LgWebOsTv] Device: XX Tele, RC Socket connected. [5/8/2021 18:18:52] [LgWebOsTv] Device: XX Tele, requesting Device Info. [5/8/2021 18:18:52] [LgWebOsTv] Device: XX Tele, get System info response: { returnValue: true, features: [Object], receiverType: 'dvb', modelName: '49UH850V-ZA' }
Same error but....different result.
If I enable arm_64 fails again.
Well… and what we can do then? :D
Not related to the plugin itself
After a lot of experiments i realised this plugin crashing latest homebridge server just few second after launching. Disabling this plugin will stop infinite service restart and HB service working properly.
I also realised, that similar plugin (https://github.com/merdok/homebridge-webos-tv#readme) running into same behaviour. So im not really sure where is the problem, maybe in some common dependency.