Esempio n. 1
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;
        }
Esempio n. 2
0
        public AreaRegistryService(
            IComponentRegistryService componentService,
            IAutomationRegistryService automationService,
            ISystemInformationService systemInformationService,
            IApiDispatcherService apiService,
            ISettingsService settingsService,
            IScriptingService scriptingService)
        {
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }
            if (scriptingService == null)
            {
                throw new ArgumentNullException(nameof(scriptingService));
            }

            _componentService  = componentService ?? throw new ArgumentNullException(nameof(componentService));
            _automationService = automationService ?? throw new ArgumentNullException(nameof(automationService));
            _settingsService   = settingsService ?? throw new ArgumentNullException(nameof(settingsService));

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;

            systemInformationService.Set("Areas/Count", () => _areas.Count);

            scriptingService.RegisterScriptProxy(s => new AreaRegistryScriptProxy(this));
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        public AreaRegistryService(
            IComponentRegistryService componentService,
            IAutomationRegistryService automationService,
            ISystemEventsService systemEventsService,
            ISystemInformationService systemInformationService,
            IApiDispatcherService apiService,
            ISettingsService settingsService)
        {
            if (systemEventsService == null)
            {
                throw new ArgumentNullException(nameof(systemEventsService));
            }
            if (systemInformationService == null)
            {
                throw new ArgumentNullException(nameof(systemInformationService));
            }
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }

            _componentService  = componentService ?? throw new ArgumentNullException(nameof(componentService));
            _automationService = automationService ?? throw new ArgumentNullException(nameof(automationService));
            _settingsService   = settingsService ?? throw new ArgumentNullException(nameof(settingsService));

            systemEventsService.StartupCompleted += (s, e) =>
            {
                systemInformationService.Set("Areas/Count", _areas.Count);
            };

            apiService.ConfigurationRequested += HandleApiConfigurationRequest;
        }
Esempio n. 5
0
        public StatusService(IComponentRegistryService componentRegistry, IApiDispatcherService apiService, ISettingsService settingsService)
        {
            if (apiService == null)
            {
                throw new ArgumentNullException(nameof(apiService));
            }

            _componentRegistry = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
            _settingsService   = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
        }
Esempio n. 6
0
        public AlexaDispatcherService(IHttpServerService httpServer, IAreaRegistryService areService, ISettingsService settingService,
                                      IComponentRegistryService componentService, ILogService logService)
        {
            _httpServer       = httpServer ?? throw new ArgumentNullException(nameof(httpServer));
            _areService       = areService ?? throw new ArgumentNullException(nameof(areService));
            _settingService   = settingService ?? throw new ArgumentNullException(nameof(settingService));
            _componentService = componentService ?? throw new ArgumentNullException(nameof(componentService));

            _log = logService.CreatePublisher(nameof(AlexaDispatcherService));
        }
Esempio n. 7
0
 public PersonalAgentService(
     ISettingsService settingsService,
     IComponentRegistryService componentRegistry,
     IAreaRegistryService areaService,
     IOutdoorService outdoorService,
     ILogService logService)
 {
     _settingsService    = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
     _componentsRegistry = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
     _areaService        = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _outdoorService     = outdoorService ?? throw new ArgumentNullException(nameof(outdoorService));
     _log = logService?.CreatePublisher(nameof(PersonalAgentService)) ?? throw new ArgumentNullException(nameof(logService));
 }
Esempio n. 8
0
        public Area(string id, IComponentRegistryService componentService, IAutomationRegistryService automationService, ISettingsService settingsService)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            _componentService  = componentService ?? throw new ArgumentNullException(nameof(componentService));
            _automationService = automationService ?? throw new ArgumentNullException(nameof(automationService));

            Id = id;

            settingsService.CreateSettingsMonitor(this, s => Settings = s.NewSettings);
        }
Esempio n. 9
0
 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));
 }
Esempio n. 10
0
 public MessageContextFactory(IAreaRegistryService areaService, IComponentRegistryService componentRegistry, ISettingsService settingsService)
 {
     _areaService       = areaService ?? throw new ArgumentNullException(nameof(areaService));
     _componentRegistry = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
     _settingsService   = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
 }
Esempio n. 11
0
 public ComponentRegistryScriptProxy(IComponentRegistryService componentRegistry, IScriptingSession scriptingSession)
 {
     _scriptingSession  = scriptingSession ?? throw new ArgumentNullException(nameof(scriptingSession));
     _componentRegistry = componentRegistry ?? throw new ArgumentNullException(nameof(componentRegistry));
 }