Timer
All Devices implementing ICountDown
can perform certain actions after a timer runs out. Use CountDownRule
to specify the timer options. All timers only run once, for repeated actions create a Schedule
.
Currently active timers can be accessed via the CountDownRules
property.
var cdr = new CountDownRule() {
Delay = 1800,
Enabled = true,
PoweredOn = false,
Name = "MyTimer"
}
await device.AddCountDownRule(cdr);
Options
Property | Type | Description |
---|---|---|
Name |
string | custom name of timer, shows in kasa app |
Enabled |
bool | if the rule is currently active or not |
PoweredOn |
bool | if the device should be powered on or off after the timer runs out |
Delay |
int | delay in seconds after which the action triggers |
Methods
Task ICountDown.RetrieveCountDownRules();
CountDownRules
respectively.
Task ICountDown.AddCountDownRule(CountDownRule);
Task ICountDown.EditCountDownRule(CountDownRule);
device.CountDownRules[0].Delay = 36000;
await device.EditCountDownRule(CountDownRules[0]);
Task ICountDown.DeleteCountDownRule(CountDownRule);
await device.DeleteCountDownRule(CountDownRules[0]);
Task ICountDown.DeleteAllCountDownRules();