/// <summary> /// Set the switch position of an individual switch. /// </summary> /// <param name="setting">The position to apply.</param> /// <returns>void</returns> public async Task Set(TIn setting) { SetSwitchInput command = new SetSwitchInput() { Brightness = setting.Brightness, Value = setting.Value, HexColor = setting.HexColor }; await clientManager.GetClient(setting.Bridge).SendCommandAsync(command, new String[] { setting.Id }); }
public async Task <Switch> Set(Guid switchId, SetSwitchInput @switch) { var entity = await this.Entity(switchId); if (entity != null) { mapper.Map(@switch, entity); await switchRepo.Set(entity); await SaveChanges(); return(mapper.Map <Switch>(entity)); } throw new KeyNotFoundException($"Cannot find @switch {switchId.ToString()}"); }
public async Task SendCommandAsync(SetSwitchInput command, IEnumerable <string> lightList = null) { var entry = await entryPointInjector.Load(); var switches = await entry.ListSwitches(new SwitchQuery() { SwitchIds = lightList.Select(i => Guid.Parse(i)).ToList(), Limit = int.MaxValue }); foreach (var sw in switches.Items) { await sw.Set(command); } }
public async Task <Switch> Set(Guid switchId, [FromBody] SetSwitchInput @switch) { return(await repo.Set(switchId, @switch)); }