AntonioMeireles / homebridge-vieramatic

Homebridge plugin for Panasonic™ Viera™ TVs (includes support for 2018 and later models)
Apache License 2.0
43 stars 9 forks source link

Restart while TV unreachable crashes homebridge #66

Closed pinsonlawrimore closed 3 years ago

pinsonlawrimore commented 3 years ago

When homebridge restarts, and the TV is powered off (so the TV is unreachable), then it crashes homebridge and it it will crash/restart loop over and over until the TV is powered back on. It's an older model, so I understand why the TV becomes unreachable. That's not the issue.

If the plugin has a TV in it's config, but unreachable, I don't think it should cause a crash, it should just skip loading it and move on.

Running dietpi on a Hyper-V VM. Homebridge 1.2.5 Node.js 14.15.1 NPM 6.14.8

vieramatic.json:

{"4D454930-0200-1000-8001-8CC121607B93":{"data":{"inputs":{"hdmi":[{"id":"1","name":"Apple TV","hidden":0}],"applications":{"0":{"name":"Netflix","id":"0010000200000001","hidden":1},"1":{"name":"YouTube","id":"0070000200000001","hidden":1},"2":{"name":"VIERA Link","id":"0387878700000016","hidden":1},"3":{"name":"TV","id":"0387878700000001","hidden":1},"4":{"name":"Menu","id":"0387878700000009","hidden":1},"5":{"name":"Web Browser","id":"0077777700000002","hidden":1},"6":{"name":"Paint","id":"0387878700000026","hidden":1},"7":{"name":"Put Three","id":"0387878700000036","hidden":1},"8":{"name":"Family Reversi","id":"0387878700000037","hidden":1},"9":{"name":"Touch Connect","id":"0387878700000038","hidden":1},"10":{"name":"Mirroring","id":"0387878700000049","hidden":1},"11":{"name":"Media player","id":"0387878700000032","hidden":1},"12":{"name":"DLNA server","id":"0387878700000014","hidden":1},"13":{"name":"HSN Shop by Remote","id":"0010002000000001","hidden":1},"14":{"name":"CinemaNow","id":"0010000300000001","hidden":1},"15":{"name":"PlayJam","id":"0070001000000001","hidden":1},"16":{"name":"Xumo","id":"0310005700000001","hidden":1},"17":{"name":"VUDU HD Movies","id":"0010001300000001","hidden":1},"18":{"name":"AccuWeather.com","id":"0070000C00000001","hidden":1},"19":{"name":"Jotter","id":"0387878700000022","hidden":1},"20":{"name":"TuneIn","id":"0010001800000001","hidden":1}},"TUNER":{"hidden":1}},"specs":{"friendlyName":"Living Room TV","manufacturer":"Panasonic","modelName":"Panasonic VIErA","modelNumber":"VT60","requiresEncryption":false,"serialNumber":"4D454930-0200-1000-8001-8CC121607B93"},"ipAddress":"192.168.77.181"}}}

Config contents:

{
    "tvs": [
        {
            "friendlyName": "Living Room TV",
            "ipAddress": "192.168.77.181",
            "hdmiInputs": [
                {
                    "id": "1",
                    "name": "Apple TV"
                }
            ],
            "disabledAppSupport": false,
            "customVolumeSlider": false
        }
    ],
    "platform": "PanasonicVieraTV"
}

Log section from it tries to start but the TV is offline:

[2/8/2021, 11:03:14 AM] Homebridge v1.2.5 is running on port 53526.
[2/8/2021, 11:03:16 AM] [Homebridge UI] Homebridge Config UI X v4.37.0 is listening on 0.0.0.0 port 8581
[2/8/2021, 11:03:17 AM] [PanasonicVieraTV] WARNING: unable to fetch specs from TV at '192.168.77.181'
AssertionError [ERR_ASSERTION]: Accessories must be created with a valid UUID.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:236:11)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:70:9)
    at VieramaticPlatform.deviceSetup (/usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:176:23)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at /usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:62:23 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
AssertionError [ERR_ASSERTION]: Accessories must be created with a valid UUID.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:236:11)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:70:9)
    at VieramaticPlatform.deviceSetup (/usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:176:23)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at /usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:62:23 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
[2/8/2021, 11:03:17 AM] Got SIGTERM, shutting down Homebridge...
[2/8/2021, 11:03:17 AM] [Apple TV Platform] Shutting down Apple TV clients...
homebridge.service: Main process exited, code=exited, status=143/n/a
homebridge.service: Failed with result 'exit-code'.
homebridge.service: Service RestartSec=10s expired, scheduling restart.
homebridge.service: Scheduled restart job, restart counter is at 395.
Stopped Node.js HomeKit Server.
AntonioMeireles commented 3 years ago

@ris2

hi, thanks for reporting. a quick question - what exact (vieramatic) plugin version are you running ?

pinsonlawrimore commented 3 years ago

Hi. From the plugins page (which is also how I got to the github page):

Panasonic™ Viera™ TVs support homebridge-vieramatic v2.0.20

