예제 #1
0
 /// <summary>
 /// Sets teh speed of one or more fans
 /// </summary>
 /// <param name="ha">The HA API</param>
 /// <param name="fans">Fans to configure</param>
 /// <returns>An <see cref="ApiCall"/>.</returns>
 public static ApiCall SetSpeed(
     this HomeAssistantApi ha,
     Fan.Speeds speed,
     params IDevice <IFan>[] fans)
 => ha.Execute("fan", "set_speed", new Dictionary <string, object>
 {
     { "entity_id", fans.Select(l => l.Id).JoinBy(", ") },
     { "speed", speed.ToString().ToLowerInvariant() }
 });
예제 #2
0
 public SetSpeed(Fan.Speeds speed)
 {
     Speed = speed;
 }
예제 #3
0
 /// <summary>
 /// Sets the speed of one this fan
 /// </summary>
 /// <returns>An <see cref="AsyncContextOperation"/>.</returns>
 public static AsyncContextOperation SetSpeed <T>(this IDevice <T> device, Fan.Speeds speed)
     where T : ISupport <TurnOff>
 => device.Host.Execute(new SetSpeed(speed), device);