private async Task GetHttpLights()
        {
            var client = new LifxHttpClient(_token);
            var lights = await client.GetLights();

            foreach (var light in lights)
            {
                var device = AddLifxDevice(light?.Id, () => new LifxDevice(light));

                if (device != null)
                {
                    UpdateDeviceVariables(device, light);
                }
            }
        }
        private async Task ExecuteCloudAction(LifxDevice device, string action, int seconds, double brightness, string color)
        {
            var client = new LifxHttpClient(_token);
            var lights = await client.GetLights();

            var light = lights.SingleOrDefault(l => l.Id.Equals(device.Id));

            if (light == null)
            {
                return;
            }

            switch (action.ToLowerInvariant())
            {
            case "switch on":
                await client.SwitchOn(light, seconds);

                _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", true));
                break;

            case "switch off":
                await client.SwitchOff(light, seconds);

                _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", false));
                break;

            case "change color":
                var rgb = color.ParseRgb();
                await client.ChangeColor(light, rgb.ToString(), seconds);

                _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", true));
                _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Color", rgb.ToString()));
                break;

            case "change brightness":
                await client.ChangeBrightness(light, brightness, seconds);

                var db = Math.Round(brightness, 2);
                _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Brightness", db));
                _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", true));
                break;

            default:
                return;
            }
        }
        private async Task GetHttpLights()
        {
            var client = new LifxHttpClient(_token);
            var lights = await client.GetLights();

            foreach (var light in lights)
            {
                LifxDevice device;

                lock (_deviceLock)
                {
                    device = _devices.Cast<LifxDevice>().SingleOrDefault(d => d.Id.Equals(light.Id));

                    if (device == null)
                    {
                        device = new LifxDevice(light);
                        _devices.Add(device);
                    }
                }

                UpdateDeviceVariables(device, light);
            }
        }
        private async Task ExecuteCloudAction(LifxDevice device, string action, int seconds, double brightness, string color)
        {
            var client = new LifxHttpClient(_token);
            var lights = await client.GetLights();
            var light = lights.SingleOrDefault(l => l.Id.Equals(device.Id));

            if (light == null)
            {
                return;
            }

            switch (action.ToLowerInvariant())
            {
                case "switch on":
                    await client.SwitchOn(light, seconds);
                    _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", true));
                    break;
                case "switch off":
                    await client.SwitchOff(light, seconds);
                    _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", false));
                    break;
                case "change color":
                    var rgb = color.ParseRgb();
                    await client.ChangeColor(light, rgb.ToString(), seconds);
                    _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", true));
                    _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Color", rgb.ToString()));
                    break;
                case "change brightness":
                    await client.ChangeBrightness(light, brightness, seconds);
                    var db = Math.Round(brightness, 2);
                    _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "Brightness", db));
                    _messageQueue.Publish(new UpdateVariableMessage(Name, device.Id, "IsOn", true));
                    break;
                default:
                    return;
            }
        }