gw-wiscon / homebridge-philipstv

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

wake on wireless lan #2

Closed uronito closed 8 years ago

uronito commented 8 years ago

Hi,

I just discovered that to work properly the function of WOL in models 2014 or higher , would have to add the module wake on lan and when the function of power on launches first have to make a wol the WiFi Mac address and then launch the function as power on this , but does not work well . Therefore should add the module wake on lan and first wol command to launch the IP address and then the function wifi poweron.

Thanks

uronito commented 8 years ago

After launching the wol would have to pause 3 seconds

gw-wiscon commented 8 years ago

Can you point me to some documentation?

uronito commented 8 years ago

ther isn't Docs . I 've learned with my tv testing and modifying its plugin

uronito commented 8 years ago

hi,

the last version 0.3.38 is very well, but between the WOL function and poweron function should be a pause of 3 seconds.

Thanks.

gw-wiscon commented 8 years ago

I have added a WOL function, don't know if it works. Please test.

uronito commented 8 years ago

i have tested, is perfect but between the WOLrequest function and poweron function (httprequest) should be a pause of 3 seconds.

this 3 seconds are for system background will ready and can procces httprequest

Thanks

uronito commented 8 years ago

I 've learned something new . if you send a request to the address 192.168.1.132:1925/5/powerstate ( philips tv ip). There may be two answers or unanswered. If the answer is "standby" or no answer on the TV is off. if the answer is "On" The TV is on .

gw-wiscon commented 8 years ago

Will check the time-out thing tomorrow, in principle the socket time-out schould be sufficient.

With respect to the /powerstate method, can you sent me examples of the responses?

uronito commented 8 years ago

Hi,

the answers are:

{"powerstate":"Standby"} ----------> The Tv Is in Standby mode (off) .Accept httprequest for power on

{"powerstate":"On"}--------> The tv is on.

no response---------> The Tv is off. Wol request change this state to {"powerstate":"Standby"} after 4 seconds.

The request is: http://(iptv)/5/powerstate

the method is get, is only for know the state of the tv

Thanks

uronito commented 8 years ago

Hi,

Last version 0.3.42 crash on timer settimeout

tanks

gw-wiscon commented 8 years ago

You are fast!!

uronito commented 8 years ago

;) , jejeje. We get the perfect plugin

gw-wiscon commented 8 years ago

Should work now

gw-wiscon commented 8 years ago

and added support for the powerstate API

uronito commented 8 years ago

the plugin works well,

but the tv only gets mode standby , i have incremented timeout to 13000 ms but still dont change powerstate to on

i 'm istudying why

gw-wiscon commented 8 years ago

Did you enable quick start? HOME > [Setup] > [TV settings] > [General settings] > [Quick start]

uronito commented 8 years ago

ohhhhh yeahhhhh

settimeout 16000ms!!!!!!!!!!!!! oh my god!!!!!!!!

Just missing when the TV return the Standby state only the httprequest launched and if no response was launched wol and then httprequest

The 2014 onwards dont have this option

uronito commented 8 years ago

my remote app philips Also it takes long to turn on the tv

gw-wiscon commented 8 years ago

changed it into an attempt loop

gw-wiscon commented 8 years ago

it simply sends upto 8 times a power up request

uronito commented 8 years ago

Ohhhhhh yeahhhhhh

The plugins runs perfectly!!!!!!!!!!!!!!!!

You are a crack!!!!!!!!!!

uronito commented 8 years ago

thankssss!!!!!!!!!!!!!

gw-wiscon commented 8 years ago

yw, I assume I can close the issue now.

gw-wiscon commented 8 years ago

Did a small change, can you please retest Also test the OFF function

uronito commented 8 years ago

Echostunreach sometimes in wol and httprequest

uronito commented 8 years ago

sometimes tv on sometimes in standby

uronito commented 8 years ago

Wait a minute, the tv had remained hanging , I 'm resetting , wait and tell

gw-wiscon commented 8 years ago

My understanding sofar is this:

Apperently, your TV has 3 modes:

From On to Standby:

From OFF to StandBy:

From Standbye to On:

Correct?

uronito commented 8 years ago

It seems that the plugin works well , I reset the tv and everything ok .

Yes, what you say is correct

From OFF to StandBy:

WOL

I just discovered these commands now

From On to Standby:

http://iptv/5/powerstate POST /powerstate , body: {powerstate:Standby}

