public TemperatureSensor(string id, INumericSensorAdapter adapter, ISettingsService settingsService) : base(id) { if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } _adapter = adapter ?? throw new ArgumentNullException(nameof(adapter)); settingsService.CreateSettingsMonitor <SingleValueSensorSettings>(this, s => Settings = s.NewSettings); adapter.ValueChanged += (s, e) => Update(e.Value); _commandExecutor.Register <ResetCommand>(c => _adapter.Refresh()); }
public IHumiditySensor RegisterHumiditySensor(IArea area, Enum id, INumericSensorAdapter adapter) { if (area == null) { throw new ArgumentNullException(nameof(area)); } if (adapter == null) { throw new ArgumentNullException(nameof(adapter)); } var humditySensor = new HumiditySensor($"{area.Id}.{id}", adapter, _settingsService); area.RegisterComponent(humditySensor); return(humditySensor); }