private void ProcessVariables(LifxResponse msg, LifxLocalLight light)
        {
            var stateLabelResponse = msg as StateLabelResponse;
            var lightStateResponse = msg as LightStateResponse;
            var lightPowerResponse = msg as LightPowerResponse;

            if (stateLabelResponse != null)
            {
                light.Name = stateLabelResponse.Label;
                VariableChanged?.Invoke(light, Tuple.Create(light, "Name", (object)stateLabelResponse.Label));
            }
            else if (lightStateResponse != null)
            {
                var brightness = lightStateResponse.Brightness/65535d;
                var saturation = lightStateResponse.Saturation/65535d;
                var kelvin = lightStateResponse.Kelvin;
                double hue = lightStateResponse.Hue;

                var color = new HsbkColor
                {
                    Hue = hue,
                    Saturation = saturation,
                    Brightness = brightness,
                    Kelvin = kelvin
                };
                
                var hexColor = color.ToRgb().ToString();

                light.Name = lightStateResponse.Label;
                light.Color = color;
                VariableChanged?.Invoke(light, Tuple.Create(light, "Color", (object)hexColor));
                VariableChanged?.Invoke(light, Tuple.Create(light, "Brightness", (object)Math.Round(brightness, 2)));
                VariableChanged?.Invoke(light, Tuple.Create(light, "Name", (object)lightStateResponse.Label));
                VariableChanged?.Invoke(light, Tuple.Create(light, "IsOn", (object)lightStateResponse.IsOn));
            }
            else if (lightPowerResponse != null)
            {
                VariableChanged?.Invoke(light, Tuple.Create(light, "IsOn", (object)lightPowerResponse.IsOn));
            }
        }
        private LifxLocalLight ProcessDeviceDiscoveryMessage(IPEndPoint remoteAddress, LifxResponse msg)
        {
            LifxLocalLight light;
            if (_discoveredBulbs.TryGetValue(remoteAddress.ToString(), out light))
            {
                light.LastSeen = DateTime.UtcNow;
                return light;
            }

            var device = new LifxLocalLight
            {
                HostName = remoteAddress,
                LastSeen = DateTime.UtcNow,
                Id = string.Join("", msg.Header.TargetMacAddress.Select(b => b.ToString("x2")))
            };
            
            _discoveredBulbs[remoteAddress.ToString()] = device;

            DeviceDiscovered?.Invoke(this, device);
            return device;
        }