Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add get_presence() function and revised __get() function
Browse files Browse the repository at this point in the history
Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
VadymYashchenko authored and Andriy Kokhan committed Dec 7, 2021

Verified

This commit was signed with the committer’s verified signature.
dashpole David Ashpole
1 parent 403743e commit c1fa273
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -76,25 +76,21 @@ 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
else:
return -999.9
return value if value is not None else -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()

@@ -108,6 +104,9 @@ def get_presence(self):
def get_status(self):
return True

def is_replaceable(self):
return False

def thermal_list_get():
l = []
for chip, chip_data in _sensors_get().items():

0 comments on commit c1fa273

Please sign in to comment.