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

UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION] [ERR_ASSERTION] #41

Closed msbc42 closed 3 years ago

msbc42 commented 3 years ago

Describe your issue HomeBridge logs show this at startup: (node:4520) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: Accessories must be created with a non-empty displayName. at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1092:25) at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/lib/platformAccessory.js:25:15) at VieramaticPlatform.deviceSetup (/homebridge/node_modules/homebridge-vieramatic/dist/platform.js:73:27) at processTicksAndRejections (internal/process/task_queues.js:97:5) at /homebridge/node_modules/homebridge-vieramatic/dist/platform.js:37:13

Issue Context Homebridge: 1.2.3 Node.js: 12.19.0 Npm: 6.14.8

Running on Docker.

Plug-in was working fine prior to Homebridge-UI update: homebridge-config-ui-x v4.32.0

AntonioMeireles commented 3 years ago

@msbc42

thanks for reporting. FWIW, so far i was unable to reproduce your issue. Anyway, i 've just pushed a new plugin version with updated dependencies - can you check if the issue persists with it ?

Thanks for your patience!

msbc42 commented 3 years ago

Hi,

Installed the update but still getting same error on re-start.

(node:20381) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1092:25)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/lib/platformAccessory.js:25:15)
    at VieramaticPlatform.deviceSetup (/homebridge/node_modules/homebridge-vieramatic/dist/platform.js:73:27)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at /homebridge/node_modules/homebridge-vieramatic/dist/platform.js:37:13

(node:20381) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:20381) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
AntonioMeireles commented 3 years ago

@msbc42

could you plz post the full homebridge startup log, the contents of accessories/vieramatic.json (inside the homebridge config dir), and the homebridge config ?

Thanks in advance!

msbc42 commented 3 years ago

Files as requested. I have changed some id's with ## or deleted them for privacy. pano.zip

AntonioMeireles commented 3 years ago

thnks!

OK. the error is popping because somehow plugin is passing to homebridge a TV with no name. That could have been it as i 'm not checking length of TV name returned from the TV (i will in a bit) but actually (and according to vieramatic.json contents your TV has a name - 65FZ950_Series which seems to be properly fetched, so i'm so far missing the root cause.

so, some more questions... a) the timestamp of vieramatic.json is recent ? (i.e. was updated before the crash) or is older (before issue started ?) b) could you try to revert homebridge to 1.1.6 (from 1.2.3 which was pulled off upstream) and see if issue persists ?.
c) if you uninstall homebridge-config-ui-x issue goes away (if issue also in homebridge 1.1.6) ? (would be way weird but you said initially that issue started with an homebridge-config-ui-x) ?

Thanks in advance and a great weekend!

AntonioMeireles commented 3 years ago

upgrade and test please the just published homebridge-vieramatic@2.0.9. may not be enough to solve this but should help.

thanks for your patience!

msbc42 commented 3 years ago

Updated to 2.0.9 but seems to be the same error messages:

