コード例 #1
0
 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());
     });
 }
コード例 #2
0
        private void StartTimeout()
        {
            lock (_syncRoot)
            {
                if (!GetConditionsAreFulfilled())
                {
                    return;
                }

                _turnOffTimeout = _schedulerService.In(Settings.Duration).Execute(TurnOff);
            }
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        private void RestartTracking()
        {
            _movingDuration.Restart();

            _autoOffTimer?.Cancel();
            _autoOffTimer = _schedulerService.In(Settings.AutoOffTimeout).Execute(() => SetState(RollerShutterStateId.Off));
        }
コード例 #5
0
        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);
        }