Support for Philips Hue System (3 Viewers)

Rick164

MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    For the static color changer it connects on start and keeps it open, for the others I do an intialize for every color per the docs of Q42:

    https://github.com/Q42/Q42.HueApi

    Think that needs changing but the documentation there is a bit lacking so need to dig a little further :), color code is without the hashtag.
     

    pur_berger

    Super User
  • Team MediaPortal
  • Super User
  • May 14, 2007
    1,679
    309
    52
    Vienna
    Home Country
    Austria Austria
    HueClient client = new HueClient("ip");
    client.RegisterAsync("mypersonalappname", "mypersonalappkey");

    If you already registered an appname, you can initialize the HueClient with the app's key:


    client.Initialize("mypersonalappkey");

    Are you taking this a little straight forward ;)
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    if the client is already intialized it skips that at the moment:

    Code:
      if (client.IsInitialized == false)
      {
      client.Initialize(tbHueAppKey.Text);
      outputtoLog("HUE has been initialized on COLOR CHANGE");
      }

    And on startup it sets up the connection if an bridge was found:

    Code:
      if (string.IsNullOrEmpty(tbHueBridgeIP.Text) == false)
      {
      client = new HueClient(hueBridgeIP);
      client.RegisterAsync(hueAppName, hueAppKey);
      try
      {
      client.Initialize(tbHueAppKey.Text);
      outputtoLog("HUE has been intialized on STARTUP");
      }
      catch (Exception et)
      {
      MessageBox.Show(et.ToString());
      }
      }

    For the color changer I made it a bit different to see if that would work better as that does register and intialize and loops the color commands which was the most efficient way as that keeps the client 'alive' during the color changes.
    Will publish the code as soon as the repo is created :)
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Thanks for the info!
    Does explain it a bit better as well, seems there's no real rate limiting:

    "There is no rate limiting at around 30 updates per second"

    So it should be able to process multiple commands just fine, gonna read up on the Philips docs to figure out why this isn't working like it should.
     

    pur_berger

    Super User
  • Team MediaPortal
  • Super User
  • May 14, 2007
    1,679
    309
    52
    Vienna
    Home Country
    Austria Austria
    OK - something interesting - by excident I put in 4250ms - and suddenly the color changes the moment the value is send. When I switch back to 2250 the colour is send and about 500ms later it's set on the light ...

    so i would assume that the delay is happening after the value was send. when the Bridge has enough time to do - whaterver - the nex chage is displayed immediatly.
     
    Last edited:

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    The strobe function is missing in the API but will see if I can add it.

    OK - something interesting - by excident I put in 4250ms - and suddenly the color changes the moment the value is send. When I switch back to 2250 the colour is send and about 500ms later it's set on the light ...

    so i would assume that the delay is happening after the value was send. when the Bridge has enough time to do - whaterver - the nex chage is displayed immediatly.

    That's very odd, increasing the value should of course increase the send delay.
    Will add a few more options in the next version so we can test it more thoroughly :)
     

    pur_berger

    Super User
  • Team MediaPortal
  • Super User
  • May 14, 2007
    1,679
    309
    52
    Vienna
    Home Country
    Austria Austria
    isn't teh delay value only the time between tow valus? I don't think it has anything to do with how fast the bridge gets it.
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Yep it's transition between colors so the initial color should be instant and every succeeding color will get the set delay, should have said transition delay :)
     

    Users who are viewing this thread

    Top Bottom