g30r93g / homebridge-panasonic

A Homebridge plugin for Panasonic Viera TV's. Written to support the new Homekit TV accessory.
MIT License
21 stars 3 forks source link

TypeError: properties.filter is not a function #37

Closed ValoV83 closed 4 years ago

ValoV83 commented 4 years ago

I'm getting this error using the plugin with my TV. It causes my Homebridge to crash and I have to manually login to HOOBS to restart the Homebridge service.

[Homebridge] [4/28/2020, 8:40:21 AM] [TX-42AS650B] Powering TV on... [Homebridge] [4/28/2020, 8:40:21 AM] TypeError: properties.filter is not a function at Subscription.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-panasonic-viera-tv/index.js:255:45) at Subscription.emit (events.js:310:20) at /home/hoobs/.hoobs/node_modules/node-upnp-subscription/index.js:37:37 at Parser.<anonymous> (/home/hoobs/.hoobs/node_modules/xml2js/lib/parser.js:304:18) at Parser.emit (events.js:310:20) at SAXParser.onclosetag (/home/hoobs/.hoobs/node_modules/xml2js/lib/parser.js:262:26) at emit (/home/hoobs/.hoobs/node_modules/sax/lib/sax.js:624:35) at emitNode (/home/hoobs/.hoobs/node_modules/sax/lib/sax.js:629:5) at closeTag (/home/hoobs/.hoobs/node_modules/sax/lib/sax.js:889:7) at SAXParser.write (/home/hoobs/.hoobs/node_modules/sax/lib/sax.js:1436:13)

System info: HOOBS Version: 3.1.27 Homebridge Version: 0.4.53

I can operate the TV using the Panasonic TV Remote 2 app

g30r93g commented 4 years ago

It seems like it can't use the filter function on the response. Strange but I'll have a look why.

g30r93g commented 4 years ago

Probably won't make a difference, but just for the sake of trying, can you update your Node version?

ValoV83 commented 4 years ago

Thanks for the reply. I’m already using (I think) the most current version of Node 12.16.2

g30r93g commented 4 years ago

yea so i’m getting it on occasion too. not too sure why just yet but i’ll have something soon :)

ValoV83 commented 4 years ago

Thanks for looking in to it. Glad you where able to replicate the issue and it’s not a config issue with my setup.

Look forward to a fix shortly. Keep up the great work, your plugin is great! 👍

g30r93g commented 4 years ago

Please update to v7.1.0 and tell me if the issue persists. From what I could tell, viera.js was trying to log an error message and wasn't returning an array to perform filter on. Hopefully it's either showing something new in the log or its fixed :)

ValoV83 commented 4 years ago

Thats great! Thanks for finding the fault. I've been avoiding using HOOBS to control my TV as it was crashing homebridge every time.

Look forward to the update and testing the quick fix.

g30r93g commented 4 years ago

Latest update is now available via npm :)

ValoV83 commented 4 years ago

Updated the plugin but now getting an error on Homebridge startup:

10/05/2020, 13:03:25 + homebridge-panasonic-viera-tv@7.1.1 added 9 packages from 53 contributors in 6.649s 10/05/2020, 13:03:25 14 packages are looking for funding run npm fund for details 10/05/2020, 13:03:26 Unexpected identifier 10/05/2020, 13:03:26 Unable to determine plugin type for "homebridge-panasonic-viera-tv" 10/05/2020, 13:03:26 Plugin "homebridge-panasonic-viera-tv" installed. 10/05/2020, 13:03:26 Unexpected identifier 10/05/2020, 13:03:26 Unable to determine plugin type for "homebridge-panasonic-viera-tv" 10/05/2020, 13:03:27 Got SIGINT, shutting down Bridge... 10/05/2020, 13:03:27 Unexpected identifier 10/05/2020, 13:03:27 Unable to determine plugin type for "homebridge-panasonic-viera-tv" 10/05/2020, 13:03:29 Loaded plugin "homebridge-nest". 10/05/2020, 13:03:29 Error loading plugin "homebridge-panasonic-viera-tv". 10/05/2020, 13:03:29 /home/hoobs/.hoobs/node_modules/homebridge-panasonic-viera-tv/index.js:257 if not properties.isArray() { ^^^

SyntaxError: Unexpected identifier at wrapSafe (internal/modules/cjs/loader.js:1070:16) at Module._compile (internal/modules/cjs/loader.js:1120:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1042:19) at require (internal/modules/cjs/helpers.js:77:18) at Plugin.load (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/plugin.js:44:35) at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:152:24 at Array.forEach ()

g30r93g commented 4 years ago

Figured it out. Weird javascript behaviours that I didn't understand. Update to v7.2.0 and fingers crossed 🤞

ValoV83 commented 4 years ago

That looks like it's sorted it! No errors in the logs and the TV is switching on/off within the Apple Home app without crashing Homebridge every few minutes.

Thanks very much 👍

Thanks for developing the plugin, keep up the great work.

g30r93g commented 4 years ago

Thanks for letting me know. Will try to keep at it for as long as I can :)