public Task ApplyAsync() { var hsrt16 = _ccToolsBoardService.RegisterHSRT16(InstalledDevice.CellarHSRT16, new I2CSlaveAddress(32)); var garden = _areaService.CreateArea(Room.Garden); var parkingLotLamp = new LogicalBinaryOutput(hsrt16[HSRT16Pin.Relay6], hsrt16[HSRT16Pin.Relay7], hsrt16[HSRT16Pin.Relay8]); _actuatorFactory.RegisterLamp(garden, Garden.LampParkingLot, parkingLotLamp); // Relay 9 is free. _actuatorFactory.RegisterSocket(garden, Garden.SocketPavillion, hsrt16[HSRT16Pin.Relay10]); _actuatorFactory.RegisterLamp(garden, Garden.LampRearArea, hsrt16[HSRT16Pin.Relay11]); _actuatorFactory.RegisterLamp(garden, Garden.SpotlightRoof, hsrt16[HSRT16Pin.Relay12]); _actuatorFactory.RegisterLamp(garden, Garden.LampTap, hsrt16[HSRT16Pin.Relay13]); _actuatorFactory.RegisterLamp(garden, Garden.LampGarage, hsrt16[HSRT16Pin.Relay14]); _actuatorFactory.RegisterLamp(garden, Garden.LampTerrace, hsrt16[HSRT16Pin.Relay15]); _actuatorFactory.RegisterStateMachine(garden, Garden.StateMachine, InitializeStateMachine); _sensorFactory.RegisterButton(garden, Garden.Button, _pi2GpioService.GetInput(4).WithInvertedState()); garden.GetStateMachine(Garden.StateMachine).ConnectMoveNextAndToggleOffWith(garden.GetButton(Garden.Button)); _automationFactory.RegisterConditionalOnAutomation(garden, Garden.LampParkingLotAutomation) .WithActuator(garden.GetLamp(Garden.LampParkingLot)) .WithOnAtNightRange() .WithOffBetweenRange(TimeSpan.Parse("22:30:00"), TimeSpan.Parse("05:00:00")); var ioBoardsInterruptMonitor = new InterruptMonitor(_pi2GpioService.GetInput(4)); ioBoardsInterruptMonitor.InterruptDetected += (s, e) => _ccToolsBoardService.PollInputBoardStates(); ioBoardsInterruptMonitor.Start(); return(Task.FromResult(0)); }
public Task ApplyAsync() { _synonymService.TryLoadPersistedSynonyms(); _ccToolsBoardService.RegisterHSPE16InputOnly(InstalledDevice.Input0, new I2CSlaveAddress(42)); _ccToolsBoardService.RegisterHSPE16InputOnly(InstalledDevice.Input1, new I2CSlaveAddress(43)); _ccToolsBoardService.RegisterHSPE16InputOnly(InstalledDevice.Input2, new I2CSlaveAddress(47)); _ccToolsBoardService.RegisterHSPE16InputOnly(InstalledDevice.Input3, new I2CSlaveAddress(45)); _ccToolsBoardService.RegisterHSPE16InputOnly(InstalledDevice.Input4, new I2CSlaveAddress(46)); _ccToolsBoardService.RegisterHSPE16InputOnly(InstalledDevice.Input5, new I2CSlaveAddress(44)); var i2CHardwareBridge = new I2CHardwareBridge(new I2CSlaveAddress(50), _i2CBusService, _schedulerService); _deviceService.AddDevice(i2CHardwareBridge); _remoteSocketService.Sender = new LPD433MHzSignalSender(i2CHardwareBridge, LDP433MhzSenderPin, _apiService); var brennenstuhl = new BrennenstuhlCodeSequenceProvider(); _remoteSocketService.RegisterRemoteSocket(0, brennenstuhl.GetSequencePair(BrennenstuhlSystemCode.AllOn, BrennenstuhlUnitCode.A)); _containerService.GetInstance <BedroomConfiguration>().Apply(); _containerService.GetInstance <OfficeConfiguration>().Apply(); _containerService.GetInstance <UpperBathroomConfiguration>().Apply(); _containerService.GetInstance <ReadingRoomConfiguration>().Apply(); _containerService.GetInstance <ChildrensRoomRoomConfiguration>().Apply(); _containerService.GetInstance <KitchenConfiguration>().Apply(); _containerService.GetInstance <FloorConfiguration>().Apply(); _containerService.GetInstance <LowerBathroomConfiguration>().Apply(); _containerService.GetInstance <StoreroomConfiguration>().Apply(); _containerService.GetInstance <LivingRoomConfiguration>().Apply(); _synonymService.RegisterDefaultComponentStateSynonyms(); var ioBoardsInterruptMonitor = new InterruptMonitor(_pi2GpioService.GetInput(4)); ioBoardsInterruptMonitor.InterruptDetected += (s, e) => _ccToolsBoardService.PollInputBoardStates(); ioBoardsInterruptMonitor.Start(); return(Task.FromResult(0)); }