Skip to content

Commit

Permalink
Signed-off-by: Vadym Yashchenko <[email protected]>
Browse files Browse the repository at this point in the history
What I did
	Add get_model() function
	Add get_low_critical_threshold() function
	Change __get(...) function.
How I did it
	Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API
  • Loading branch information
VadymYashchenko authored and Andriy Kokhan committed Dec 7, 2021
1 parent 629719c commit 403743e
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,27 @@ def __init__(self, chip, label):
def __get(self, attr_prefix, attr_suffix):
sensor_data = _sensors_get().get(self.__chip, {}).get(self.__label, {})
value = _value_get(sensor_data, attr_prefix, attr_suffix)
if value is not None: return value
raise NotImplementedError
if value is not None:
return value
else:
return -999.9

# ThermalBase interface methods:
def get_temperature(self) -> float:
return float(self.__get('temp', 'input'))

def get_high_threshold(self) -> float:
return float(self.__get('temp', 'max'))


def get_high_critical_threshold(self) -> float:
return float(self.__get('temp', 'crit'))

def get_low_critical_threshold(self) -> float:
return float(self.__get('temp', 'alarm'))

def get_model(self):
return f"{self.__label}".lower()

# DeviceBase interface methods:
def get_name(self):
Expand Down

0 comments on commit 403743e

Please sign in to comment.