private void StartTimeout(object sender, EventArgs e) { _timeout = _schedulerService.In(Settings.SlowDuration).Execute(() => { _actuator.SetState(new ComponentState("2")); _timeout = _schedulerService.In(Settings.FastDuration).Execute(() => _actuator.TryTurnOff()); }); }
private void StartTimeout() { lock (_syncRoot) { if (!GetConditionsAreFulfilled()) { return; } _turnOffTimeout = _schedulerService.In(Settings.Duration).Execute(TurnOff); } }
private void HandleIsEnabledStateChanged() { if (!Settings.IsEnabled) { Log.Info(Id + ": Disabled for 1 hour"); _autoEnableAction = _schedulerService.In(Settings.AutoEnableAfter).Execute(() => Settings.IsEnabled = true); } else { _autoEnableAction?.Cancel(); } }
private void RestartTracking() { _movingDuration.Restart(); _autoOffTimer?.Cancel(); _autoOffTimer = _schedulerService.In(Settings.AutoOffTimeout).Execute(() => SetState(RollerShutterStateId.Off)); }
private void StartBathode(IArea bathroom) { bathroom.GetMotionDetector().Settings.IsEnabled = false; bathroom.GetLamp(LowerBathroom.LightCeilingDoor).TryTurnOn(); bathroom.GetLamp(LowerBathroom.LightCeilingMiddle).TryTurnOff(); bathroom.GetLamp(LowerBathroom.LightCeilingWindow).TryTurnOff(); bathroom.GetLamp(LowerBathroom.LampMirror).TryTurnOff(); _bathmodeResetTimer?.Cancel(); _bathmodeResetTimer = _schedulerService.In(TimeSpan.FromHours(1)).Execute(() => bathroom.GetMotionDetector().Settings.IsEnabled = true); }