[2/8/2021, 11:18:53 AM] Loaded plugin: homebridge-vieramatic@2.0.20
[2/8/2021, 11:18:53 AM] Registering platform 'homebridge-vieramatic.PanasonicVieraTV'
AntonioMeireles commented 3 years ago

ok. thanks for your fast reply. digging. hoping to have some answers soon.

thanks again for your patience!

AntonioMeireles commented 3 years ago

@ris2

hi, could you please install homebridge-vieramatic@2.0.21-beta.1that i've just published ? (npm install homebridge-vieramatic@2.0.21-beta.1) and then attach here again the homebridge startup logs/error ?

they should now be a bit more helpful, hopefully.

thanks in advance!

pinsonlawrimore commented 3 years ago

Log file with TV turned on:

Started Node.js HomeKit Server.
[2/8/2021, 2:37:26 PM] Loaded config.json with 0 accessories and 4 platforms.
[2/8/2021, 2:37:27 PM] ---
[2/8/2021, 2:37:27 PM] Loaded plugin: homebridge-apple-tv-remote@0.12.1
[2/8/2021, 2:37:27 PM] Registering platform 'homebridge-apple-tv-remote.AppleTvPlatform'
[2/8/2021, 2:37:27 PM] ---
[2/8/2021, 2:37:27 PM] Loaded plugin: homebridge-config-ui-x@4.38.0
[2/8/2021, 2:37:27 PM] Registering platform 'homebridge-config-ui-x.config'
[2/8/2021, 2:37:27 PM] ---
[2/8/2021, 2:37:27 PM] Loaded plugin: homebridge-mylink@1.3.0
[2/8/2021, 2:37:27 PM] Registering platform 'homebridge-mylink.Somfy myLink'
[2/8/2021, 2:37:27 PM] ---
[2/8/2021, 2:37:27 PM] Loaded plugin: homebridge-vieramatic@2.0.21-beta.1
[2/8/2021, 2:37:27 PM] Registering platform 'homebridge-vieramatic.PanasonicVieraTV'
[2/8/2021, 2:37:27 PM] ---
[2/8/2021, 2:37:27 PM] Loading 4 platforms...
[2/8/2021, 2:37:27 PM] [Config] Initializing config platform...
[2/8/2021, 2:37:27 PM] [Config] Spawning homebridge-config-ui-x with PID 1758
[2/8/2021, 2:37:27 PM] [Shades] Initializing Somfy myLink platform...
[2/8/2021, 2:37:27 PM] Initializing platform accessory 'Somfy Master Bedroom'...
[2/8/2021, 2:37:27 PM] Initializing platform accessory 'Somfy Gym'...
[2/8/2021, 2:37:27 PM] Initializing platform accessory 'Somfy Guest Bedroom'...
[2/8/2021, 2:37:27 PM] Initializing platform accessory 'Somfy Kitchen'...
[2/8/2021, 2:37:27 PM] Initializing platform accessory 'Somfy Study'...
[2/8/2021, 2:37:27 PM] [Apple TV Platform] Initializing AppleTvPlatform platform...
[2/8/2021, 2:37:27 PM] [PanasonicVieraTV] Initializing PanasonicVieraTV platform...
[2/8/2021, 2:37:27 PM] [Apple TV Platform] Initialing platform...
[2/8/2021, 2:37:27 PM] [Apple TV Platform] [API] Initializing...
[2/8/2021, 2:37:27 PM] [PanasonicVieraTV] launching encryption helper endpoint on :8973
[2/8/2021, 2:37:27 PM] [PanasonicVieraTV] handling '192.168.77.181' from config.json
[2/8/2021, 2:37:27 PM] [Apple TV Platform] [API] Started
Setup Payload:
X-HM://002474XTTL92C
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
[[removed]]
[2/8/2021, 2:37:28 PM] Homebridge v1.2.5 is running on port 53526.
[2/8/2021, 2:37:28 PM] [PanasonicVieraTV] found a 'Panasonic VIErA' TV (VT60) at '192.168.77.181' .
[2/8/2021, 2:37:28 PM] [PanasonicVieraTV] successfully loaded Living Room TV
[2/8/2021, 2:37:28 PM] Living Room TV F982 is running on port 44141.
[2/8/2021, 2:37:28 PM] Please add [Living Room TV F982] manually in Home app. Setup Code: 440-14-401
[2/8/2021, 2:37:30 PM] [Homebridge UI] Homebridge Config UI X v4.38.0 is listening on 0.0.0.0 port 8581

Log file with TV turned off:

