gw-wiscon / homebridge-philipstv

Homebridge module for Philips TV (with JointSpace enabled)
15 stars 50 forks source link

module crash #8

Open stultitiophobia opened 7 years ago

stultitiophobia commented 7 years ago

[11/27/2016, 10:23:20 PM] [My Philips TV] getPowerState - actual mode
undefined:1

Not FoundNot Found

^

SyntaxError: Unexpected token < in JSON at position 0
at Object.parse (native)
at Object. (/usr/lib/node_modules/homebridge-philipstv/index.js:246:35)
at Request._callback (/usr/lib/node_modules/homebridge-philipstv/index.js:92:3)
at Request.self.callback (/usr/lib/node_modules/homebridge-philipstv/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (/usr/lib/node_modules/homebridge-philipstv/node_modules/request/request.js:1081:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (/usr/lib/node_modules/homebridge-philipstv/node_modules/request/request.js:1001:12)

Every time my tv is switched on, the module crashes. What might be the issue ?

cellardoor commented 7 years ago

i have the same issue... :(

newbeetle59 commented 7 years ago

Might be because your TV doesn't support jointspace, which is required for this plugin to work. If your TV is based on Android TV (smart TV) then it will not work.

stultitiophobia commented 7 years ago

Well it's smart tv based but jointspace is enabled... (by the remote code and it has been displayed on the screen that jointspace was enabled)

newbeetle59 commented 7 years ago

Ok, did you try to trigger some actions on your tv with jointspace (turning on/off ambilight for instance), using web browser (ip of your tv:1925) ?

cellardoor commented 7 years ago

well... my TV is a philips 55pus7600/12 based on android (smart) TV :( I tryed to enable Jointspace over 50 times... but it wont work... deep web research results that my 2015 model should have enabled Jointspace out of factory i thougt... the myremote ios app is working fine with the TV... Is there really no way that it works on my Android TV? :( a specific firmware maybe...? my result for (ip of your tv:1925) -> Not Found - The server has not found anything matching the request URI btw thanks for your support! :) update: i just figured out... its not the (philips) myremote ios app whats working with the 2015 TV model (i was confused on the ipad it works but not on iphone... and it looks different xD) the working app is called PhilipsTvRemote (from TP Vision)... with WoWLAN in the TV settings enabled, I can even turn on/off the TV out of the ios app :D
well... i will try the homebridge-sonybraviatv plugin (based on android TV too) next.... it maybe works :) And if my last option buying a harmony hub!!!! i will get it work as i want 2 xD

newbeetle59 commented 7 years ago

You're welcome. Unfortunately jointspace is not supported anymore, on your 2015 model Android API is taking over... I'm sorry I don't know if there is a solution available yet (I guess not).

stultitiophobia commented 7 years ago

Strange, my TVs both support jointspace - the page is displayed when accessing it. But somehow the whole homebridge seems to run not stable :-(

robi-van-kenobi commented 7 years ago

Hi @trendchiller , hi @newbeetle59 ,

if also had the problem.

Seems that the port :1925 is no longer supported, but :1926 is doing the job now.

I've looked around a little bit, and found this python script. https://github.com/suborb/philips_android_tv

I played a little bit around with curl, and could authenticate against the tv. But that was it. After that i always get access denied errors.

Here i found the hint, that 2016 models (or earlier) changed the API: https://www.domoticz.com/wiki/Philips_tv

Bankaifan commented 7 years ago

Is there an update? Cant use my 55PUS6581 with this plugin right?

skrollme commented 7 years ago

@Bankaifan what is the model-year of your TV? 2016? 2017? You can try my (still unmerged) pull-request here: https://github.com/gw-wiscon/homebridge-philipstv/pull/9

It adds compatibility for the 2016th models and their new API.

Bankaifan commented 7 years ago

It is a 2016 Model. I am not that fit, using GitHub. What do i have to do? Download that Script and exchange it on my homebridge?

Bankaifan commented 7 years ago

@skrollme Got it Working. But The module seems to stop working After switching TV on and Off several times

skrollme commented 7 years ago

@Bankaifan what do you mean exactly with "seems to stop working"? Any error messages? For me it works since I created the 2016-version. Unfortunatly I have only one TV to test with ;)

Bankaifan commented 7 years ago

Yepp: [2017-8-22 12:05:45] [TV] setPowerState - setting power state to on [2017-8-22 12:05:48] [TV] setPowerStateLoop - failed: ETIMEDOUT [2017-8-22 12:05:48] [TV] setPowerStateLoop - ERROR: Error: HTTP attempt failed

This happens when I have switched the TV off via the standard remote

skrollme commented 7 years ago

@Bankaifan Ah, you are talking about switching it on again. That is not supported by the TV's API. The creator of this homekit plugin did a workaround for this. Try to enable/configure the WakeOnLan functionality in this Plugin and your TV. As far as I know, that is the only way to remotly switch the TV on. Maybe there are other possibilities, but I did not investigate further so far.

Bankaifan commented 7 years ago

Switching off and on again using HomeKit works great. What is The difference when switching off using the TVs remote?

skrollme commented 7 years ago

Maybe the API-Call used by this plugin does not switch off completely and only does a hibernate or sleep, from which the TV can be woken up again via API. But I think that has nothing to do with the original Issue here, or am I wrong?

maciboy commented 7 years ago

I’ve the same issue with my 55POS901f… What do I have to do to test the fix from @skrollme? Some instructions would be great :)

skrollme commented 7 years ago

Do you mean this, @maciboy ?

at Bankaifan what is the model-year of your TV? 2016? 2017? You can try my (still unmerged) pull-request here: #9

It adds compatibility for the 2016th models and their new API.

walshy1009 commented 7 years ago

Just git cloned and replaced my directory for homebridge-philipstv with your modified files @skrollme

Any idea why I keep getting this error that stops homebridge from even booting up? Thanks in advance for the help!

WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister [1/10/2017, 5:15:36 PM] Loaded plugin: homebridge-philipstv [1/10/2017, 5:15:36 PM] Registering accessory 'homebridge-philipstv.PhilipsTV' [1/10/2017, 5:15:36 PM] --- [1/10/2017, 5:15:37 PM] Loaded plugin: homebridge-platform-wemo [1/10/2017, 5:15:37 PM] Registering platform 'homebridge-platform-wemo.BelkinWeMo' [1/10/2017, 5:15:37 PM] --- [1/10/2017, 5:15:37 PM] Loaded plugin: homebridge-wemo [1/10/2017, 5:15:37 PM] Registering accessory 'homebridge-wemo.WeMo' [1/10/2017, 5:15:37 PM] --- [1/10/2017, 5:15:37 PM] Loaded config.json with 1 accessories and 1 platforms. [1/10/2017, 5:15:37 PM] --- [1/10/2017, 5:15:37 PM] Loading 1 platforms... [1/10/2017, 5:15:37 PM] [Bed Lights] Initializing BelkinWeMo platform... [1/10/2017, 5:15:37 PM] Loading 1 accessories... [1/10/2017, 5:15:37 PM] [My Philips TV] Initializing PhilipsTV accessory... [1/10/2017, 5:15:37 PM] [My Philips TV] Model year: 2016 [1/10/2017, 5:15:37 PM] [My Philips TV] API version: 5 [1/10/2017, 5:15:37 PM] [My Philips TV] Setting info: {"serialnumber":"Unknown","model":"Unknown","manufacterer":"Philips","name":"not provided","softwareversion":"Unknown","manufacturer":"Philips"} Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

┌────────────┐     
│ 031-45-154 │     
└────────────┘     

[1/10/2017, 5:15:38 PM] Homebridge is running on port 51826. [1/10/2017, 5:15:38 PM] [My Philips TV] start polling.. [1/10/2017, 5:15:38 PM] [My Philips TV] getPowerState - actual mode [1/10/2017, 5:15:38 PM] [Bed Lights] Online: Bed Lights [94103E4EFA58] undefined:1

^ SyntaxError: Unexpected token < at Object.parse (native) at Object. (/usr/local/lib/node_modules/homebridge-philipstv/index.js:246:35) at Request._callback (/usr/local/lib/node_modules/homebridge-philipstv/index.js:92:3) at Request.self.callback (/usr/local/lib/node_modules/homebridge-philipstv/node_modules/request/request.js:186:22) at emitTwo (events.js:87:13) at Request.emit (events.js:172:7) at Request. (/usr/local/lib/node_modules/homebridge-philipstv/node_modules/request/request.js:1163:10) at emitOne (events.js:77:13) at Request.emit (events.js:169:7) at IncomingMessage. (/usr/local/lib/node_modules/homebridge-philipstv/node_modules/request/request.js:1085:12) at IncomingMessage.g (events.js:260:16) at emitNone (events.js:72:20) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:905:12) at nextTickCallbackWith2Args (node.js:441:9) at process._tickCallback (node.js:355:17)
akke911 commented 6 years ago

Had same error as first post, but got it working by editing these lines in homebridge-philipstv/index.js:

this.off_url = "http://"+this.ip_address+":1925/"+this.api_version+"/input/key"; this.off_body = JSON.stringify({"key":"Standby"}); this.status_url = "http://"+this.ip_address+":1925/"+this.api_version+"/sources/current";

Status url will report source when the tv is on, so even if the plug-in don't get the correct response it sets variable to on.

Seems like some jointspace API versions don't have /powerstate implemented. (I have 2012 version)

tiereland commented 5 years ago

I had same error. I have 2011 Philips. I fixed the homebridge-philipstv/index.js for status_url. Anytime in iPhone My Home my TV looks like button Switch. No errors in homebridge log. What I have to do to to see it like TV in My Home app?

Lukcyluke commented 5 years ago

I think a simple try-catch around var responseBodyParsed = JSON.parse( responseBody); should do the job. I think it crashed here because of an uncaught SyntaxError. A different port like 1926 could be added through the homebridge config.json easily.

Lukcyluke commented 5 years ago

What I have to do to to see it like TV in My Home app?

This plugin must implement the new HAP-NodeJS API for TVs. It currently doesn't.