#NEWLINE# def get_sensor_reading( name , ipmicmd ) : #NEWLINE# #INDENT# value = None #NEWLINE# sensor = None #NEWLINE# if ( ( name in fpc_sensors ) and ( 'elements' not in fpc_sensors [ name ] ) ) : #NEWLINE# #INDENT# sensor = fpc_sensors [ name ] #NEWLINE# value = sensor [ 'provider' ] ( ipmicmd ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( bname , _ , idx ) = name . rpartition ( ' ' ) #NEWLINE# idx = int ( idx ) #NEWLINE# if ( ( bname in fpc_sensors ) and ( idx <= fpc_sensors [ bname ] [ 'elements' ] ) ) : #NEWLINE# #INDENT# sensor = fpc_sensors [ bname ] #NEWLINE# value = sensor [ 'provider' ] ( ipmicmd , idx ) #NEWLINE# #UNINDENT# #UNINDENT# if ( sensor is not None ) : #NEWLINE# #INDENT# return sdr . SensorReading ( { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'imprecision' : None , #NEWLINE# 'value' : value , #NEWLINE# 'states' : [ ] , #NEWLINE# 'state_ids' : [ ] , #NEWLINE# 'health' : 0 , #NEWLINE# 'type' : sensor [ 'type' ] , #NEWLINE# #UNINDENT# } , sensor [ 'units' ] ) #NEWLINE# #UNINDENT# raise Exception ( ( 'Sensor not found: ' + name ) )