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.find is not a function #22

Closed momsse closed 4 years ago

momsse commented 5 years ago

Hi @g30r93g, thanks for the great job !

Just encountered an issue that unfortunately cause to stop my entire Homebridge process. This happened randomly during a TV stop command. Seems to be a race condition given the two fire off on the log but not sure.

Here the logs:

[8/22/2019, 10:46:46 PM] [TV Salon] TV is off
[8/22/2019, 10:46:47 PM] [TV Salon] TV is off
[8/22/2019, 10:46:47 PM] [TV Salon] Powering TV off...
[8/22/2019, 10:46:47 PM] TypeError: properties.find is not a function
    at Subscription.powerStateSubscription.on (/usr/lib/node_modules/homebridge-panasonic-viera-tv/index.js:237:38)
    at Subscription.emit (events.js:198:13)
    at xmlResponseParser (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/node-upnp-subscription/index.js:37:37)
    at Parser.<anonymous> (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:303:18)
    at Parser.emit (events.js:198:13)
    at SAXParser.onclosetag (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:261:26)
    at emit (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:624:35)
    at emitNode (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:629:5)
    at closeTag (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:889:7)
    at SAXParser.write (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:1436:13)
    at Parser.exports.Parser.Parser.parseString (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:322:31)
    at Parser.parseString (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:5:59)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/parsexmlresponse/index.js:15:23)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Edit:

Occurred again just after a Netflix opening:

[8/22/2019, 10:55:32 PM] [TV Salon] Powering TV on...
[8/22/2019, 10:55:35 PM] [TV Salon] Opening Netflix app
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
[8/22/2019, 10:46:47 PM] TypeError: properties.find is not a function
    at Subscription.powerStateSubscription.on (/usr/lib/node_modules/homebridge-panasonic-viera-tv/index.js:237:38)
    at Subscription.emit (events.js:198:13)
    at xmlResponseParser (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/node-upnp-subscription/index.js:37:37)
    at Parser.<anonymous> (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:303:18)
    at Parser.emit (events.js:198:13)
    at SAXParser.onclosetag (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:261:26)
    at emit (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:624:35)
    at emitNode (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:629:5)
    at closeTag (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:889:7)
    at SAXParser.write (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/sax/lib/sax.js:1436:13)
    at Parser.exports.Parser.Parser.parseString (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:322:31)
    at Parser.parseString (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/xml2js/lib/parser.js:5:59)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/homebridge-panasonic-viera-tv/node_modules/parsexmlresponse/index.js:15:23)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
g30r93g commented 5 years ago

Hi! Thanks for bringing this to my attention. Can you confirm that you can turn the TV on and off through the Home app?

g30r93g commented 5 years ago

Every time an action is performed, HomeKit first determines the power state of the TV before performing your action. If it cannot determine the power state, it will not perform what you want to. A reason this may be happening is if the TV doesn't support power on from standby.

momsse commented 5 years ago

Hi! Thanks for bringing this to my attention. Can you confirm that you can turn the TV on and off through the Home app?

Hi and thanks for the support! Yes the on/off feature work great otherwise. I will try to add more logs juste before and after those lines to give your more information about what is happening.

g30r93g commented 5 years ago

@momsse Has this issue been fixed?

Dreiviertelblut commented 5 years ago

Hi,

no, the issue definitely still exists. I have installed the plugin (V6.1.2) a couple of days ago and since then my homebridge has crashed most of the time, when performing switching action with this plugin via Homekit. Moreover, the described issue from above is obviously also related to issue#19. The same error log in the homebridge log file. I've set up an automation in homekit that switches the TV off at a certain time or when last person leaves the house. As described in issue #19, the plugin switches the TV ON after receiving OFF command, when the TV is already off + crashes homebridge. Manual On/Off seems to work more reliable, but alos not to 100%. The plugin is unfortunately not running stable and reliable! Really a pity.

momsse commented 4 years ago

@g30r93g same as @Dreiviertelblut for now I only use it for the on/off information. Didn't manage to find time to add some logs sorry

tegola commented 4 years ago

I'll add my log to the list:

[Homebridge] [2/13/2020, 19:11:04] [TV] TV is on.
[Homebridge] [2/13/2020, 19:11:05] [TV] Powering TV off...
[Homebridge] [2/13/2020, 19:11:05] TypeError: properties.find is not a function
    at Subscription.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-panasonic-viera-tv/index.js:288:38)
    at Subscription.emit (events.js:223:5)
    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:223:5)
    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)
[Homebridge] [2/13/2020, 19:11:05] Got SIGTERM, shutting down service...
g30r93g commented 4 years ago

Closing and combining issue with #37 Hopefully updating to homebridge v1.0.0 and plugin v7.0.0 will fix if you're still experiencing this issue. Please continue discussion in #37