From Standbye to On: http://iptv/5/powerstate POST /powerstate, body: {powerstate:On}

uronito commented 8 years ago

0.3.52 runs perfectly

uronito commented 8 years ago

0.3.56 runs sometimes

sometimes turn on sometimes no

sometimes turn off sometimes no

most times it works fine, but sometimes fails to turn on and off and to check the state

uronito commented 8 years ago

I've been testing a few hours plugin and it seems to work perfect. The only thing is that when the TV returns the "Standby" state, Homebridge should mark the off state. When a httprequest is done to know the status of the TV if it returns "standby" Homebridge should change the check status to off.

Thanks

gw-wiscon commented 8 years ago

I am sorry, veru busy right now. Will take a look tomorrow evening.

uronito commented 8 years ago

Ok, don't worry

Thanks

uronito commented 8 years ago

i make a new pull request.

Now Runs Perfect!!!!!!!

Thanks

uronito commented 8 years ago

hi gw wiscon

0.3.58 runs perfect!!!!!!

Thanks !!!!!

gw-wiscon commented 8 years ago

please test, I added the code. Thanks again

uronito commented 8 years ago

0.3.58 runs Perfect.

but If the TV is unplugged and turn on in Homebridge , if can not find the TV should return the status of the TV off in the poll status homebridge. Setpowerstate --- Status poll context should be off

In the onkyo plugin could be the same.

excuse me for my poor english

Thanks

uronito commented 8 years ago

I have made a new pull request.

Thanks!!!!!!!

uronito commented 8 years ago

0.3.59 the same that 0.3.58.

works perfectly but If the TV is unplugged and turn on in Homebridge , if can not find the TV should return the status of the TV off in the poll status homebridge. Setpowerstate --- Status poll context should be off.

I have made a pull request with a modification, i test and work well.

Thanks

gw-wiscon commented 8 years ago

Hi Uronito,

In principle, the set routine is called from the hap-nodejs setValue (see below). Your solution, was to call this method again, this time with the context set, to avoid that the whole operation start again.

What then happens is in a situation where the power on function fails:

But, if an error is returned, the value is unchanged, and no update is sent along. This is why I decided to return an error.

Now, I am unsure about the reaction of HomeKit, it might be that the device is shown as ON. In that case, we still need also to add your proposed change. So, on paper, it is not required.

I hope this helps.

Characteristic.prototype.setValue = function(newValue, callback, context) {

  if (this.listeners('set').length > 0) {

    // allow a listener to handle the setting of this value, and wait for completion
    this.emit('set', newValue, once(function(err) {

      if (err) {
        // pass the error along to our callback
        if (callback) callback(err);
      }
      else {
        // setting the value was a success; so we can cache it now
        var oldValue = this.value;
        this.value = newValue;
        if (callback) callback();

        this.emit('change', { oldValue:oldValue, newValue:newValue, context:context });
      }

    }.bind(this)), context);

  }
  else {

    // no one is listening to the 'set' event, so just assign the value blindly
    var oldValue = this.value;
    this.value = newValue;
    if (callback) callback();

    this.emit('change', { oldValue:oldValue, newValue:newValue, context:context });
  }
uronito commented 8 years ago

hi gw wiscon,

thanks for your answer.

0.3.65 still show on if tv is unplugged.

the plugin don't check state of the tv. if launch homebridge and the tv is on homebridge dont show "on" state. i belive in this version don't polling state.

Thanks

gw-wiscon commented 8 years ago

I believe it always require a polling mode. Since it does not sent any event by itself when it is switched ON or OFF. So, if switched ON by using the remote, will stay undetected if polling mode is OFF.

I moved the callback to the beginning of the OM procedure - to improve homekit responsiveness during the procedure

uronito commented 8 years ago

You've got it

wowwwww!!!!!!

The plugin works perfect.

Thanks!!!!

gw-wiscon commented 8 years ago

I am happy you are set. Thanks for the nice cooperation, hopefully others will find this plugin usefull also.

uronito commented 8 years ago

Thank you so much for everything

2016-02-08 21:25 GMT+01:00 gw-wiscon notifications@github.com:

Closed #2 https://github.com/gw-wiscon/homebridge-philipstv/issues/2.

— Reply to this email directly or view it on GitHub https://github.com/gw-wiscon/homebridge-philipstv/issues/2#event-543347131 .

gw-wiscon commented 8 years ago

YW