コード例 #1
0
ファイル: Fans.cs プロジェクト: carldebilly/smarthome.net
 /// <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);