From 87cbce4244c1d0485656c917e1e1a065e382c46a Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Fri, 6 May 2016 13:52:38 +0100 Subject: [PATCH] hwmon: Added allowed values to `sensors` parameter Previously the sensor name was just appeneded to the end of the previous sensors name. --- wlauto/instrumentation/hwmon/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wlauto/instrumentation/hwmon/__init__.py b/wlauto/instrumentation/hwmon/__init__.py index d1bde4e5..20844f39 100644 --- a/wlauto/instrumentation/hwmon/__init__.py +++ b/wlauto/instrumentation/hwmon/__init__.py @@ -64,6 +64,7 @@ class HwmonInstrument(Instrument): parameters = [ Parameter('sensors', kind=list_of_strs, default=['energy', 'temp'], global_alias='hwmon_sensors', + allowed_values=HWMON_SENSORS.keys(), description='The kinds of sensors hwmon instrument will look for') ] @@ -73,11 +74,7 @@ class HwmonInstrument(Instrument): if self.sensors: self.sensor_kinds = {} for kind in self.sensors: - if kind in HWMON_SENSORS: - self.sensor_kinds[kind] = HWMON_SENSORS[kind] - else: - message = 'Unexpected sensor type: {}; must be in {}'.format(kind, HWMON_SENSORS.keys()) - raise ConfigError(message) + self.sensor_kinds[kind] = HWMON_SENSORS[kind] else: self.sensor_kinds = HWMON_SENSORS