[11/15/2020, 9:25:50 AM] [HB Supervisor] Restarting Homebridge...
[11/15/2020, 9:25:50 AM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[11/15/2020, 9:25:50 AM] [HB Supervisor] Started Homebridge v1.2.3 with PID: 39189
[11/15/2020, 9:25:50 AM] Loaded config.json with 1 accessories and 4 platforms.
[11/15/2020, 9:25:50 AM] ---
[11/15/2020, 9:25:50 AM] Loaded plugin: homebridge-broadlink-rm-enhanced@3.6.21
[11/15/2020, 9:25:50 AM] Registering platform 'homebridge-broadlink-rm-enhanced.BroadlinkRM-Enhanced'
[11/15/2020, 9:25:50 AM] ---
[11/15/2020, 9:25:50 AM] Loaded plugin: homebridge-dummy@0.4.1
[11/15/2020, 9:25:50 AM] Registering accessory 'homebridge-dummy.DummySwitch'
[11/15/2020, 9:25:50 AM] ---
[11/15/2020, 9:25:50 AM] Loaded plugin: homebridge-nest@4.4.15
[11/15/2020, 9:25:50 AM] Registering platform 'homebridge-nest.Nest'
[11/15/2020, 9:25:50 AM] ---
[11/15/2020, 9:25:50 AM] Loaded plugin: homebridge-pihole@0.3.1
[11/15/2020, 9:25:50 AM] Registering accessory 'homebridge-pihole.Pihole'
[11/15/2020, 9:25:50 AM] ---
[11/15/2020, 9:25:50 AM] Loaded plugin: homebridge-vieramatic@2.0.9
[11/15/2020, 9:25:50 AM] Registering platform 'homebridge-vieramatic.PanasonicVieraTV'
[11/15/2020, 9:25:50 AM] ---
[11/15/2020, 9:25:51 AM] Loaded plugin: homebridge-config-ui-x@4.32.0
[11/15/2020, 9:25:51 AM] Registering platform 'homebridge-config-ui-x.config'
[11/15/2020, 9:25:51 AM] ---
[11/15/2020, 9:25:51 AM] Loading 4 platforms...
[11/15/2020, 9:25:51 AM] [Config] Initializing config platform...
[11/15/2020, 9:25:51 AM] [Config] Running in Service Mode
[11/15/2020, 9:25:51 AM] [PanasonicVieraTV] Initializing PanasonicVieraTV platform...
[11/15/2020, 9:25:51 AM] [Nest] Initializing Nest platform...
[11/15/2020, 9:25:51 AM] [BroadlinkRM-Enhanced] Initializing BroadlinkRM-Enhanced platform...
[11/15/2020, 9:25:51 AM] [BroadlinkRM-Enhanced] [INFO] Automatic Broadlink RM device discovery has been disabled as the "hosts" option has been set.
[11/15/2020, 9:25:51 AM] Loading 1 accessories...
[11/15/2020, 9:25:51 AM] [Pihole] Initializing Pihole accessory...
[11/15/2020, 9:25:51 AM] [PanasonicVieraTV] handling 192.168.##.## from config.json
[11/15/2020, 9:25:51 AM] [Nest] Fetching Nest devices.
[11/15/2020, 9:25:51 AM] [BroadlinkRM-Enhanced] No accessories have been added to the "BroadlinkRM-Enhanced" platform config.
[11/15/2020, 9:25:51 AM] Initializing platform accessory 'Learn'...
[11/15/2020, 9:25:51 AM] Initializing platform accessory 'Scan Frequency'...
Setup Payload:
X-HM://0023ISYWY1C9H
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ ###-##-### │     
    └────────────┘     

[11/15/2020, 9:25:51 AM] Homebridge v1.2.3 is running on port 51127.
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] 
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] **************************************************************************************************************
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** Welcome to version 3.6.21 of the Homebridge Broadlink RM Plugin!
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** 
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** Find out what's in the latest release here: https://github.com/lprhodes/homebridge-broadlink-rm/releases
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** 
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** If you like this plugin then please star it on GitHub or better yet
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** buy me a drink using Paypal https://paypal.me/lprhodes or crypto https://goo.gl/bEn1RW.
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** 
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** Keep up to date with this plugin along with everything HomeKit and homebridge
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** by signing up to my newsletter at http://workswith.io
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] **
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] ** You can disable this message by adding "hideWelcomeMessage": true to the config (see config-sample.json).
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] **
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] **************************************************************************************************************
[11/15/2020, 9:25:52 AM] [BroadlinkRM-Enhanced] 
(node:39189) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1092:25)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/lib/platformAccessory.js:25:15)
    at VieramaticPlatform.deviceSetup (/homebridge/node_modules/homebridge-vieramatic/dist/platform.js:73:27)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at /homebridge/node_modules/homebridge-vieramatic/dist/platform.js:37:13

(node:39189) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:39189) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[11/15/2020, 9:25:58 AM] [Nest] initing thermostat "Hallway Thermostat": deviceId: 09AC01AC14190181 structureId: 9ff721f0-c497-11e9-ae4d-0ae8baa9cb2a
[11/15/2020, 9:25:58 AM] [Nest] initing home_away_sensor "Home Occupied": deviceId: ####21f0-c497-11e9-####-0ae8baa9cb2a structureId: 9ff721f0-c497-11e9-ae4d-0ae8baa9cb2a
[11/15/2020, 9:26:00 AM] [BroadlinkRM-Enhanced] Learn getSwitchState: undefined
[11/15/2020, 9:26:00 AM] [BroadlinkRM-Enhanced] Scan Frequency getSwitchState: undefined
[11/15/2020, 9:26:03 AM] [BroadlinkRM-Enhanced] Learn getSwitchState: undefined
[11/15/2020, 9:26:03 AM] [BroadlinkRM-Enhanced] Scan Frequency getSwitchState: undefined
AntonioMeireles commented 3 years ago

thanks for the quick update! please get me the data bellow, so that i'd try to spot what's going on ...

a) the timestamp of vieramatic.json is recent ? (i.e. was updated before the crash) or is older (before issue started ?) b) could you try to revert homebridge to 1.1.6 (from 1.2.3 which was pulled off upstream) and see if issue persists ?. c) if you uninstall homebridge-config-ui-x issue goes away (if issue also in homebridge 1.1.6) ? (would be way weird but you said initially that issue started with an homebridge-config-ui-x) ?

Thanks in advance and a great weekend!

AntonioMeireles commented 3 years ago

@msbc42 a quick test ... edit /homebridge/node_modules/homebridge-vieramatic/dist/platform.js and just before line 73 insert this (in a new line) console.log("DEBUG!:", tv.specs); so that end result is ...

image

restart homebridge and past here the homebridge log please. (will fail but should give us a bit more context)

msbc42 commented 3 years ago

Strange - I added the change exactly as you described and the output is: DEBUG!: {}

AntonioMeireles commented 3 years ago

hummm... that at least explains why my patch from earlier today didn't work. get me plz the data requested above, and tomorrow i'll try to get this sorted or at minimum understood!

thanks again!

msbc42 commented 3 years ago

