diff --git a/NucuCar.Sensors/Telemetry/BackgroundWorker.cs b/NucuCar.Sensors/Telemetry/BackgroundWorker.cs index f3652b5..f48ed8e 100644 --- a/NucuCar.Sensors/Telemetry/BackgroundWorker.cs +++ b/NucuCar.Sensors/Telemetry/BackgroundWorker.cs @@ -18,7 +18,10 @@ namespace NucuCar.Sensors.Telemetry _serviceEnabled = configuration.GetValue("Telemetry:Enabled"); _interval = configuration.GetValue("Telemetry:Interval"); var azureIotHubConnectionString = configuration.GetValue("Telemetry:AzureIotHubConnectionString"); - SensorTelemetryPublisher.CreateSingleton(azureIotHubConnectionString, "NucuCar.Sensors", logger); + if (_serviceEnabled) + { + SensorTelemetryPublisher.CreateSingleton(azureIotHubConnectionString, "NucuCar.Sensors", logger); + } } protected override async Task ExecuteAsync(CancellationToken stoppingToken)