AtmoHue - BETA - Philips Hue support for AtmoLight & AtmoWin (1 Viewer)

Lightning303

MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    I see :)
    Yeah that would be possible. I thought about it a bit and came up with 2 different approaches. Not sure which one is best though :p. I think approach 2, but lets see what @Rick164 says.

    First approach:
    We would need to extend ITargets, added methods like GetContextMenuContent() and ExecuteCommand(string commands).
    And in every Target we would need to add a roadmap how to build the menu. E.g. for Hue

    item="Use all Groups"
    onPress="group:all"

    item="Use group:"
    onPress="group:[keyboard]"

    where MP1 plugin would need to open the onscreen keyboard when it sees the [keyboard].

    Not sure which data format would be best for this, as we could also use submenus, so maybe json or something similar?

    In core we would have a method that collects all the menu infos (calling GetContextMenuContent() on every enabled target).

    And in MP1 we would call this method in core and then would need to parse all these information to then build a menu out of that.
    When an item is selected, we would call the core with the result, e.g. ExecuteCommand(Target.Hue, "group:all"), the core then sends it to hue handler with ExecuteCommand("group:all") and HueHandler would need to parse this and then set the group to all in this example.

    I reckon this would be quite some work. Also not sure if we would need the menu layout in the handler, as displaying and the way something is displayed is not the task of the handler or core.


    Second approach:
    In MP1 check if Hue is a target, and then get its instance.

    We would need this in core:
    Code:
        public ITargets GetTarget(Target target)
        {
          lock (targetsLock)
          {
            foreach (var t in targets)
            {
              if (t.Name == target)
              {
                return t;
              }
            }
          }
          return null;
        }

    and in MP1 we could do:
    Code:
    var hueTarget = coreObject.GetTarget(Target.Hue) as AtmoLight.Targets.HueHandler;

    And now we could use hueTarget.ChangeGroup("all") fo example.


    Context Menu in general @Rick164:
    The context menu starts here: https://github.com/ambilight-4-medi.../master/AtmoLight.MediaPortal1/Plugin.cs#L644

    The general layout is:
    Code:
          GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
          dlg.Reset();
          dlg.SetHeading("AtmoLight");
          dlg.Add(new GUIListItem("Item 1"));
          dlg.Add(new GUIListItem("Item 2"));
          dlg.Add(new GUIListItem("Item 3"));
          dlg.SelectedLabel = 0;
          dlg.DoModal(GUIWindowManager.ActiveWindow);
    
          if (dlg.SelectedLabelText == "Item 1")
          {
            // do this
          }
          ....

    So we would need to add a new Item to DialogContextMenu() and when that is selected we would need to make a new GUIDialogMenu that then has all the Hue stuff in it. Either having this generated dynamically with approach 1 or code it into MP1 plugin with approach 2, or you have some other ideas :).
     

    pur_berger

    Super User
  • Team MediaPortal
  • Super User
  • May 14, 2007
    1,679
    309
    52
    Vienna
    Home Country
    Austria Austria
    ah - yes - and that's where I think to myself - happy me that someone else knows what this is all about :)
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Thanks! , the second approach indeed looks best :)

    Should have a new version out this weekend which will have this added, in the AtmoHue UI there will be new group list where you can add your led devices and assign static colors to that group.
     

    killer8

    Portal Pro
    July 29, 2012
    378
    186
    Home Country
    Netherlands Netherlands
    DSR should be automatically off on 4K displays yeah, it's one of those Nvidia features that is causing some issues in games as well.
    Using the refresh rate changer as well but on an 1080P display (also GTX970 + latest drivers btw) and don't notice the error however I know that some 4K displays are slower with initially scaling up 1080P content as there's a lot of processing involved.
    Tried an 4K LG display for a while which took about 2 seconds to apply the 24hz refresh rate so that could definitely be the problem but it doesn't happen all the time right?
    You could try it a few times with different 24hz content and see if you can get it to reproduce the error every time , best to wait a few seconds in between to make sure the tv is completely back on 50/60hz.

    I tried a bit but can't reproduce the error. Atleast it doesn't come up when I start a tv show(24hz) or live tv(50hz). Normally my screen is set to 50hz as default and also changes back to this when the show which changes the refresh rate for example ends.

    Looks to me like for some reason you change the display while the refresh rate is changing. This probably results in the D3D device not beeing present, which then results in the error. As @Rick164 suggested.
    I will make a version with a bit more debugging on that tomorrow, and we are right i should be able to add a test if D3D device is present, if not, skip the framegrab. However the result is the same. The error you see is pretty much just cosmetical in the logs. AtmoLight tries something, fails, and aborts its try. On the next frame it tries again. With a check for D3D device, it will just abort before trying. The error like it is also does not effect any other parts of AtmoLight or MP for that matter. Like i said, just cosmetic. Still, thanks for reporting it .

    I know but errors always look quite bad even when they do not harm. Would be nice to have a version with some more debug code to have a clue why the error appears exactly. Thank you
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    I know but errors always look quite bad even when they do not harm. Would be nice to have a version with some more debug code to have a clue why the error appears exactly. Thank you
    I agree :).
    Here is a version with a lot of debug logging in the frame grabbing part. Just copy the dll into plugins/process.
    This version will output couple of lines every frame being grabbed. So, there will be a lot of spam, best to just try to reproduce the error with this dll and then use normal one again until its fixed.
    You dont have to use watchdog, just have MediaPortal set to debug log verbosity and then i only need the MediaPortal.log when you reproduced the error :).
     

    Attachments

    • AtmoLight.MediaPortal1.rar
      57.6 KB

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Got the code in but have one question about the functionality, there are 2 ways I could handle groups:

    - No ability to add groups manually but use the Location as the Group name from the LEDs setup (less config options in UI - prefer this one)
    - Ability to add group IDs and add existing LED IDs to it.

    What do you guys think?
     

    killer8

    Portal Pro
    July 29, 2012
    378
    186
    Home Country
    Netherlands Netherlands
    Got the code in but have one question about the functionality, there are 2 ways I could handle groups:

    - No ability to add groups manually but use the Location as the Group name from the LEDs setup (less config options in UI - prefer this one)
    - Ability to add group IDs and add existing LED IDs to it.

    What do you guys think?
    I guess the first one should be fine, since you can still change this in your philips app.
     

    zekaja

    MP Donator
  • Premium Supporter
  • March 24, 2010
    279
    110
    Copenhagen
    Home Country
    Denmark Denmark
    Got the code in but have one question about the functionality, there are 2 ways I could handle groups:

    - No ability to add groups manually but use the Location as the Group name from the LEDs setup (less config options in UI - prefer this one)
    - Ability to add group IDs and add existing LED IDs to it.

    What do you guys think?
    I'd say the first option would be pretty nice
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Option 1 it is :) , new version of AtmoLight BETA and AtmoHue added to first post.
    UI has gotten a little crowded so will combine the cleanup once I get the new listview (with in-line editing) working like it should.

    /edit: Forgot to mention that when adding new locations and static colors you need to restart AtmoHue for now for it to show up in AtmoLight, will fix that in the next version.

    Changelog

    28-11-2014 - AtmoLight BETA & AtmoHue updated

    AtmoHue 0.0.75

    - Set active groups/locations for liveview via the AtmoLight context menu
    - Set static color per group via the AtmoLight context menu

    You need to re-add the leds and add locations and static colors (new setting fields) for both features to work, for now only local installations of AtmoHue are supported as it reads the config via xml.
    The pull down menu when adding a new led ID will automatically list all the locations you have added to prevent typos.


    AtmoLight 1.14.001.0 - BETA version


    - Added new UI menu's for Hue, you need to setup the AtmoLight context menu (assign remote color key) for this to work, for troubleshooting the context menu there's a guide located here:

    https://forum.team-mediaportal.com/threads/atmolight-1-14-0-0-2014-11-23.125633/#post-1076671

    - Hue now has functions to read AtmoHue config (static color / groups)
     
    Last edited:

    Users who are viewing this thread

    Top Bottom