Beispiel #1
0
 public CommandMessage(InsteonId dst, Command cmd, byte value = 0, MessageFlags flags = MessageFlags.Default)
 {
     Destination = dst;
     Command     = cmd;
     Value       = value;
     Flags       = flags;
 }
Beispiel #2
0
 public InsteonDevice(InsteonId address, InsteonController controller, string name = null, string zone = null, string alias = null)
 {
     Address    = address;
     Controller = controller ?? this as InsteonController;
     Zone       = zone ?? "";
     Name       = name ?? address.ToString();
     Alias      = alias ?? Name;
 }
Beispiel #3
0
        public async Task <LightStatus> RampAsync(InsteonId dst, RampDirection dir, int durationMs = 0)
        {
            LightStatus s = await StartRampAsync(dst, dir);

            if (durationMs > 0)
            {
                await Task.Delay(durationMs);

                s = await StopRampAsync(dst);
            }
            return(s);
        }
Beispiel #4
0
 public SwitchLinc(InsteonController controller, InsteonId address, string name = null, string zone = null, string alias = null, LightLevelCurve levelCurve = null)
     : base(address, controller, name, zone, alias)
 {
     LevelCurve = levelCurve;
 }
Beispiel #5
0
 public Task <LightStatus> RampDown(InsteonId dst, int durationMs = 0)
 => RampAsync(dst, RampDirection.Down, durationMs);
Beispiel #6
0
 public Task <LightStatus> StopRampAsync(InsteonId dst)
 => Send <LightStatus>(dst, Command.RampStop);
Beispiel #7
0
 public Task <LightStatus> StartRampAsync(InsteonId dst, RampDirection dir)
 => Send <LightStatus>(dst, Command.RampStart, (byte)dir);
Beispiel #8
0
 public Task <R> Send <R>(InsteonId dst, Command cmd, byte value = 0, MessageFlags flags = MessageFlags.Default) where R : CommandResponse, new()
 => Send <R>(new CommandMessage(dst, cmd, value, flags));
Beispiel #9
0
 public Task <LightStatus> SetLevelAsync(InsteonId dst, byte level)
 => Send <LightStatus>(dst, Command.SetLevel, level);
Beispiel #10
0
 public Task <LightStatus> Dim(InsteonId dst)
 => Send <LightStatus>(dst, Command.Dim);
Beispiel #11
0
 public Task <LightStatus> Brighten(InsteonId dst)
 => Send <LightStatus>(dst, Command.Brighten);
Beispiel #12
0
 public Task <LightStatus> SetFastOff(InsteonId dst)
 => Send <LightStatus>(dst, Command.FastOff);
Beispiel #13
0
 public Task <LightStatus> SetFullOn(InsteonId dst)
 => Send <LightStatus>(dst, Command.On);
Beispiel #14
0
 public Task <LightStatus> GetStatus(InsteonId dst)
 => Send <LightStatus>(dst, Command.GetLightStatus);
Beispiel #15
0
 public Task <LightStatus> SetLevelAsync(InsteonId dst, double pct)
 => SetLevelAsync(dst, LightStatus.PctToLevel(pct));
Beispiel #16
0
 public static IEnumerable <byte> GetBytes(MessageType type, InsteonId dst, params object[] bytes)
 => new[] { STX, (byte)type, dst.A1, dst.A2, dst.A3 }.Concat(bytes.Select(Convert.ToByte));
Beispiel #17
0
 public Task <CommandResponse> Send(InsteonId dst, Command cmd, byte value = 0, MessageFlags flags = MessageFlags.Default)
 => Send <CommandResponse>(dst, cmd, value, flags);