From b962d2d5b2561724b38b5093f2cd9d1c032a2dbb Mon Sep 17 00:00:00 2001 From: sleevezipper Date: Sat, 9 Jan 2021 23:52:49 +0100 Subject: [PATCH] another fix for duplicating sensors --- hass-workstation-service/Data/ConfigurationService.cs | 2 +- .../Domain/Sensors/MicrophoneActiveSensor.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hass-workstation-service/Data/ConfigurationService.cs b/hass-workstation-service/Data/ConfigurationService.cs index c1eae16..1a20a93 100644 --- a/hass-workstation-service/Data/ConfigurationService.cs +++ b/hass-workstation-service/Data/ConfigurationService.cs @@ -193,7 +193,7 @@ namespace hass_workstation_service.Data configuredSensorsToSave.Add(new ConfiguredSensor() { Id = wmiSensor.Id, Name = wmiSensor.Name, Type = wmiSensor.GetType().Name, UpdateInterval = wmiSensor.UpdateInterval, Query = wmiSensor.Query }); #pragma warning restore CA1416 // Validate platform compatibility } - if (sensor is NamedWindowSensor namedWindowSensor) + else if (sensor is NamedWindowSensor namedWindowSensor) { configuredSensorsToSave.Add(new ConfiguredSensor() { Id = namedWindowSensor.Id, Name = namedWindowSensor.Name, Type = namedWindowSensor.GetType().Name, UpdateInterval = namedWindowSensor.UpdateInterval, WindowName = namedWindowSensor.WindowName }); } diff --git a/hass-workstation-service/Domain/Sensors/MicrophoneActiveSensor.cs b/hass-workstation-service/Domain/Sensors/MicrophoneActiveSensor.cs index a46134d..0acf53d 100644 --- a/hass-workstation-service/Domain/Sensors/MicrophoneActiveSensor.cs +++ b/hass-workstation-service/Domain/Sensors/MicrophoneActiveSensor.cs @@ -10,7 +10,7 @@ namespace hass_workstation_service.Domain.Sensors public class MicrophoneActiveSensor : AbstractSensor { - public MicrophoneActiveSensor(MqttPublisher publisher, int? updateInterval = null, string name = "MicrophoneActive", Guid id = default(Guid)) : base(publisher, name, updateInterval ?? 10, id) + public MicrophoneActiveSensor(MqttPublisher publisher, int? updateInterval = null, string name = "MicrophoneActive", Guid id = default(Guid)) : base(publisher, name ?? "MicrophoneActive", updateInterval ?? 10, id) { } public override string GetState()