a) timestamp is 5 Nov - same time as issue started. b) I'm not able to revert it at this time due to other work. c) what's the consequence of uninstalling that plug-in? How would I then manage the system to get it re-installed?

AntonioMeireles commented 3 years ago

@msbc42

Hi again,

test please homebridge-vieramatic@2.0.10, just published. Either will work, or give us a better error :-) .

thanks again for your patience

msbc42 commented 3 years ago

Hi, updated - results are:

getSpecs: Error: timeout of 3500ms exceeded
    at createError (/homebridge/node_modules/homebridge-vieramatic/node_modules/axios/lib/core/createError.js:16:15)
    at RedirectableRequest.handleRequestTimeout (/homebridge/node_modules/homebridge-vieramatic/node_modules/axios/lib/adapters/http.js:264:16)
    at Object.onceWrapper (events.js:420:28)
    at RedirectableRequest.emit (events.js:314:20)
    at Timeout._onTimeout (/homebridge/node_modules/homebridge-vieramatic/node_modules/follow-redirects/index.js:166:13)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
 {
  config: {
    url: 'http://192.168.##.##:55000/nrc/ddd.xml',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.21.0'
    },
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 3500,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    data: undefined
  },
  code: 'ECONNABORTED',
  request: Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      bufferedRequest: null,
      lastBufferedRequest: null,
      pendingcb: 0,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: false,
      bufferedRequestCount: 0,
      corkedRequestsFree: [Object]
    },
    writable: true,
    _events: [Object: null prototype] { response: [Array], error: [Array] },
    _eventsCount: 2,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'http:',
      path: '/nrc/ddd.xml',
      method: 'GET',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: '192.168.##.##',
      port: '55000',
      nativeProtocols: [Object],
      pathname: '/nrc/ddd.xml'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 0,
    _requestBodyBuffers: [],
    _onNativeResponse: [Function],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [Socket],
      connection: [Socket],
      _header: 'GET /nrc/ddd.xml HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/0.21.0\r\n' +
        'Host: 192.168.##.##:55000\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      insecureHTTPParser: undefined,
      path: '/nrc/ddd.xml',
      _ended: false,
      res: null,
      aborted: true,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: [HTTPParser],
      maxHeadersCount: null,
      reusedSocket: false,
      host: '192.168.##.##',
      protocol: 'http:',
      _redirectable: [Circular],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    _currentUrl: 'http://192.168.##.##:55000/nrc/ddd.xml',
    _timeout: Timeout {
      _idleTimeout: 3500,
      _idlePrev: null,
      _idleNext: null,
      _idleStart: 542,
      _onTimeout: [Function],
      _timerArgs: undefined,
      _repeat: null,
      _destroyed: true,
      [Symbol(refed)]: true,
      [Symbol(kHasPrimitive)]: false,
      [Symbol(asyncId)]: 55,
      [Symbol(triggerId)]: 51
    },
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}
[11/16/2020, 8:55:16 AM] [PanasonicVieraTV] IGNORING '192.168.##.##' as an unexpected error occurred - was unable to fetch specs from the TV.

I see the same output with the TV on and off at Homebridge restart.

AntonioMeireles commented 3 years ago

could you paste plz the full output of time curl -Lvvv http://_tv-ip_:55000/nrc/ddd.xml

also, is tv connected to network wired or wirelessly? for the sake of it could you unplug it from power , replug and verify if issue persists? (and if connected wirelessly could you check if via wired the issue also happens?)

thxs!

msbc42 commented 3 years ago
*   Trying 192.168.##.##:55000...
* TCP_NODELAY set
* Connected to 192.168.##.## (192.168.##.##) port 55000 (#0)
> GET /nrc/ddd.xml HTTP/1.1
> Host: 192.168.##.##:55000
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

real    1m46.455s
user    0m0.010s
sys 0m0.015s
AntonioMeireles commented 3 years ago

is the tv pingable ? reachable ? this is odd. check plz that the tv hasn't changed ip address...

msbc42 commented 3 years ago

Its wired connection. Power cycled and it's working again!

[11/16/2020, 9:22:23 AM] Homebridge v1.2.3 is running on port 51127.
found a 'Panasonic VIErA' TV (TH-65FZ950U) at '192.168.##.##' (requires crypto for comunication).

[11/16/2020, 9:22:23 AM] [PanasonicVieraTV] successfully loaded 65FZ950_Series
[11/16/2020, 9:22:23 AM] 65FZ950_Series 9286 is running on port 46323.
[11/16/2020, 9:22:23 AM] Please add [65FZ950_Series 9286] manually in Home app. Setup Code: #######

The Power and Volume accessories are working. But I do see this message a few times: [11/16/2020, 9:24:35 AM] [PanasonicVieraTV] (getVolume) unable to get volume from TV...

AntonioMeireles commented 3 years ago

@msbc42

so, unrelated to this plugin at all :-) glad that things work for you again.

btw, assuming that volume handling works (both via the accessory and via the remote) those messages are innocuous.

Closing.

Thanks once again for your patience!

feel free to fill new issues if issues arise :-)