public HueBridgeDevice(Q42.HueApi.HueClient client, HueBridgeDescription desc, Adapter bridge) : base("PhilipsHue",
            desc.Manufacturer, desc.ModelName, "", desc.SerialNumber, $"{desc.FriendlyName}\n{desc.ModelDescription} ({desc.ModelNumber})")
        {
            _client = client;
            _description = desc;
            _bridge = bridge;

            _enableJoinMethod = new AdapterMethod("Link", "Puts the adapter into join mode", 0);
            _enableJoinMethod.InvokeAction = Link;
            _enableJoinMethod.OutputParams.Add(new AdapterValue("Result", "") { Data = "" });
            Methods.Add(_enableJoinMethod);

           
            //var UpdateMethod = new AdapterMethod("Update", "Looks for any removed or added lights", 0);
            //UpdateMethod.InvokeAction = UpdateDeviceList;
            //Methods.Add(UpdateMethod);

            //Check if bridge is already linked and registered
            bool isLinked = false;
            var container = ApplicationData.Current.LocalSettings.CreateContainer("RegisteredHueBridges", ApplicationDataCreateDisposition.Always);
            if(container.Values.ContainsKey(desc.SerialNumber))
            {
                var key = container.Values[desc.SerialNumber] as string;
                if (key != null)
                {
                    (client as Q42.HueApi.LocalHueClient)?.Initialize(key);
                    isLinked = true;
                    UpdateDeviceList();
                }
            }
            else
            {
                Link();
            }

            _isLinkedProperty = new AdapterProperty("Link", "com.dotMorten.PhilipsHueDSB.PhilipsHue");
            _isLinkedProperty.Attributes.Add(new AdapterAttribute("IsLinked", isLinked, E_ACCESS_TYPE.ACCESS_READ) { COVBehavior = SignalBehavior.Always });
            this.Properties.Add(_isLinkedProperty);


            //if (desc.IconUri != null)
            //    Icon = new AdapterIcon(desc.IconUri.OriginalString);
            Icon = new AdapterIcon("ms-appx:///AdapterLib/Icons/PhilipsHueIcon.png");

            // change of value signal
            CreateSignals();
        }