public void Setup(Controller controller, CCToolsBoardController ccToolsController)
        {
            var hsrel5Stairway              = ccToolsController.CreateHSREL5(Device.StairwayHSREL5, new I2CSlaveAddress(60));
            var hspe8UpperFloor             = controller.Device <HSPE8OutputOnly>(Device.UpperFloorAndOfficeHSPE8);
            var hspe16FloorAndLowerBathroom = ccToolsController.CreateHSPE16OutputOnly(Device.LowerFloorAndLowerBathroomHSPE16, new I2CSlaveAddress(17));

            var input1 = controller.Device <HSPE16InputOnly>(Device.Input1);
            var input2 = controller.Device <HSPE16InputOnly>(Device.Input2);
            var input4 = controller.Device <HSPE16InputOnly>(Device.Input4);

            var i2cHardwareBridge = controller.Device <I2CHardwareBridge>();

            const int SensorPin = 5;

            var floor = controller.CreateArea(Room.Floor)
                        .WithMotionDetector(Floor.StairwayMotionDetector, input2.GetInput(1))
                        .WithMotionDetector(Floor.StairsLowerMotionDetector, input4.GetInput(7))
                        .WithMotionDetector(Floor.StairsUpperMotionDetector, input4.GetInput(6))
                        .WithMotionDetector(Floor.LowerFloorMotionDetector, input1.GetInput(4))
                        .WithTemperatureSensor(Floor.LowerFloorTemperatureSensor, i2cHardwareBridge.DHT22Accessor.GetTemperatureSensor(SensorPin))
                        .WithHumiditySensor(Floor.LowerFloorHumiditySensor, i2cHardwareBridge.DHT22Accessor.GetHumiditySensor(SensorPin))
                        .WithLamp(Floor.Lamp1, hspe16FloorAndLowerBathroom.GetOutput(5).WithInvertedState())
                        .WithLamp(Floor.Lamp2, hspe16FloorAndLowerBathroom.GetOutput(6).WithInvertedState())
                        .WithLamp(Floor.Lamp3, hspe16FloorAndLowerBathroom.GetOutput(7).WithInvertedState())
                        .WithLamp(Floor.StairwayLampCeiling, hsrel5Stairway.GetOutput(0))
                        .WithLamp(Floor.StairwayLampWall, hsrel5Stairway.GetOutput(1))
                        .WithRollerShutter(Floor.StairwayRollerShutter, hsrel5Stairway.GetOutput(4), hsrel5Stairway.GetOutput(3))
                        .WithButton(Floor.ButtonLowerFloorUpper, input1.GetInput(0))
                        .WithButton(Floor.ButtonLowerFloorLower, input1.GetInput(5))
                        .WithButton(Floor.ButtonLowerFloorAtBathroom, input1.GetInput(1))
                        .WithButton(Floor.ButtonLowerFloorAtKitchen, input1.GetInput(3))
                        .WithButton(Floor.ButtonStairsLowerUpper, input4.GetInput(5))
                        .WithButton(Floor.ButtonStairsLowerLower, input1.GetInput(2))
                        .WithButton(Floor.ButtonStairsUpper, input4.GetInput(4))
                        .WithButton(Floor.ButtonStairway, input1.GetInput(6));

            floor.CombineActuators(Floor.CombinedStairwayLamp)
            .WithActuator(floor.Lamp(Floor.StairwayLampCeiling))
            .WithActuator(floor.Lamp(Floor.StairwayLampWall));

            floor.SetupTurnOnAndOffAutomation()
            .WithTrigger(floor.MotionDetector(Floor.StairwayMotionDetector))
            .WithTrigger(floor.Button(Floor.ButtonStairway).GetPressedShortlyTrigger())
            .WithTarget(floor.BinaryStateOutput(Floor.CombinedStairwayLamp))
            .WithEnabledAtNight(controller.Device <IWeatherStation>())
            .WithOnDuration(TimeSpan.FromSeconds(30));

            floor.CombineActuators(Floor.CombinedLamps)
            .WithActuator(floor.Lamp(Floor.Lamp1))
            .WithActuator(floor.Lamp(Floor.Lamp2))
            .WithActuator(floor.Lamp(Floor.Lamp3));

            floor.SetupTurnOnAndOffAutomation()
            .WithTrigger(floor.MotionDetector(Floor.LowerFloorMotionDetector))
            .WithTrigger(floor.Button(Floor.ButtonLowerFloorUpper).GetPressedShortlyTrigger())
            .WithTrigger(floor.Button(Floor.ButtonLowerFloorAtBathroom).GetPressedShortlyTrigger())
            .WithTrigger(floor.Button(Floor.ButtonLowerFloorAtKitchen).GetPressedShortlyTrigger())
            .WithTarget(floor.BinaryStateOutput(Floor.CombinedLamps))
            .WithEnabledAtNight(controller.Device <IWeatherStation>())
            .WithTurnOffIfButtonPressedWhileAlreadyOn()
            .WithOnDuration(TimeSpan.FromSeconds(20));

            SetupStairsCeilingLamps(floor, hspe8UpperFloor);
            SetupStairsLamps(floor, controller.Device <IWeatherStation>(), hspe16FloorAndLowerBathroom);

            floor.SetupRollerShutterAutomation().WithRollerShutters(floor.RollerShutter(Floor.StairwayRollerShutter));
        }