Started Node.js HomeKit Server.
[2/8/2021, 2:41:47 PM] Loaded config.json with 0 accessories and 4 platforms.
[2/8/2021, 2:41:47 PM] ---
[2/8/2021, 2:41:47 PM] Loaded plugin: homebridge-apple-tv-remote@0.12.1
[2/8/2021, 2:41:47 PM] Registering platform 'homebridge-apple-tv-remote.AppleTvPlatform'
[2/8/2021, 2:41:47 PM] ---
[2/8/2021, 2:41:47 PM] Loaded plugin: homebridge-config-ui-x@4.38.0
[2/8/2021, 2:41:47 PM] Registering platform 'homebridge-config-ui-x.config'
[2/8/2021, 2:41:47 PM] ---
[2/8/2021, 2:41:47 PM] Loaded plugin: homebridge-mylink@1.3.0
[2/8/2021, 2:41:47 PM] Registering platform 'homebridge-mylink.Somfy myLink'
[2/8/2021, 2:41:47 PM] ---
[2/8/2021, 2:41:48 PM] Loaded plugin: homebridge-vieramatic@2.0.21-beta.1
[2/8/2021, 2:41:48 PM] Registering platform 'homebridge-vieramatic.PanasonicVieraTV'
[2/8/2021, 2:41:48 PM] ---
[2/8/2021, 2:41:48 PM] Loading 4 platforms...
[2/8/2021, 2:41:48 PM] [Config] Initializing config platform...
[2/8/2021, 2:41:48 PM] [Config] Spawning homebridge-config-ui-x with PID 1938
[2/8/2021, 2:41:48 PM] [Shades] Initializing Somfy myLink platform...
[2/8/2021, 2:41:48 PM] Initializing platform accessory 'Somfy Master Bedroom'...
[2/8/2021, 2:41:48 PM] Initializing platform accessory 'Somfy Gym'...
[2/8/2021, 2:41:48 PM] Initializing platform accessory 'Somfy Guest Bedroom'...
[2/8/2021, 2:41:48 PM] Initializing platform accessory 'Somfy Kitchen'...
[2/8/2021, 2:41:48 PM] Initializing platform accessory 'Somfy Study'...
[2/8/2021, 2:41:48 PM] [Apple TV Platform] Initializing AppleTvPlatform platform...
[2/8/2021, 2:41:48 PM] [PanasonicVieraTV] Initializing PanasonicVieraTV platform...
[2/8/2021, 2:41:48 PM] [Apple TV Platform] Initialing platform...
[2/8/2021, 2:41:48 PM] [Apple TV Platform] [API] Initializing...
[2/8/2021, 2:41:48 PM] [PanasonicVieraTV] launching encryption helper endpoint on :8973
[2/8/2021, 2:41:48 PM] [PanasonicVieraTV] handling '192.168.77.181' from config.json
[2/8/2021, 2:41:48 PM] [Apple TV Platform] [API] Started
Setup Payload:
X-HM://002474XTTL92C
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
[[removed]]
[2/8/2021, 2:41:48 PM] Homebridge v1.2.5 is running on port 53526.
[2/8/2021, 2:41:50 PM] [Homebridge UI] Homebridge Config UI X v4.38.0 is listening on 0.0.0.0 port 8581
[2/8/2021, 2:41:51 PM] [PanasonicVieraTV] WARNING: unable to fetch specs from TV at '192.168.77.181'. Using the previously cached ones:
{
  friendlyName: 'Living Room TV',
  manufacturer: 'Panasonic',
  modelName: 'Panasonic VIErA',
  modelNumber: 'VT60',
  requiresEncryption: false,
  serialNumber: '4D454930-0200-1000-8001-8CC121607B93'
}
AssertionError [ERR_ASSERTION]: Accessories must be created with a valid UUID.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:236:11)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:70:9)
    at VieramaticPlatform.deviceSetup (/usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:179:23)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at /usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:63:23 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
AssertionError [ERR_ASSERTION]: Accessories must be created with a valid UUID.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:236:11)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:70:9)
    at VieramaticPlatform.deviceSetup (/usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:179:23)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at /usr/local/lib/node_modules/homebridge-vieramatic/src/platform.ts:63:23 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
[2/8/2021, 2:41:51 PM] Got SIGTERM, shutting down Homebridge...
[2/8/2021, 2:41:51 PM] [Apple TV Platform] Shutting down Apple TV clients...
AntonioMeireles commented 3 years ago

thy now plz homebridge-vieramatic@2.0.21-beta.2 and see if it fixes things ... if not logs again ...

Thanks once again for your patience!

pinsonlawrimore commented 3 years ago

That seems to fixed it. For completeness, here's what it does now when the TV is off. No crash, no loops.

THANKS!!


[2/8/2021, 3:16:51 PM] Homebridge v1.2.5 is running on port 53526.
[2/8/2021, 3:16:53 PM] [Homebridge UI] Homebridge Config UI X v4.38.0 is listening on 0.0.0.0 port 8581
[2/8/2021, 3:16:56 PM] [PanasonicVieraTV] WARNING: unable to fetch specs from TV at '192.168.77.181'. Using the previously cached ones:
{
  friendlyName: 'Living Room TV',
  manufacturer: 'Panasonic',
  modelName: 'Panasonic VIErA',
  modelNumber: 'VT60',
  requiresEncryption: false,
  serialNumber: '4D454930-0200-1000-8001-8CC121607B93'
}
[2/8/2021, 3:16:57 PM] [PanasonicVieraTV] successfully loaded Living Room TV
[2/8/2021, 3:16:57 PM] Living Room TV F982 is running on port 42831.```
AntonioMeireles commented 3 years ago

@ris2

Great && Many, many thanks!

just pushed homebridge-vieramatic@2.0.21 (so - non beta) with the fix for widespread consumption.

All the best!