Minor code refactors
This commit is contained in:
parent
b1d73da2bf
commit
618ddd1c98
11
drivetemp.py
11
drivetemp.py
@ -29,12 +29,13 @@ def retrieve_smart_temp(device_node):
|
|||||||
:param device_node: device to retrieve temperature for
|
:param device_node: device to retrieve temperature for
|
||||||
:type device_node: str
|
:type device_node: str
|
||||||
:returns: output of skdump in mKelvin
|
:returns: output of skdump in mKelvin
|
||||||
:rtype: str
|
:rtype: float
|
||||||
"""
|
"""
|
||||||
dump_cmd = subprocess.run(['sudo', 'skdump', '--temperature',
|
dump_cmd = subprocess.run(['sudo', 'skdump', '--temperature',
|
||||||
device_node], capture_output=True,
|
device_node],
|
||||||
text=True)
|
capture_output=True,
|
||||||
return dump_cmd.stdout
|
text=True)
|
||||||
|
return float(dump_cmd.stdout)
|
||||||
|
|
||||||
|
|
||||||
def convert_to_celsius(mkel_temp):
|
def convert_to_celsius(mkel_temp):
|
||||||
@ -44,7 +45,7 @@ def convert_to_celsius(mkel_temp):
|
|||||||
:returns: temperature converted into degrees celsius
|
:returns: temperature converted into degrees celsius
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
return (float(mkel_temp)/1000) - 273.15
|
return (mkel_temp/1000) - 273.15
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user