mirror of
https://opendev.org/x/pyghmi
synced 2025-01-15 20:27:45 +00:00
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
This commit is contained in:
parent
d33d03f0cf
commit
bc80931e59
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user