Ejemplo n.º 1
0
        public static async Task AlertLight(MultiBridgeLightLocation light)
        {
            var configSection = await GetGroupConfigurationsAsync();

            var config = configSection.Where(x => x.Connections.Any(c => c.Ip == light.Bridge)).FirstOrDefault();

            if (config != null)
            {
                foreach (var conn in config.Connections)
                {
                    var client     = new LocalHueClient(conn.Ip, conn.Key);
                    var allCommand = new LightCommand().TurnOn().SetColor(new RGBColor("0000FF")); //All blue
                    await client.SendGroupCommandAsync(allCommand, conn.GroupId);

                    //Only selected light red
                    if (conn.Ip == light.Bridge)
                    {
                        var alertCommand = new LightCommand().TurnOn().SetColor(new RGBColor("FF0000"));;
                        alertCommand.Alert = Alert.Once;
                        await client.SendCommandAsync(alertCommand, new List <string> {
                            light.Id
                        });
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static async Task AlertLight(MultiBridgeLightLocation light)
        {
            var configSection = GetGroupConfigurations();

            var config = configSection.SelectMany(x => x.Connections).Where(x => x.Ip == light.Bridge).FirstOrDefault();

            if (config != null)
            {
                var client  = new LocalHueClient(config.Ip, config.Key);
                var command = new LightCommand().TurnOn();
                command.Alert = Alert.Once;
                await client.SendCommandAsync(command, new List <string> {
                    light.Id
                });
            }
        }
Ejemplo n.º 3
0
 public Task Locate(MultiBridgeLightLocation light)
 {
     return(StreamingSetup.AlertLight(light));
 }