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 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;
        }
Example #3
0
        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;
        }
Example #4
0
        public ControllerSlaveService(
            ISettingsService settingsService,
            ISchedulerService scheduler,
            IDateTimeService dateTimeService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService,
            IDaylightService daylightService,
            IWeatherService weatherService,
            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));
            _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));

            _log = logService?.CreatePublisher(nameof(ControllerSlaveService)) ?? throw new ArgumentNullException(nameof(logService));

            settingsService.CreateSettingsMonitor <ControllerSlaveServiceSettings>(s => Settings = s.NewSettings);

            scheduler.RegisterSchedule("ControllerSlavePolling", TimeSpan.FromMinutes(5), () => PullValues());
        }
        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);
        }
Example #6
0
        public RollerShutterAutomation(
            string id,
            INotificationService notificationService,
            ISchedulerService schedulerService,
            IDateTimeService dateTimeService,
            IDaylightService daylightService,
            IOutdoorTemperatureService 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));
            _outdoorTemperatureService = 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);

            // 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,
            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);
        }
Example #8
0
        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);
        }
Example #9
0
 public PersonalAgentService(
     ISettingsService settingsService,
     IComponentRegistryService componentRegistry,
     IAreaRegistryService areaService,
     IWeatherService weatherService,
     IOutdoorTemperatureService outdoorTemperatureService,
     IOutdoorHumidityService outdoorHumidityService,
     ILogService logService)
 {
     _settingsService           = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
     _componentsRegistry        = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
     _areaService               = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _weatherService            = weatherService ?? throw new ArgumentNullException(nameof(weatherService));
     _outdoorTemperatureService = outdoorTemperatureService ?? throw new ArgumentNullException(nameof(outdoorTemperatureService));
     _outdoorHumidityService    = outdoorHumidityService ?? throw new ArgumentNullException(nameof(outdoorHumidityService));
     _log = logService?.CreatePublisher(nameof(PersonalAgentService)) ?? throw new ArgumentNullException(nameof(logService));
 }
Example #10
0
        public PersonalAgentService(
            SynonymService synonymService,
            IComponentService componentService,
            IAreaService areaService,
            IWeatherService weatherService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService)
        {
            if (synonymService == null)
            {
                throw new ArgumentNullException(nameof(synonymService));
            }
            if (componentService == null)
            {
                throw new ArgumentNullException(nameof(componentService));
            }
            if (areaService == null)
            {
                throw new ArgumentNullException(nameof(areaService));
            }
            if (weatherService == null)
            {
                throw new ArgumentNullException(nameof(weatherService));
            }
            if (outdoorTemperatureService == null)
            {
                throw new ArgumentNullException(nameof(outdoorTemperatureService));
            }
            if (outdoorHumidityService == null)
            {
                throw new ArgumentNullException(nameof(outdoorHumidityService));
            }

            _synonymService            = synonymService;
            _componentService          = componentService;
            _areaService               = areaService;
            _weatherService            = weatherService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _outdoorHumidityService    = outdoorHumidityService;
        }
        public PersonalAgentService(
            SynonymService synonymService,
            IComponentService componentService,
            IAreaService areaService,
            IWeatherService weatherService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService)
        {
            if (synonymService == null) throw new ArgumentNullException(nameof(synonymService));
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (areaService == null) throw new ArgumentNullException(nameof(areaService));
            if (weatherService == null) throw new ArgumentNullException(nameof(weatherService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService));

            _synonymService = synonymService;
            _componentService = componentService;
            _areaService = areaService;
            _weatherService = weatherService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _outdoorHumidityService = outdoorHumidityService;
        }
Example #12
0
        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);
        }