fix duplicate wmiQuery sensors on restarts

pull/19/head
sleevezipper 4 years ago
parent 9020c72cae
commit ba427a2065

@ -78,9 +78,6 @@ namespace hass_workstation_service.Data
case "CurrentClockSpeedSensor": case "CurrentClockSpeedSensor":
sensor = new CurrentClockSpeedSensor(publisher, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id); sensor = new CurrentClockSpeedSensor(publisher, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id);
break; break;
case "WMIQuerySensor":
sensor = new WMIQuerySensor(publisher, configuredSensor.Query, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id);
break;
case "CPULoadSensor": case "CPULoadSensor":
sensor = new CPULoadSensor(publisher, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id); sensor = new CPULoadSensor(publisher, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id);
break; break;
@ -111,6 +108,10 @@ namespace hass_workstation_service.Data
case "SessionStateSensor": case "SessionStateSensor":
sensor = new SessionStateSensor(publisher, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id); sensor = new SessionStateSensor(publisher, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id);
break; break;
// keep this one last!
case "WMIQuerySensor":
sensor = new WMIQuerySensor(publisher, configuredSensor.Query, configuredSensor.UpdateInterval, configuredSensor.Name, configuredSensor.Id);
break;
default: default:
Log.Logger.Error("unsupported sensor type in config"); Log.Logger.Error("unsupported sensor type in config");
break; break;

Loading…
Cancel
Save