From bc80931e595fee66352ec9d92a3d36395ad81290 Mon Sep 17 00:00:00 2001 From: Jarrod Johnon Date: Wed, 14 Jan 2015 13:15:09 -0500 Subject: [PATCH] Expose sensor description data Provide a function to enumerate available sensors without actually reading them. This paves the way for management software to selectively query sensors of interest depending on circumstance. Change-Id: If63be5bc83996da10ee1fbb330395648340090bf --- pyghmi/ipmi/command.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 628cb47f..f404fffd 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -364,3 +364,16 @@ class Command(object): continue raise Exception(rsp['error']) yield self._sdr.sensors[sensor].decode_sensor_reading(rsp['data']) + + def get_sensor_descriptions(self): + """Get available sensor names + + Iterates over the available sensor descriptions + + :returns: Iterator of dicts describing each sensor + """ + if self._sdr is None: + self._sdr = sdr.SDR(self) + for sensor in self._sdr.get_sensor_numbers(): + yield {'name': self._sdr.sensors[sensor].name, + 'type': self._sdr.sensors[sensor].sensor_type}