Esempio n. 1
0
 private void SetupStairwayLamps(IArea room)
 {
     _automationFactory.RegisterTurnOnAndOffAutomation(room, Floor.CombinedStairwayLampAutomation)
     .WithTrigger(room.GetMotionDetector(Floor.StairwayMotionDetector))
     .WithTrigger(room.GetButton(Floor.ButtonStairway).PressedShortTrigger)
     .WithTarget(room.GetComponent(Floor.CombinedStairwayLamp))
     .WithEnabledAtNight();
 }
Esempio n. 2
0
 private void SetupStairwayLamps(IArea room)
 {
     room.SetupTurnOnAndOffAutomation()
     .WithTrigger(room.GetMotionDetector(Floor.StairwayMotionDetector))
     .WithTrigger(room.GetButton(Floor.ButtonStairway).GetPressedShortlyTrigger())
     .WithTarget(room.GetActuator(Floor.CombinedStairwayLamp))
     .WithEnabledAtNight(Controller.ServiceLocator.GetService <IDaylightService>())
     .WithOnDuration(TimeSpan.FromSeconds(30));
 }
Esempio n. 3
0
        private void SetupStairsCeilingLamps(IArea floor, HSPE8OutputOnly hspe8UpperFloor)
        {
            var output = new LogicalBinaryOutput()
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO4])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO5])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO7])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO6])
                         .WithInvertedState();

            floor.WithLamp(Floor.LampStairsCeiling, output);

            floor.SetupTurnOnAndOffAutomation()
            .WithTrigger(floor.GetMotionDetector(Floor.StairsLowerMotionDetector))
            .WithTrigger(floor.GetMotionDetector(Floor.StairsUpperMotionDetector))
            //.WithTrigger(floor.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger())
            .WithTarget(floor.GetStateMachine(Floor.LampStairsCeiling))
            .WithOnDuration(TimeSpan.FromSeconds(10));

            var lamp = floor.GetLamp(Floor.LampStairsCeiling);

            floor.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger().Triggered += (s, e) =>
            {
                if (lamp.GetState().Equals(BinaryStateId.On))
                {
                    lamp.SetState(BinaryStateId.Off, new AnimateParameter().WithReversedOrder());
                }
                else
                {
                    lamp.SetState(BinaryStateId.On, new AnimateParameter());
                }
            };

            floor.GetButton(Floor.ButtonStairsLowerUpper).GetPressedShortlyTrigger().Triggered += (s, e) =>
            {
                if (lamp.GetState().Equals(BinaryStateId.On))
                {
                    lamp.SetState(BinaryStateId.Off, new AnimateParameter());
                }
                else
                {
                    lamp.SetState(BinaryStateId.On, new AnimateParameter().WithReversedOrder());
                }
            };
        }
Esempio n. 4
0
        private void SetupStairsCeilingLamps(IArea room, HSPE8OutputOnly hspe8UpperFloor)
        {
            var output = new LogicalBinaryOutput()
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO4])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO5])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO7])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO6])
                         .WithInvertedState();

            _actuatorFactory.RegisterLamp(room, Floor.LampStairsCeiling, output);

            _automationFactory.RegisterTurnOnAndOffAutomation(room, Floor.LampStairsCeilingAutomation)
            .WithTrigger(room.GetMotionDetector(Floor.StairsLowerMotionDetector))
            .WithTrigger(room.GetMotionDetector(Floor.StairsUpperMotionDetector))
            //.WithTrigger(floor.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger())
            .WithTarget(room.GetStateMachine(Floor.LampStairsCeiling));

            var lamp = room.GetLamp(Floor.LampStairsCeiling);

            room.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger().Triggered += (s, e) =>
            {
                if (lamp.GetState().Equals(BinaryStateId.On))
                {
                    lamp.SetState(BinaryStateId.Off, new AnimateParameter().WithReversedOrder());
                }
                else
                {
                    lamp.SetState(BinaryStateId.On, new AnimateParameter());
                }
            };

            room.GetButton(Floor.ButtonStairsLowerUpper).GetPressedShortlyTrigger().Triggered += (s, e) =>
            {
                if (lamp.GetState().Equals(BinaryStateId.On))
                {
                    lamp.SetState(BinaryStateId.Off, new AnimateParameter());
                }
                else
                {
                    lamp.SetState(BinaryStateId.On, new AnimateParameter().WithReversedOrder());
                }
            };
        }
