private LocalHueClient GetClient(PhilipsHueBridge bridge)
        {
            var variableName = $"{Name}.{bridge.Id}.ApiKey";
            var apiKey       = _variableRepository.Get <StringVariable>(variableName).Value;

            return(new LocalHueClient(bridge.IpAddress, apiKey));
        }
        private async Task FindDevices(PhilipsHueBridge bridge)
        {
            try
            {
                var variableName = $"PhilipsHue.{bridge.Id}.ApiKey";
                var apiKey       = _variableRepository.Get <StringVariable>(variableName).Value;

                var client = new LocalHueClient(bridge.IpAddress, apiKey);

                await FindBulbsAsync(client, bridge);
                await FindSensorsAsync(client, bridge);
            }
            catch (Exception e)
            {
                _log.Error($"Unable to get devices ({e.GetType().Name}) {e.Message}");
            }
        }
Esempio n. 3
0
 public void Start()
 {
     _variableValues = _variableRepository
                       .Get()
                       .ToDictionary(v => v.Name, v => v.Value, StringComparer.Ordinal);
 }
            public object get(string name)
            {
                var variable = _variableRepository.Get <IVariable>(name);

                return(variable?.Value);
            }