From 618ddd1c98e16c684bdb08db2386d0568d99d5c5 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Fri, 9 Nov 2018 20:07:06 -0800 Subject: [PATCH] Minor code refactors --- drivetemp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivetemp.py b/drivetemp.py index aaada44..e4dd75c 100755 --- a/drivetemp.py +++ b/drivetemp.py @@ -29,12 +29,13 @@ def retrieve_smart_temp(device_node): :param device_node: device to retrieve temperature for :type device_node: str :returns: output of skdump in mKelvin - :rtype: str + :rtype: float """ dump_cmd = subprocess.run(['sudo', 'skdump', '--temperature', - device_node], capture_output=True, - text=True) - return dump_cmd.stdout + device_node], + capture_output=True, + text=True) + return float(dump_cmd.stdout) def convert_to_celsius(mkel_temp): @@ -44,7 +45,7 @@ def convert_to_celsius(mkel_temp): :returns: temperature converted into degrees celsius :rtype: str """ - return (float(mkel_temp)/1000) - 273.15 + return (mkel_temp/1000) - 273.15 if __name__ == '__main__':