public OpenWeatherMapService( IOutdoorTemperatureService outdoorTemperatureService, IOutdoorHumidityService outdoorHumidityService, IDaylightService daylightService, IWeatherService weatherService, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISystemInformationService systemInformationService, ISettingsService settingsService, IStorageService storageService) { if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService)); if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (weatherService == null) throw new ArgumentNullException(nameof(weatherService)); if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (systemInformationService == null) throw new ArgumentNullException(nameof(systemInformationService)); if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); if (storageService == null) throw new ArgumentNullException(nameof(storageService)); _outdoorTemperatureService = outdoorTemperatureService; _outdoorHumidityService = outdoorHumidityService; _daylightService = daylightService; _weatherService = weatherService; _dateTimeService = dateTimeService; _systemInformationService = systemInformationService; _storageService = storageService; settingsService.CreateSettingsMonitor<OpenWeatherMapServiceSettings>(s => Settings = s); LoadPersistedData(); schedulerService.RegisterSchedule("OpenWeatherMapServiceUpdater", TimeSpan.FromMinutes(5), Refresh); }
public OpenWeatherMapService( IOutdoorTemperatureService outdoorTemperatureService, IOutdoorHumidityService outdoorHumidityService, IDaylightService daylightService, IWeatherService weatherService, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISystemInformationService systemInformationService, ISettingsService settingsService, IStorageService storageService, ILogService logService) { if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } _schedulerService = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService)); _outdoorTemperatureService = outdoorTemperatureService ?? throw new ArgumentNullException(nameof(outdoorTemperatureService)); _outdoorHumidityService = outdoorHumidityService ?? throw new ArgumentNullException(nameof(outdoorHumidityService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); _weatherService = weatherService ?? throw new ArgumentNullException(nameof(weatherService)); _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _systemInformationService = systemInformationService ?? throw new ArgumentNullException(nameof(systemInformationService)); _storageService = storageService ?? throw new ArgumentNullException(nameof(storageService)); _log = logService?.CreatePublisher(nameof(OpenWeatherMapService)) ?? throw new ArgumentNullException(nameof(logService)); settingsService.CreateSettingsMonitor <OpenWeatherMapServiceSettings>(s => Settings = s.NewSettings); }
public OfficeConfiguration( IDeviceService deviceService, IAreaService areaService, IDaylightService daylightService, CCToolsBoardService ccToolsBoardService, SynonymService synonymService, RemoteSocketService remoteSocketService, ActuatorFactory actuatorFactory, SensorFactory sensorFactory) { if (deviceService == null) throw new ArgumentNullException(nameof(deviceService)); if (areaService == null) throw new ArgumentNullException(nameof(areaService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (ccToolsBoardService == null) throw new ArgumentNullException(nameof(ccToolsBoardService)); if (synonymService == null) throw new ArgumentNullException(nameof(synonymService)); if (remoteSocketService == null) throw new ArgumentNullException(nameof(remoteSocketService)); if (actuatorFactory == null) throw new ArgumentNullException(nameof(actuatorFactory)); if (sensorFactory == null) throw new ArgumentNullException(nameof(sensorFactory)); _deviceService = deviceService; _areaService = areaService; _daylightService = daylightService; _ccToolsBoardService = ccToolsBoardService; _synonymService = synonymService; _remoteSocketService = remoteSocketService; _actuatorFactory = actuatorFactory; _sensorFactory = sensorFactory; }
public RollerShutterAutomation( string id, INotificationService notificationService, ISchedulerService schedulerService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorService outdoorTemperatureService, IComponentRegistryService componentRegistry, ISettingsService settingsService, IResourceService resourceService) : base(id) { if (resourceService == null) { throw new ArgumentNullException(nameof(resourceService)); } _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService)); _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); _outdoorService = outdoorTemperatureService ?? throw new ArgumentNullException(nameof(outdoorTemperatureService)); _componentRegistry = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry)); _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService)); resourceService.RegisterText( RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature, "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C."); settingsService.CreateSettingsMonitor <RollerShutterAutomationSettings>(this, s => Settings = s.NewSettings); schedulerService.Register(id, TimeSpan.FromMinutes(1), () => PerformPendingActions()); }
public TurnOnAndOffAutomation(AutomationId id, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISettingsService settingsService, IDaylightService daylightService) : base(id) { if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } _dateTimeService = dateTimeService; _schedulerService = schedulerService; _daylightService = daylightService; settingsService.CreateSettingsMonitor <TurnOnAndOffAutomationSettings>(Id, s => Settings = s); }
public RollerShutterAutomation( AutomationId id, IHomeAutomationTimer timer, IDaylightService daylightService, IWeatherService weatherService, IComponentController componentController) : base(id) { if (timer == null) { throw new ArgumentNullException(nameof(timer)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } if (weatherService == null) { throw new ArgumentNullException(nameof(weatherService)); } if (componentController == null) { throw new ArgumentNullException(nameof(componentController)); } _timer = timer; _daylightService = daylightService; _weatherService = weatherService; _componentController = componentController; SpecialSettingsWrapper = new RollerShutterAutomationSettingsWrapper(Settings); }
public OpenWeatherMapService( IOutdoorService outdoorService, IDaylightService daylightService, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISystemInformationService systemInformationService, ISettingsService settingsService, IStorageService storageService, ILogService logService) { if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } _outdoorService = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _systemInformationService = systemInformationService ?? throw new ArgumentNullException(nameof(systemInformationService)); _log = logService?.CreatePublisher(nameof(OpenWeatherMapService)) ?? throw new ArgumentNullException(nameof(logService)); settingsService.CreateSettingsMonitor <OpenWeatherMapServiceSettings>(s => Settings = s.NewSettings); schedulerService.Register("OpenWeatherMapServiceUpdater", TimeSpan.FromMinutes(5), RefreshAsync); }
public ControllerSlaveService( ISettingsService settingsService, ISchedulerService scheduler, IDateTimeService dateTimeService, IOutdoorService outdoorService, IDaylightService daylightService, ILogService logService) { if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (scheduler == null) { throw new ArgumentNullException(nameof(scheduler)); } _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _outdoorService = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); _log = logService?.CreatePublisher(nameof(ControllerSlaveService)) ?? throw new ArgumentNullException(nameof(logService)); settingsService.CreateSettingsMonitor <ControllerSlaveServiceSettings>(s => Settings = s.NewSettings); scheduler.Register("ControllerSlavePolling", TimeSpan.FromMinutes(5), () => PullValues()); }
public AutomationFactory( ISchedulerService schedulerService, INotificationService notificationService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorTemperatureService outdoorTemperatureService, IComponentRegistryService componentService, ISettingsService settingsService, IResourceService resourceService) { if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService)); if (notificationService == null) throw new ArgumentNullException(nameof(notificationService)); if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService)); if (componentService == null) throw new ArgumentNullException(nameof(componentService)); if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); if (resourceService == null) throw new ArgumentNullException(nameof(resourceService)); _schedulerService = schedulerService; _notificationService = notificationService; _dateTimeService = dateTimeService; _daylightService = daylightService; _outdoorTemperatureService = outdoorTemperatureService; _componentService = componentService; _settingsService = settingsService; _resourceService = resourceService; }
public Room(string uid, IEnumerable <string> neighbors, Component lamp, IDaylightService daylightService, IConcurrencyProvider concurrencyProvider, ILogger logger, AreaDescriptor areaDescriptor, MotionConfiguration motionConfiguration, IEnumerable <IEventDecoder> eventsDecoders) { Uid = uid ?? throw new ArgumentNullException(nameof(uid)); Neighbors = neighbors ?? throw new ArgumentNullException(nameof(neighbors)); Lamp = lamp ?? throw new ArgumentNullException(nameof(lamp)); if (areaDescriptor.WorkingTime == WorkingTime.DayLight) { _turnOnConditionsValidator.WithCondition(ConditionRelation.And, new IsDayCondition(daylightService)); } else if (areaDescriptor.WorkingTime == WorkingTime.AfterDusk) { _turnOnConditionsValidator.WithCondition(ConditionRelation.And, new IsNightCondition(daylightService)); } _turnOnConditionsValidator.WithCondition(ConditionRelation.And, new IsEnabledAutomationCondition(this)); _turnOffConditionsValidator.WithCondition(ConditionRelation.And, new IsEnabledAutomationCondition(this)); _turnOffConditionsValidator.WithCondition(ConditionRelation.And, new IsTurnOffAutomaionCondition(this)); _logger = logger; _motionConfiguration = motionConfiguration; _concurrencyProvider = concurrencyProvider; _eventsDecoders = eventsDecoders; AreaDescriptor = areaDescriptor; _TurnOffTimeOut = new Timeout(AreaDescriptor.TurnOffTimeout, _motionConfiguration.TurnOffPresenceFactor); _eventsDecoders?.ForEach(decoder => decoder.Init(this)); }
public AutomationFactory( ISchedulerService schedulerService, INotificationService notificationService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorTemperatureService outdoorTemperatureService, IComponentService componentService, ISettingsService settingsService, IResourceService resourceService) { if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService)); if (notificationService == null) throw new ArgumentNullException(nameof(notificationService)); if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService)); if (componentService == null) throw new ArgumentNullException(nameof(componentService)); if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); if (resourceService == null) throw new ArgumentNullException(nameof(resourceService)); _schedulerService = schedulerService; _notificationService = notificationService; _dateTimeService = dateTimeService; _daylightService = daylightService; _outdoorTemperatureService = outdoorTemperatureService; _componentService = componentService; _settingsService = settingsService; _resourceService = resourceService; }
public ControllerSlaveService( ISettingsService settingsService, ISchedulerService scheduler, IDateTimeService dateTimeService, IOutdoorTemperatureService outdoorTemperatureService, IOutdoorHumidityService outdoorHumidityService, IDaylightService daylightService, IWeatherService weatherService) { if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); if (scheduler == null) throw new ArgumentNullException(nameof(scheduler)); if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService)); if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (weatherService == null) throw new ArgumentNullException(nameof(weatherService)); _dateTimeService = dateTimeService; _outdoorTemperatureService = outdoorTemperatureService; _outdoorHumidityService = outdoorHumidityService; _daylightService = daylightService; _weatherService = weatherService; settingsService.CreateSettingsMonitor<ControllerSlaveServiceSettings>(s => Settings = s); scheduler.RegisterSchedule("ControllerSlavePolling", TimeSpan.FromMinutes(5), PullValues); }
public IsNightCondition(IDaylightService daylightService, IDateTimeService dateTimeService) : base(dateTimeService) { if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); WithStart(daylightService.Sunset); WithEnd(daylightService.Sunrise); }
public RollerShutterAutomation( AutomationId id, INotificationService notificationService, ISchedulerService schedulerService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorTemperatureService outdoorTemperatureService, IComponentService componentService, ISettingsService settingsService, IResourceService resourceService) : base(id) { if (notificationService == null) { throw new ArgumentNullException(nameof(notificationService)); } if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } if (outdoorTemperatureService == null) { throw new ArgumentNullException(nameof(outdoorTemperatureService)); } if (componentService == null) { throw new ArgumentNullException(nameof(componentService)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (resourceService == null) { throw new ArgumentNullException(nameof(resourceService)); } _notificationService = notificationService; _dateTimeService = dateTimeService; _daylightService = daylightService; _outdoorTemperatureService = outdoorTemperatureService; _componentService = componentService; _settingsService = settingsService; _componentService = componentService; resourceService.RegisterText( RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature, "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C."); settingsService.CreateSettingsMonitor <RollerShutterAutomationSettings>(Id, s => Settings = s); // TODO: Consider timer service here. schedulerService.RegisterSchedule("RollerShutterAutomation-" + Guid.NewGuid(), TimeSpan.FromMinutes(1), PerformPendingActions); }
public OpenWeatherMapService( IOutdoorTemperatureService outdoorTemperatureService, IOutdoorHumidityService outdoorHumidityService, IDaylightService daylightService, IWeatherService weatherService, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISystemInformationService systemInformationService, ISettingsService settingsService, IStorageService storageService) { if (outdoorTemperatureService == null) { throw new ArgumentNullException(nameof(outdoorTemperatureService)); } if (outdoorHumidityService == null) { throw new ArgumentNullException(nameof(outdoorHumidityService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } if (weatherService == null) { throw new ArgumentNullException(nameof(weatherService)); } if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (systemInformationService == null) { throw new ArgumentNullException(nameof(systemInformationService)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (storageService == null) { throw new ArgumentNullException(nameof(storageService)); } _outdoorTemperatureService = outdoorTemperatureService; _outdoorHumidityService = outdoorHumidityService; _daylightService = daylightService; _weatherService = weatherService; _dateTimeService = dateTimeService; _systemInformationService = systemInformationService; _storageService = storageService; settingsService.CreateSettingsMonitor <OpenWeatherMapServiceSettings>(s => Settings = s); LoadPersistedData(); schedulerService.RegisterSchedule("OpenWeatherMapServiceUpdater", TimeSpan.FromMinutes(5), Refresh); }
public TurnOnAndOffAutomation(string id, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISettingsService settingsService, IDaylightService daylightService) : base(id) { _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService)); _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _schedulerService = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); settingsService.CreateSettingsMonitor <TurnOnAndOffAutomationSettings>(this, s => Settings = s.NewSettings); }
public IsNightCondition(IDaylightService daylightService, IHomeAutomationTimer timer) : base(timer) { if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } WithStart(daylightService.GetSunset); WithEnd(daylightService.GetSunrise); }
public ConditionalOnAutomation(AutomationId id, ISchedulerService schedulerService, IDateTimeService dateTimeService, IDaylightService daylightService) : base(id) { if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); _dateTimeService = dateTimeService; _daylightService = daylightService; WithTrigger(new IntervalTrigger(TimeSpan.FromMinutes(1), schedulerService)); }
public IsDayCondition(IDaylightService daylightService, IDateTimeService dateTimeService) : base(dateTimeService) { if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } WithStart(daylightService.Sunrise); WithEnd(daylightService.Sunset); }
public OfficeConfiguration( IDeviceService deviceService, IAreaService areaService, IDaylightService daylightService, CCToolsBoardService ccToolsBoardService, SynonymService synonymService, RemoteSocketService remoteSocketService, ActuatorFactory actuatorFactory, SensorFactory sensorFactory) { if (deviceService == null) { throw new ArgumentNullException(nameof(deviceService)); } if (areaService == null) { throw new ArgumentNullException(nameof(areaService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } if (ccToolsBoardService == null) { throw new ArgumentNullException(nameof(ccToolsBoardService)); } if (synonymService == null) { throw new ArgumentNullException(nameof(synonymService)); } if (remoteSocketService == null) { throw new ArgumentNullException(nameof(remoteSocketService)); } if (actuatorFactory == null) { throw new ArgumentNullException(nameof(actuatorFactory)); } if (sensorFactory == null) { throw new ArgumentNullException(nameof(sensorFactory)); } _deviceService = deviceService; _areaService = areaService; _daylightService = daylightService; _ccToolsBoardService = ccToolsBoardService; _synonymService = synonymService; _remoteSocketService = remoteSocketService; _actuatorFactory = actuatorFactory; _sensorFactory = sensorFactory; }
public TurnOnAndOffAutomation WithEnabledAtNight(IDaylightService daylightService) { if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } Func <TimeSpan> start = () => daylightService.GetSunset().Subtract(TimeSpan.FromHours(1)); Func <TimeSpan> end = () => daylightService.GetSunrise().Add(TimeSpan.FromHours(1)); _enablingConditionsValidator.WithCondition(ConditionRelation.Or, new TimeRangeCondition(_timer).WithStart(start).WithEnd(end)); return(this); }
public ConditionalOnAutomation WithOnAtNightRange(IDaylightService daylightService) { if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } var nightCondition = new TimeRangeCondition(_timer).WithStart(daylightService.GetSunset).WithEnd(daylightService.GetSunrise); WithCondition(ConditionRelation.And, nightCondition); return(this); }
public TurnOnAndOffAutomation(AutomationId id, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISettingsService settingsService, IDaylightService daylightService) : base(id) { if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService)); if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); _dateTimeService = dateTimeService; _schedulerService = schedulerService; _daylightService = daylightService; settingsService.CreateSettingsMonitor<TurnOnAndOffAutomationSettings>(Id, s => Settings = s); }
public ControllerSlaveService( ISettingsService settingsService, ISchedulerService scheduler, IDateTimeService dateTimeService, IOutdoorTemperatureService outdoorTemperatureService, IOutdoorHumidityService outdoorHumidityService, IDaylightService daylightService, IWeatherService weatherService) { if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (scheduler == null) { throw new ArgumentNullException(nameof(scheduler)); } if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (outdoorTemperatureService == null) { throw new ArgumentNullException(nameof(outdoorTemperatureService)); } if (outdoorHumidityService == null) { throw new ArgumentNullException(nameof(outdoorHumidityService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } if (weatherService == null) { throw new ArgumentNullException(nameof(weatherService)); } _dateTimeService = dateTimeService; _outdoorTemperatureService = outdoorTemperatureService; _outdoorHumidityService = outdoorHumidityService; _daylightService = daylightService; _weatherService = weatherService; settingsService.CreateSettingsMonitor <ControllerSlaveServiceSettings>(s => Settings = s); scheduler.RegisterSchedule("ControllerSlavePolling", TimeSpan.FromMinutes(5), PullValues); }
public ConditionalOnAutomation(AutomationId id, ISchedulerService schedulerService, IDateTimeService dateTimeService, IDaylightService daylightService) : base(id) { if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } _dateTimeService = dateTimeService; _daylightService = daylightService; WithTrigger(new IntervalTrigger(TimeSpan.FromMinutes(1), schedulerService)); }
private void SetupStairsLamps(IArea floor, IDaylightService daylightService, HSPE16OutputOnly hspe16FloorAndLowerBathroom) { var output = new LogicalBinaryOutput() .WithOutput(hspe16FloorAndLowerBathroom[HSPE16Pin.GPIO8]) .WithOutput(hspe16FloorAndLowerBathroom[HSPE16Pin.GPIO9]) .WithOutput(hspe16FloorAndLowerBathroom[HSPE16Pin.GPIO10]) .WithOutput(hspe16FloorAndLowerBathroom[HSPE16Pin.GPIO11]) .WithOutput(hspe16FloorAndLowerBathroom[HSPE16Pin.GPIO13]) .WithOutput(hspe16FloorAndLowerBathroom[HSPE16Pin.GPIO12]) .WithInvertedState(); floor.WithLamp(Floor.LampStairs, output); floor.SetupConditionalOnAutomation() .WithActuator(floor.GetLamp(Floor.LampStairs)) .WithOnAtNightRange(daylightService) .WithOffBetweenRange(TimeSpan.FromHours(23), TimeSpan.FromHours(4)); }
public AutomationFactory( ISchedulerService schedulerService, INotificationService notificationService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorService outdoorService, IComponentRegistryService componentService, ISettingsService settingsService, IResourceService resourceService, IMessageBrokerService messageBroker) { _messageBroker = messageBroker ?? throw new ArgumentNullException(nameof(messageBroker)); _schedulerService = schedulerService ?? throw new ArgumentNullException(nameof(schedulerService)); _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService)); _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); _outdoorService = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService)); _componentService = componentService ?? throw new ArgumentNullException(nameof(componentService)); _settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService)); _resourceService = resourceService ?? throw new ArgumentNullException(nameof(resourceService)); }
public LightAutomationService(IEventAggregator eventAggregator, IDaylightService daylightService, ILogService logService, IConcurrencyProvider concurrencyProvider, IMotionConfigurationProvider motionConfigurationProvider, IObservableTimer observableTimer ) { if (logService == null) { throw new ArgumentNullException(nameof(logService)); } _logger = logService.CreatePublisher(nameof(LightAutomationService)); _eventAggregator = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); _concurrencyProvider = concurrencyProvider ?? throw new ArgumentNullException(nameof(concurrencyProvider)); var configurationProvider = motionConfigurationProvider ?? throw new ArgumentNullException(nameof(motionConfigurationProvider)); _motionConfiguration = configurationProvider.GetConfiguration(); _observableTimer = observableTimer; }
public RollerShutterAutomation( AutomationId id, ISchedulerService schedulerService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorTemperatureService outdoorTemperatureService, IComponentController componentController) : base(id) { if (schedulerService == null) { throw new ArgumentNullException(nameof(schedulerService)); } if (dateTimeService == null) { throw new ArgumentNullException(nameof(dateTimeService)); } if (daylightService == null) { throw new ArgumentNullException(nameof(daylightService)); } if (outdoorTemperatureService == null) { throw new ArgumentNullException(nameof(outdoorTemperatureService)); } if (componentController == null) { throw new ArgumentNullException(nameof(componentController)); } _schedulerService = schedulerService; _dateTimeService = dateTimeService; _daylightService = daylightService; _outdoorTemperatureService = outdoorTemperatureService; _componentController = componentController; SpecialSettingsWrapper = new RollerShutterAutomationSettingsWrapper(Settings); }
public RollerShutterAutomation( AutomationId id, INotificationService notificationService, ISchedulerService schedulerService, IDateTimeService dateTimeService, IDaylightService daylightService, IOutdoorTemperatureService outdoorTemperatureService, IComponentService componentService, ISettingsService settingsService, IResourceService resourceService) : base(id) { if (notificationService == null) throw new ArgumentNullException(nameof(notificationService)); if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService)); if (daylightService == null) throw new ArgumentNullException(nameof(daylightService)); if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService)); if (componentService == null) throw new ArgumentNullException(nameof(componentService)); if (settingsService == null) throw new ArgumentNullException(nameof(settingsService)); if (resourceService == null) throw new ArgumentNullException(nameof(resourceService)); _notificationService = notificationService; _dateTimeService = dateTimeService; _daylightService = daylightService; _outdoorTemperatureService = outdoorTemperatureService; _componentService = componentService; _settingsService = settingsService; _componentService = componentService; resourceService.RegisterText( RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature, "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C."); settingsService.CreateSettingsMonitor<RollerShutterAutomationSettings>(Id, s => Settings = s); // TODO: Consider timer service here. schedulerService.RegisterSchedule("RollerShutterAutomation-" + Guid.NewGuid(), TimeSpan.FromMinutes(1), PerformPendingActions); }
public Room ToRoom(MotionConfiguration config, IDaylightService daylightService, IConcurrencyProvider concurrencyProvider, ILogger logger) { return(new Room(MotionDetectorUid, Neighbors, Lamp, daylightService, concurrencyProvider, logger, AreaInitializer, config, EventDecoders)); }
public DaylightScriptProxy(IDaylightService daylightService, IDateTimeService dateTimeService) { _dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); _daylightService = daylightService ?? throw new ArgumentNullException(nameof(daylightService)); }