示例#2
0
        public override void Setup()
        {
            var hsrel5Stairway              = CCToolsBoardController.CreateHSREL5(InstalledDevice.StairwayHSREL5, new I2CSlaveAddress(60));
            var hspe8UpperFloor             = Controller.Device <HSPE8OutputOnly>(InstalledDevice.UpperFloorAndOfficeHSPE8);
            var hspe16FloorAndLowerBathroom = CCToolsBoardController.CreateHSPE16OutputOnly(InstalledDevice.LowerFloorAndLowerBathroomHSPE16, new I2CSlaveAddress(17));

            var input1 = Controller.Device <HSPE16InputOnly>(InstalledDevice.Input1);
            var input2 = Controller.Device <HSPE16InputOnly>(InstalledDevice.Input2);
            var input4 = Controller.Device <HSPE16InputOnly>(InstalledDevice.Input4);

            var i2cHardwareBridge = Controller.GetDevice <I2CHardwareBridge>();

            const int SensorPin = 5;

            var room = Controller.CreateArea(Room.Floor)
                       .WithMotionDetector(Floor.StairwayMotionDetector, input2.GetInput(1))
                       .WithMotionDetector(Floor.StairsLowerMotionDetector, input4.GetInput(7))
                       .WithMotionDetector(Floor.StairsUpperMotionDetector, input4.GetInput(6))
                       .WithMotionDetector(Floor.LowerFloorMotionDetector, input1.GetInput(4))
                       .WithTemperatureSensor(Floor.LowerFloorTemperatureSensor, i2cHardwareBridge.DHT22Accessor.GetTemperatureSensor(SensorPin))
                       .WithHumiditySensor(Floor.LowerFloorHumiditySensor, i2cHardwareBridge.DHT22Accessor.GetHumiditySensor(SensorPin))
                       .WithLamp(Floor.Lamp1, hspe16FloorAndLowerBathroom.GetOutput(5).WithInvertedState())
                       .WithLamp(Floor.Lamp2, hspe16FloorAndLowerBathroom.GetOutput(6).WithInvertedState())
                       .WithLamp(Floor.Lamp3, hspe16FloorAndLowerBathroom.GetOutput(7).WithInvertedState())
                       .WithLamp(Floor.StairwayLampCeiling, hsrel5Stairway.GetOutput(0))
                       .WithLamp(Floor.StairwayLampWall, hsrel5Stairway.GetOutput(1))
                       .WithRollerShutter(Floor.StairwayRollerShutter, hsrel5Stairway.GetOutput(4), hsrel5Stairway.GetOutput(3))
                       .WithButton(Floor.ButtonLowerFloorUpper, input1.GetInput(0))
                       .WithButton(Floor.ButtonLowerFloorLower, input1.GetInput(5))
                       .WithButton(Floor.ButtonLowerFloorAtBathroom, input1.GetInput(1))
                       .WithButton(Floor.ButtonLowerFloorAtKitchen, input1.GetInput(3))
                       .WithButton(Floor.ButtonStairsLowerUpper, input4.GetInput(5))
                       .WithButton(Floor.ButtonStairsLowerLower, input1.GetInput(2))
                       .WithButton(Floor.ButtonStairsUpper, input4.GetInput(4))
                       .WithButton(Floor.ButtonStairway, input1.GetInput(6));

            room.CombineActuators(Floor.CombinedStairwayLamp)
            .WithActuator(room.GetLamp(Floor.StairwayLampCeiling))
            .WithActuator(room.GetLamp(Floor.StairwayLampWall));

            SetupStairwayLamps(room);

            room.CombineActuators(Floor.CombinedLamps)
            .WithActuator(room.GetLamp(Floor.Lamp1))
            .WithActuator(room.GetLamp(Floor.Lamp2))
            .WithActuator(room.GetLamp(Floor.Lamp3));

            room.SetupTurnOnAndOffAutomation()
            .WithTrigger(room.GetMotionDetector(Floor.LowerFloorMotionDetector))
            .WithTrigger(room.GetButton(Floor.ButtonLowerFloorUpper).GetPressedShortlyTrigger())
            .WithTrigger(room.GetButton(Floor.ButtonLowerFloorAtBathroom).GetPressedShortlyTrigger())
            .WithTrigger(room.GetButton(Floor.ButtonLowerFloorAtKitchen).GetPressedShortlyTrigger())
            .WithTarget(room.GetActuator(Floor.CombinedLamps))
            .WithEnabledAtNight(Controller.ServiceLocator.GetService <IDaylightService>())
            .WithTurnOffIfButtonPressedWhileAlreadyOn()
            .WithOnDuration(TimeSpan.FromSeconds(20));

            SetupStairsCeilingLamps(room, hspe8UpperFloor);
            SetupStairsLamps(room, hspe16FloorAndLowerBathroom);

            room.SetupRollerShutterAutomation().WithRollerShutters(room.GetRollerShutter(Floor.StairwayRollerShutter));

            Controller.ServiceLocator.GetService <SynonymService>().AddSynonymsForArea(Room.Floor, "Flur", "Floor");
        }