public async Task <List <Group> > GetAllGroupsAsync() { if (!_options.IsLIFXEnabled || string.IsNullOrEmpty(_options.LIFXApiKey)) { return(new List <Group>()); } _client = await LifxCloudClient.CreateAsync(_options.LIFXApiKey); return(await _client.ListGroups(Selector.All)); }
public async Task <List <Group> > GetAllGroupsAsync() { if (string.IsNullOrEmpty(_apiKey)) { return(new List <Group>()); } _client = await LifxCloudClient.CreateAsync(_apiKey); var loadedLights = await _client.ListGroups(Selector.All); loadedLights = loadedLights.Where(a => !string.IsNullOrEmpty(a.Label)).ToList(); return(loadedLights); }
public async Task <List <Group> > GetAllGroups(string apiKey = null) { try { if (!string.IsNullOrEmpty(apiKey)) { _options.LightSettings.LIFX.LIFXApiKey = apiKey; } if (!_options.LightSettings.LIFX.IsEnabled || string.IsNullOrEmpty(_options.LightSettings.LIFX.LIFXApiKey)) { return(new List <Group>()); } _client = await LifxCloudClient.CreateAsync(_options.LightSettings.LIFX.LIFXApiKey); return(await _client.ListGroups(Selector.All)); } catch (Exception e) { _logger.LogError(e, "Error Getting Groups"); throw; } }