Esempio n. 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);
        }
        private void StartBathode(IArea bathroom)
        {
            bathroom.GetMotionDetector().Disable();

            bathroom.GetLamp(LowerBathroom.LightCeilingDoor).TryTurnOn();
            bathroom.GetLamp(LowerBathroom.LightCeilingMiddle).TryTurnOff();
            bathroom.GetLamp(LowerBathroom.LightCeilingWindow).TryTurnOff();
            bathroom.GetLamp(LowerBathroom.LampMirror).TryTurnOff();

            _bathmodeResetTimer?.Cancel();
            _bathmodeResetTimer = bathroom.Controller.ServiceLocator.GetService <ISchedulerService>().In(TimeSpan.FromHours(1)).Execute(() => bathroom.GetMotionDetector().Enable());
        }
Esempio n. 7
0
        private void SetupStairsCeilingLamps(IArea room, HSPE8OutputOnly hspe8UpperFloor)
        {
            var output = new LogicalBinaryOutput()
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO4])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO5])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO7])
                         .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO6])
                         .WithInvertedState();

            _actuatorFactory.RegisterLamp(room, Floor.LampStairsCeiling, output);

            _automationFactory.RegisterTurnOnAndOffAutomation(room, Floor.LampStairsCeilingAutomation)
            .WithTrigger(room.GetMotionDetector(Floor.StairsLowerMotionDetector))
            .WithTrigger(room.GetMotionDetector(Floor.StairsUpperMotionDetector))
            //.WithTrigger(floor.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger())
            .WithTarget(room.GetLamp(Floor.LampStairsCeiling));

            var lamp = room.GetLamp(Floor.LampStairsCeiling);

            room.GetButton(Floor.ButtonStairsUpper).PressedShortTrigger.Attach(() => lamp.TryTogglePowerState());
            room.GetButton(Floor.ButtonStairsLowerUpper).PressedShortTrigger.Attach(() => lamp.TryTogglePowerState());
        }
        private void StartBathode(IArea bathroom)
        {
            var motionDetector = bathroom.GetMotionDetector(LowerBathroom.MotionDetector);

            _settingsService.SetComponentEnabledState(motionDetector, false);

            bathroom.GetLamp(LowerBathroom.LightCeilingDoor).TryTurnOn();
            bathroom.GetLamp(LowerBathroom.LightCeilingMiddle).TryTurnOff();
            bathroom.GetLamp(LowerBathroom.LightCeilingWindow).TryTurnOff();
            bathroom.GetLamp(LowerBathroom.LampMirror).TryTurnOff();

            _bathmodeResetDelayedAction?.Cancel();
            _bathmodeResetDelayedAction = _schedulerService.In(TimeSpan.FromHours(1), () => _settingsService.SetComponentEnabledState(motionDetector, true));
        }
 private void SetupStairwayLamps(IArea room)
 {
     _automationFactory.RegisterTurnOnAndOffAutomation(room, Floor.CombinedStairwayLampAutomation)
         .WithTrigger(room.GetMotionDetector(Floor.StairwayMotionDetector))
         .WithTrigger(room.GetButton(Floor.ButtonStairway).GetPressedShortlyTrigger())
         .WithTarget(room.GetActuator(Floor.CombinedStairwayLamp))
         .WithEnabledAtNight();
 }
        private void SetupStairsCeilingLamps(IArea room, HSPE8OutputOnly hspe8UpperFloor)
        {
            var output = new LogicalBinaryOutput()
                .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO4])
                .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO5])
                .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO7])
                .WithOutput(hspe8UpperFloor[HSPE8Pin.GPIO6])
                .WithInvertedState();

            _actuatorFactory.RegisterLamp(room, Floor.LampStairsCeiling, output);

            _automationFactory.RegisterTurnOnAndOffAutomation(room, Floor.LampStairsCeilingAutomation)
                .WithTrigger(room.GetMotionDetector(Floor.StairsLowerMotionDetector))
                .WithTrigger(room.GetMotionDetector(Floor.StairsUpperMotionDetector))
                //.WithTrigger(floor.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger())
                .WithTarget(room.GetStateMachine(Floor.LampStairsCeiling));

            var lamp = room.GetLamp(Floor.LampStairsCeiling);

            room.GetButton(Floor.ButtonStairsUpper).GetPressedShortlyTrigger().Triggered += (s, e) =>
            {
                if (lamp.GetState().Equals(BinaryStateId.On))
                {
                    lamp.SetState(BinaryStateId.Off, new AnimateParameter().WithReversedOrder());
                }
                else
                {
                    lamp.SetState(BinaryStateId.On, new AnimateParameter());
                }
            };

            room.GetButton(Floor.ButtonStairsLowerUpper).GetPressedShortlyTrigger().Triggered += (s, e) =>
            {
                if (lamp.GetState().Equals(BinaryStateId.On))
                {
                    lamp.SetState(BinaryStateId.Off, new AnimateParameter());
                }
                else
                {
                    lamp.SetState(BinaryStateId.On, new AnimateParameter().WithReversedOrder());
                }
            };
        }
        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);
        }